Logger LOGGER = Logger.getLogger(DurableTaskStep.class.getName());
LOGGER.setLevel(Level.FINE);
Handler handler = new ConsoleHandler();
handler.setLevel(Level.ALL);
LOGGER.addHandler(handler);
DumbSlave s = new DumbSlave("dumbo", "dummy", tmp.getRoot().getAbsolutePath(), "1", Node.Mode.NORMAL, "", new JNLPLauncher(), RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList());
story.j.jenkins.addNode(s);
startJnlpProc();
p = story.j.jenkins.createProject(WorkflowJob.class, "demo");
File f1 = new File(story.j.jenkins.getRootDir(), "f1");
File f2 = new File(story.j.jenkins.getRootDir(), "f2");
new FileOutputStream(f1).close();
p.setDefinition(new CpsFlowDefinition(
"node('dumbo') {\n" +
" sh 'touch \"" + f2 + "\"; while [ -f \"" + f1 + "\" ]; do sleep 1; done; echo finished waiting; rm \"" + f2 + "\"'\n" +
" echo 'OK, done'\n" +
"}"));
startBuilding();
while (!f2.isFile()) {
Thread.sleep(100);
}
assertTrue(b.isBuilding());
Computer c = s.toComputer();
assertNotNull(c);
killJnlpProc();
while (c.isOnline()) {
Thread.sleep(100);
}