Fri, 20 Mar 2009 19:11:14 -0700
+
hudson (1.292) unstable; urgency=low
* See http://hudson.dev.java.net/changelog.html for more details.
diff --git a/maven-agent/pom.xml b/maven-agent/pom.xml
index 5217afc10ce59f7121a338ca26b8150c50574196..2dabe6195d9d45332b4b4d90bbe0830f1afc5e79 100644
--- a/maven-agent/pom.xml
+++ b/maven-agent/pom.xml
@@ -27,7 +27,7 @@ THE SOFTWARE.
org.jvnet.hudson.main
pom
- 1.293-SNAPSHOT
+ 1.294-SNAPSHOT
../pom.xml
diff --git a/maven-interceptor/pom.xml b/maven-interceptor/pom.xml
index f4b17ce6cd3fab197fd4d8c63ca0192ba6f6c7cf..5d984e4bf960477952014f4b2967a38b9c58e18c 100644
--- a/maven-interceptor/pom.xml
+++ b/maven-interceptor/pom.xml
@@ -27,7 +27,7 @@ THE SOFTWARE.
org.jvnet.hudson.main
pom
- 1.293-SNAPSHOT
+ 1.294-SNAPSHOT
../pom.xml
diff --git a/pom.xml b/pom.xml
index 5a3cf2164928b4f2f1ef7d4156347b0b87e92500..a2fab900a859c9f4941e23515e45502e0cd9aa97 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@ THE SOFTWARE.
org.jvnet.hudson.main
pom
- 1.293-SNAPSHOT
+ 1.294-SNAPSHOT
pom
Hudson main module
diff --git a/remoting/pom.xml b/remoting/pom.xml
index 40fc29d771b6e48120ba8855d8198d9966d7e0c7..89bfafabc649607936b8324df3ab3bcb08c56fa6 100644
--- a/remoting/pom.xml
+++ b/remoting/pom.xml
@@ -27,7 +27,7 @@ THE SOFTWARE.
org.jvnet.hudson.main
pom
- 1.293-SNAPSHOT
+ 1.294-SNAPSHOT
../pom.xml
diff --git a/test/pom.xml b/test/pom.xml
index ba8aa73c654f5f5285d32b8809f9bbc07a7fbe1e..69a22a7bc1cc953bb02b58c542bc3feb270f806f 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -27,7 +27,7 @@ THE SOFTWARE.
pom
org.jvnet.hudson.main
- 1.293-SNAPSHOT
+ 1.294-SNAPSHOT
4.0.0
org.jvnet.hudson.main
diff --git a/test/src/test/java/hudson/slaves/NodeProvisionerTest.java b/test/src/test/java/hudson/slaves/NodeProvisionerTest.java
index a6f05b7e6cb6c7584442862009108463bcc2472d..0369d84735af61cb5ce2f1a71d042c7b64c6ec63 100644
--- a/test/src/test/java/hudson/slaves/NodeProvisionerTest.java
+++ b/test/src/test/java/hudson/slaves/NodeProvisionerTest.java
@@ -24,12 +24,9 @@
package hudson.slaves;
import hudson.BulkChange;
-import hudson.model.FreeStyleBuild;
-import hudson.model.FreeStyleProject;
-import hudson.model.LoadStatistics;
-import hudson.model.Node;
-import hudson.model.Result;
-import hudson.model.Label;
+import hudson.Launcher;
+import hudson.model.*;
+import hudson.tasks.Builder;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.SleepBuilder;
@@ -37,9 +34,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
/**
* @author Kohsuke Kawaguchi
@@ -60,6 +57,38 @@ public class NodeProvisionerTest extends HudsonTestCase {
LoadStatistics.CLOCK = original;
}
+ /**
+ * Latch synchronization primitive that waits for N thread to pass the checkpoint.
+ *
+ * This is used to make sure we get a set of builds that run long enough.
+ */
+ static class Latch {
+ /** Initial value */
+ public final int init;
+ private int n;
+
+ Latch(int n) {
+ this.n = init = n;
+ }
+
+ synchronized void block() throws InterruptedException {
+ if(--n==0) notifyAll(); // wake up everyone else
+ else wait(60*1000); // if a test takes t oo long, abort.
+ }
+
+ /**
+ * Creates a builder that blocks until the latch opens.
+ */
+ public Builder createBuilder() {
+ return new Builder() {
+ public boolean perform(AbstractBuild, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+ block();
+ return true;
+ }
+ };
+ }
+ }
+
/**
* Scenario: schedule a build and see if one slave is provisioned.
*/
@@ -69,7 +98,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
DummyCloudImpl cloud = initHudson(10);
- FreeStyleProject p = createJob(10);
+ FreeStyleProject p = createJob(new SleepBuilder(10));
Future f = p.scheduleBuild2(0);
f.get(30, TimeUnit.SECONDS); // if it's taking too long, abort.
@@ -89,7 +118,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
try {
DummyCloudImpl cloud = initHudson(0);
- verifySuccessfulCompletion(buildAll(create5SlowJobs()));
+ verifySuccessfulCompletion(buildAll(create5SlowJobs(new Latch(5))));
// the time it takes to complete a job is eternally long compared to the time it takes to launch
// a new slave, so in this scenario we end up allocating 5 slaves for 5 jobs.
@@ -110,7 +139,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
createSlave().toComputer().connect(false).get();
createSlave().toComputer().connect(false).get();
- verifySuccessfulCompletion(buildAll(create5SlowJobs()));
+ verifySuccessfulCompletion(buildAll(create5SlowJobs(new Latch(5))));
// we should have used two static slaves, thus only 3 slaves should have been provisioned
assertEquals(3,cloud.numProvisioned);
@@ -131,12 +160,12 @@ public class NodeProvisionerTest extends HudsonTestCase {
cloud.label = red;
// red jobs
- List redJobs = create5SlowJobs();
+ List redJobs = create5SlowJobs(new Latch(5));
for (FreeStyleProject p : redJobs)
p.setAssignedLabel(red);
// blue jobs
- List blueJobs = create5SlowJobs();
+ List blueJobs = create5SlowJobs(new Latch(5));
for (FreeStyleProject p : blueJobs)
p.setAssignedLabel(blue);
@@ -156,10 +185,10 @@ public class NodeProvisionerTest extends HudsonTestCase {
}
- private FreeStyleProject createJob(int delay) throws IOException {
+ private FreeStyleProject createJob(Builder builder) throws IOException {
FreeStyleProject p = createFreeStyleProject();
p.setAssignedLabel(null); // let it roam free, or else it ties itself to the master since we have no slaves
- p.getBuildersList().add(new SleepBuilder(delay));
+ p.getBuildersList().add(builder);
return p;
}
@@ -174,12 +203,12 @@ public class NodeProvisionerTest extends HudsonTestCase {
return cloud;
}
- private List create5SlowJobs() throws IOException {
+ private List create5SlowJobs(Latch l) throws IOException {
List jobs = new ArrayList();
- for( int i=0; i<5; i++)
+ for( int i=0; i> builds) throws Exception {
System.out.println("Waiting for a completion");
for (Future f : builds) {
- FreeStyleBuild b = f.get();// if it's taking too long, abort.
- assertBuildStatus(Result.SUCCESS,b);
+ try {
+ assertBuildStatus(Result.SUCCESS, f.get(1, TimeUnit.MINUTES));
+ } catch (TimeoutException e) {
+ // time out so that the automated test won't hang forever, even when we have bugs
+ System.out.println("Build didn't complete in time");
+ throw e;
+ }
}
}
}
diff --git a/war/pom.xml b/war/pom.xml
index 74fd95ae5f45220207844849758004e2e68f6f86..d686eb2acc8c99340ab92e33ed3c63cba75d5247 100644
--- a/war/pom.xml
+++ b/war/pom.xml
@@ -27,7 +27,7 @@ THE SOFTWARE.
org.jvnet.hudson.main
pom
- 1.293-SNAPSHOT
+ 1.294-SNAPSHOT
../pom.xml