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

[FIXED JENKINS-5076]

Verified that JENKINS-5076 is no longer happening.

Looking at the code, I think the actual fix was in a2d82576.
上级 0ee7a5ee
......@@ -25,6 +25,8 @@ package hudson.matrix
import hudson.model.Cause
import hudson.model.Result
import hudson.slaves.DumbSlave
import hudson.slaves.RetentionStrategy
import hudson.tasks.Ant
import hudson.tasks.ArtifactArchiver
import hudson.tasks.Fingerprinter
......@@ -62,6 +64,8 @@ import java.util.ArrayList;
import hudson.model.Action;
import java.util.concurrent.CountDownLatch
import static hudson.model.Node.Mode.EXCLUSIVE
import static org.junit.Assert.*
import org.junit.Assume
import org.junit.Rule
......@@ -487,4 +491,32 @@ public class MatrixProjectTest {
assertNotNull(c.getBuildByNumber(1));
}
/**
* Given a small master and a big exclusive slave, the fair scheduling would prefer running the flyweight job
* in the slave. But if the scheduler honors the EXCLUSIVE flag, then we should see it built on the master.
*
* Since there's a chance that the fair scheduling just so happens to pick up the master by chance,
* we try multiple jobs to reduce the chance of that happening.
*/
@Bug(5076)
@Test
public void dontRunOnExclusiveSlave() {
def projects = (0..10).collect {
def m = j.createMatrixProject()
def axes = new AxisList();
axes.add(new TextAxis("p", "only"));
m.axes = axes
return m;
}
def s = new DumbSlave("big", "this is a big slave", j.createTmpDir().path, "20", EXCLUSIVE, "", j.createComputerLauncher(null), RetentionStrategy.NOOP);
j.jenkins.addNode(s);
s.toComputer().connect(false).get(); // connect this guy
projects.each { p ->
def b = j.assertBuildStatusSuccess(p.scheduleBuild2(2))
assertSame(b.builtOn, j.jenkins)
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册