提交 642a57c7 编写于 作者: K Kohsuke Kawaguchi

Fixed a hang test in ci.jenkins-ci.org

It appears that this manually registered extension lives longer than the
single test and causing later tests to block forever.

Normally HudsonTestCase.tearDown() is supposed to clear it, but the
exception in the tearDown() prevented that code from getting executed.
上级 5c30383d
......@@ -4,23 +4,12 @@ import hudson.model.FreeStyleProject;
import hudson.model.Queue.Item;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.TestExtension;
public class QueueTaskDispatcherTest extends HudsonTestCase {
@SuppressWarnings("deprecation")
public void testCanRunBlockageIsDisplayed() throws Exception {
QueueTaskDispatcher.all().add(new QueueTaskDispatcher() {
@Override
public CauseOfBlockage canRun(Item item) {
return new CauseOfBlockage() {
@Override
public String getShortDescription() {
return "blocked by canRun";
}
};
}
});
FreeStyleProject project = createFreeStyleProject();
jenkins.getQueue().schedule(project);
......@@ -32,4 +21,17 @@ public class QueueTaskDispatcherTest extends HudsonTestCase {
assertTrue("Not blocked after 60 seconds", item.isBlocked());
assertEquals("Expected CauseOfBlockage to be returned", "blocked by canRun", item.getWhy());
}
@TestExtension
public static class MyQueueTaskDispatcher extends QueueTaskDispatcher {
@Override
public CauseOfBlockage canRun(Item item) {
return new CauseOfBlockage() {
@Override
public String getShortDescription() {
return "blocked by canRun";
}
};
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册