mirror of https://github.com/jenkinsci/jenkins.git
Merged revisions 16380-16381,16433,16435,16438 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/rc ........ r16380 | kohsuke | 2009-03-19 17:10:38 -0700 (Thu, 19 Mar 2009) | 1 line PeriodicWork change broke the tests, because the timer registration wasn't kicking in ........ r16381 | kohsuke | 2009-03-19 17:33:14 -0700 (Thu, 19 Mar 2009) | 1 line fixed a test so that it's no longer timing sensitive ........ r16433 | kohsuke | 2009-03-20 18:35:55 -0700 (Fri, 20 Mar 2009) | 1 line [maven-release-plugin] prepare release hudson-1_293 ........ r16435 | kohsuke | 2009-03-20 18:36:21 -0700 (Fri, 20 Mar 2009) | 1 line [maven-release-plugin] prepare for next development iteration ........ r16438 | kohsuke | 2009-03-20 19:10:29 -0700 (Fri, 20 Mar 2009) | 1 line updated changelog as a part of the release ........ git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16441 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
parent
59ae0b8bae
commit
72242fcddf
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
<parent>
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>1.293-SNAPSHOT</version>
|
||||
<version>1.294-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
|
|
@ -192,8 +192,6 @@ public final class WebAppMain implements ServletContextListener {
|
|||
throw new Error(e);
|
||||
}
|
||||
|
||||
Trigger.init(); // start running trigger
|
||||
|
||||
// trigger the loading of changelogs in the background,
|
||||
// but give the system 10 seconds so that the first page
|
||||
// can be served quickly
|
||||
|
|
|
|||
|
|
@ -557,6 +557,8 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
|
|||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Trigger.init(); // start running trigger
|
||||
}
|
||||
|
||||
public TcpSlaveAgentListener getTcpSlaveAgentListener() {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
hudson (1.293) unstable; urgency=low
|
||||
|
||||
* See http://hudson.dev.java.net/changelog.html for more details.
|
||||
|
||||
-- Kohsuke Kawaguchi <kk@kohsuke.org> 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.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
<parent>
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>1.293-SNAPSHOT</version>
|
||||
<version>1.294-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
<parent>
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>1.293-SNAPSHOT</version>
|
||||
<version>1.294-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -33,7 +33,7 @@ THE SOFTWARE.
|
|||
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>1.293-SNAPSHOT</version>
|
||||
<version>1.294-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Hudson main module</name>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
<parent>
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>1.293-SNAPSHOT</version>
|
||||
<version>1.294-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
<parent>
|
||||
<artifactId>pom</artifactId>
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
<version>1.293-SNAPSHOT</version>
|
||||
<version>1.294-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
* <p>
|
||||
* 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<FreeStyleBuild> 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<FreeStyleProject> redJobs = create5SlowJobs();
|
||||
List<FreeStyleProject> redJobs = create5SlowJobs(new Latch(5));
|
||||
for (FreeStyleProject p : redJobs)
|
||||
p.setAssignedLabel(red);
|
||||
|
||||
// blue jobs
|
||||
List<FreeStyleProject> blueJobs = create5SlowJobs();
|
||||
List<FreeStyleProject> 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<FreeStyleProject> create5SlowJobs() throws IOException {
|
||||
private List<FreeStyleProject> create5SlowJobs(Latch l) throws IOException {
|
||||
List<FreeStyleProject> jobs = new ArrayList<FreeStyleProject>();
|
||||
for( int i=0; i<5; i++)
|
||||
for( int i=0; i<l.init; i++)
|
||||
//set a large delay, to simulate the situation where we need to provision more slaves
|
||||
// to keep up with the load
|
||||
jobs.add(createJob(3000));
|
||||
jobs.add(createJob(l.createBuilder()));
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
|
@ -197,8 +226,13 @@ public class NodeProvisionerTest extends HudsonTestCase {
|
|||
private void verifySuccessfulCompletion(List<Future<FreeStyleBuild>> builds) throws Exception {
|
||||
System.out.println("Waiting for a completion");
|
||||
for (Future<FreeStyleBuild> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
<parent>
|
||||
<groupId>org.jvnet.hudson.main</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>1.293-SNAPSHOT</version>
|
||||
<version>1.294-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue