-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-35411] Migrate batch-task-plugin to 2.x parent pom #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<parent> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>plugin</artifactId> | ||
<version>1.424</version> | ||
<version>2.9</version> | ||
</parent> | ||
|
||
<artifactId>batch-task</artifactId> | ||
|
@@ -13,6 +13,13 @@ | |
<name>Jenkins batch task plugin</name> | ||
<url>http://wiki.jenkins-ci.org/display/JENKINS/Batch+Task+Plugin</url> | ||
|
||
<properties> | ||
<jenkins.version>1.580.1</jenkins.version> | ||
<java.level>6</java.level> | ||
<powermock.version>1.6.1</powermock.version> | ||
<findbugs.failOnError>false</findbugs.failOnError> | ||
</properties> | ||
|
||
<developers> | ||
<developer> | ||
<id>kohsuke</id> | ||
|
@@ -24,20 +31,6 @@ | |
</developer> | ||
</developers> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<!-- TODO: please remove this exclude, once the parent is updated to v1.385+ --> | ||
<excludes> | ||
<exclude>**/BatchRunTest.*</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<scm> | ||
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection> | ||
<developerConnection>scm:git:[email protected]:jenkinsci/${project.artifactId}-plugin.git</developerConnection> | ||
|
@@ -48,21 +41,27 @@ | |
<dependency> | ||
<groupId>org.jenkins-ci.lib</groupId> | ||
<artifactId>envinject-lib</artifactId> | ||
<version>1.16</version> | ||
<version>1.23</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>matrix-project</artifactId> | ||
<version>1.4</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
<url>https://repo.jenkins-ci.org/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
<url>https://repo.jenkins-ci.org/public/</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<?jelly escape-by-default='true'?> | ||
<div> | ||
This plugin adds the "task" action to the project for performing batch tasks on the server workspace. | ||
</div> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package hudson.plugins.batch_task; | ||
|
||
import hudson.model.Computer; | ||
import hudson.model.Node; | ||
import org.junit.Rule; | ||
|
||
import hudson.model.FreeStyleProject; | ||
|
||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
public class BatchRunTest { | ||
|
||
@Rule | ||
public JenkinsRule r = new JenkinsRule(); | ||
|
||
@Test | ||
public void testBasic() throws Exception { | ||
// build on the slave | ||
Computer computer = r.jenkins.createComputer(); | ||
Node node = computer.getNode(); | ||
FreeStyleProject freeStyleProject = r.createFreeStyleProject(); | ||
freeStyleProject.setAssignedNode(node); | ||
r.assertBuildStatusSuccess(freeStyleProject.scheduleBuild2(0).get()); | ||
|
||
// add a batch task | ||
BatchTask batchTask = new BatchTask("test", "echo hello"); | ||
BatchTaskProperty batchTaskProperty = new BatchTaskProperty(batchTask); | ||
freeStyleProject.addProperty(batchTaskProperty); | ||
|
||
// now this should fail | ||
r.jenkins.getQueue().schedule(batchTask, 0).getFuture().get(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,27 +2,36 @@ | |
|
||
import hudson.model.FreeStyleProject; | ||
import hudson.model.Queue; | ||
import org.jvnet.hudson.test.Bug; | ||
import org.jvnet.hudson.test.HudsonTestCase; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.Issue; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import static org.junit.Assert.*; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
/** | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
@Bug(2917) | ||
public class RestartTest extends HudsonTestCase { | ||
@Issue("2917") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See |
||
public class RestartTest { | ||
|
||
@Rule | ||
public JenkinsRule r = new JenkinsRule(); | ||
|
||
@Test | ||
public void testRestart() throws Exception { | ||
FreeStyleProject p = createFreeStyleProject(); | ||
FreeStyleProject p = r.createFreeStyleProject(); | ||
p.scheduleBuild2(0).get(); | ||
|
||
// block the build so that nothing escapes from the queue | ||
hudson.setNumExecutors(0); | ||
r.jenkins.setNumExecutors(0); | ||
|
||
BatchTask t = new BatchTask("test", "echo hello"); | ||
BatchTaskProperty bp = new BatchTaskProperty(t); | ||
p.addProperty(bp); | ||
|
||
// schedule a build but make sure it stays in the queue | ||
Queue q = hudson.getQueue(); | ||
Queue q = r.jenkins.getQueue(); | ||
q.schedule(t,9999); | ||
// reload the queue and make sure it persists fine | ||
q.save(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summoning @stephenc 😄