mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 21:42:27 +00:00
added another convenience method
This commit is contained in:
1 parent
642632d16b
commit
f105becb14
1 file changed
+6
-3
@@ -685,11 +685,14 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
|
||||
*/
|
||||
public DumbSlave createSlave(String labels, EnvVars env) throws Exception {
|
||||
synchronized (hudson) {
|
||||
// this synchronization block is so that we don't end up adding the same slave name more than once.
|
||||
|
||||
int sz = hudson.getNodes().size();
|
||||
return createSlave("slave" + sz,labels,env);
|
||||
}
|
||||
}
|
||||
|
||||
DumbSlave slave = new DumbSlave("slave" + sz, "dummy",
|
||||
public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception {
|
||||
synchronized (hudson) {
|
||||
DumbSlave slave = new DumbSlave(nodeName, "dummy",
|
||||
createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
|
||||
hudson.addNode(slave);
|
||||
return slave;
|
||||
|
||||
Reference in new issue
Block a user