提交 b88f313f 编写于 作者: K Kohsuke Kawaguchi

make sure to close off all the channels at the end

上级 40983bac
......@@ -72,6 +72,8 @@ import hudson.model.TaskListener;
import hudson.model.UpdateSite;
import hudson.model.User;
import hudson.model.View;
import hudson.remoting.Channel;
import hudson.remoting.VirtualChannel;
import hudson.remoting.Which;
import hudson.security.ACL;
import hudson.security.AbstractPasswordBasedSecurityRealm;
......@@ -233,6 +235,11 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
*/
private List<WebClient> clients = new ArrayList<WebClient>();
/**
* Remember channels that are created, to release them at the end.
*/
private List<Channel> channels = new ArrayList<Channel>();
/**
* JavaScript "debugger" that provides you information about the JavaScript call stack
* and the current values of the local variables in those stack frame.
......@@ -344,6 +351,13 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
client.closeAllWindows();
}
clients.clear();
for (Channel c : channels)
c.close();
for (Channel c : channels)
c.join();
channels.clear();
} finally {
server.stop();
for (LenientRunnable r : tearDowns)
......@@ -433,6 +447,17 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
return realm;
}
@TestExtension
public static class ComputerListenerImpl extends ComputerListener {
@Override
public void onOnline(Computer c, TaskListener listener) throws IOException, InterruptedException {
VirtualChannel ch = c.getChannel();
if (ch instanceof Channel)
TestEnvironment.get().testCase.channels.add((Channel)ch);
}
}
// /**
// * Sets guest credentials to access java.net Subversion repo.
// */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册