fix intermittent test failure

I believe this test failed because the jenkins slave node that gets
created in the test does not come online fast enough.  The
test now polls to make sure the slave is online before continuing.

Change-Id: I2a86d0b550daf70e5d2041994d78ff5e4649a62b
This commit is contained in:
zaro0508 2013-04-30 14:51:12 -07:00
parent d3bc4dda56
commit 07026b7b71
1 changed files with 13 additions and 0 deletions

View File

@ -44,6 +44,19 @@ public class ExecutorWorkerThreadTest extends HudsonTestCase {
public void setUp() throws Exception {
super.setUp();
slave = createOnlineSlave(new LabelAtom("oneiric-10"));
// poll to make sure test slave is online before continuing
long timeoutExpiredMs = System.currentTimeMillis() + 3000;
while (true) {
if (slave.getChannel() != null) {
break;
}
this.wait(timeoutExpiredMs - System.currentTimeMillis());
if (System.currentTimeMillis() >= timeoutExpiredMs) {
fail("Could not start test slave");
}
}
slave.setLabelString("ubuntu gcc python-2.4 linux");
}