mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-26 19:15:09 +00:00
Fix flaky ProcessTreeTest#processProperlyKilledUnix by using a random sleep duration (#27080)
Fix flaky ProcessTreeTest#processProperlyKilledUnix Resolves JENKINS-70781 by using a randomly generated sleep duration instead of a hardcoded 100000. This prevents the test from failing when orphaned sleep processes from previous aborted test runs are present in the host system.
This commit is contained in:
1 parent
8bac187a58
commit
d1f2bafb83
1 file changed
+3
-2
@@ -88,13 +88,14 @@ class ProcessTreeTest {
|
||||
FreeStyleProject sleepProject = j.createFreeStyleProject();
|
||||
FreeStyleProject processJob = j.createFreeStyleProject();
|
||||
|
||||
sleepProject.getBuildersList().add(new Shell("nohup sleep 100000 &"));
|
||||
int sleepTime = 90000 + java.util.concurrent.ThreadLocalRandom.current().nextInt(20000);
|
||||
sleepProject.getBuildersList().add(new Shell("nohup sleep " + sleepTime + " &"));
|
||||
|
||||
j.buildAndAssertSuccess(sleepProject);
|
||||
|
||||
processJob.getBuildersList().add(new Shell("ps -ef | grep sleep"));
|
||||
|
||||
j.assertLogNotContains("sleep 100000", processJob.scheduleBuild2(0).get());
|
||||
j.assertLogNotContains("sleep " + sleepTime, processJob.scheduleBuild2(0).get());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user