提交 a3ed4aad 编写于 作者: M Marat Radchenko 提交者: Oleg Nenashev

Fix formatting of ProcessTreeKillerTest.java (#4235)

Trailing whitespace, wrong indentation
上级 1004d327
......@@ -35,35 +35,35 @@ public class ProcessTreeKillerTest {
@Rule
public JenkinsRule j = new JenkinsRule();
private Process process;
@After
public void tearDown() throws Exception {
ProcessTree.vetoersExist = null;
if (null != process)
process.destroy();
}
}
@Test
public void manualAbortProcess() throws Exception {
ProcessTree.enabled = true;
FreeStyleProject project = j.createFreeStyleProject();
public void manualAbortProcess() throws Exception {
ProcessTree.enabled = true;
FreeStyleProject project = j.createFreeStyleProject();
// this contains a maven project with a single test that sleeps 5s.
project.setScm(new ExtractResourceSCM(getClass().getResource(
"ProcessTreeKiller-test-project.jar")));
project.getBuildersList().add(new Maven("install", "maven"));
// this contains a maven project with a single test that sleeps 5s.
project.setScm(new ExtractResourceSCM(getClass().getResource(
"ProcessTreeKiller-test-project.jar")));
project.getBuildersList().add(new Maven("install", "maven"));
// build the project, wait until tests are running, then cancel.
project.scheduleBuild2(0).waitForStart();
// build the project, wait until tests are running, then cancel.
project.scheduleBuild2(0).waitForStart();
FreeStyleBuild b = project.getLastBuild();
b.doStop();
Thread.sleep(1000);
Thread.sleep(1000);
// will fail (at least on windows) if test process is still running
b.getWorkspace().deleteRecursive();
}
// will fail (at least on windows) if test process is still running
b.getWorkspace().deleteRecursive();
}
@Test
public void killNullProcess() throws Exception {
......@@ -106,6 +106,7 @@ public class ProcessTreeKillerTest {
assertTrue("Process should be dead", !spawner.proc.isAlive());
}
}
public static final class SpawnBuilder extends TestBuilder {
private Proc proc;
......@@ -117,7 +118,7 @@ public class ProcessTreeKillerTest {
return true;
}
}
@Test
@Issue("JENKINS-9104")
public void considersKillingVetos() throws Exception {
......@@ -146,35 +147,35 @@ public class ProcessTreeKillerTest {
// Means the process is still running
}
}
@Test
@Issue("JENKINS-9104")
public void considersKillingVetosOnSlave() throws Exception {
// on some platforms where we fail to list any processes, this test will
// just not work
assumeTrue(ProcessTree.get() != ProcessTree.DEFAULT);
// Define a process we (shouldn't) kill
ProcessBuilder pb = new ProcessBuilder();
pb.environment().put("cookie", "testKeepDaemonsAlive");
if (File.pathSeparatorChar == ';') {
pb.command("cmd");
} else {
pb.command("sleep", "5m");
}
// Create an agent so we can tell it to kill the process
Slave s = j.createSlave();
s.toComputer().connect(false).get();
// Start the process
process = pb.start();
// Call killall (somewhat roundabout though) to (not) kill it
StringWriter out = new StringWriter();
s.createLauncher(new StreamTaskListener(out)).kill(ImmutableMap.of("cookie", "testKeepDaemonsAlive"));
try {
process.exitValue();
fail("Process should have been excluded from the killing");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册