/**
* Scenario: loads on one label shouldn't translate to load on another label.
*/
public void _testLabels() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson);
try {
DummyCloudImpl cloud = initHudson(0);
Label blue = hudson.getLabel("blue");
Label red = hudson.getLabel("red");
cloud.label = red;
// red jobs
List<FreeStyleProject> redJobs = create5SlowJobs(new Latch(5));
for (FreeStyleProject p : redJobs)
p.setAssignedLabel(red);
// blue jobs
List<FreeStyleProject> blueJobs = create5SlowJobs(new Latch(5));
for (FreeStyleProject p : blueJobs)
p.setAssignedLabel(blue);
// build all
List<Future<FreeStyleBuild>> blueBuilds = buildAll(blueJobs);
verifySuccessfulCompletion(buildAll(redJobs));
// cloud should only give us 5 nodes for 5 red jobs
assertEquals(5,cloud.numProvisioned);
// and all blue jobs should be still stuck in the queue
for (Future<FreeStyleBuild> bb : blueBuilds)
assertFalse(bb.isDone());
} finally {
bc.abort();
}
}