Skip to content

Commit

Permalink
[JENKINS-25424] End-to-end test
Browse files Browse the repository at this point in the history
  • Loading branch information
olivergondza committed Dec 11, 2014
1 parent 39ec1bd commit c68619d
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/test/java/hudson/plugins/xvnc/XvncTest.java
Expand Up @@ -32,6 +32,7 @@
import hudson.model.Descriptor;
import hudson.model.FreeStyleProject;
import hudson.model.Hudson;
import hudson.model.Node;
import hudson.plugins.xvnc.Xvnc.DescriptorImpl;
import hudson.slaves.DumbSlave;
import hudson.tasks.Builder;
Expand Down Expand Up @@ -75,7 +76,7 @@ public void distinctDisplaySpaceForSlaves() throws Exception {
public void reuseDisplayNumberOnSameSlave() throws Exception {
FreeStyleProject p = j.jenkins.createProject(FreeStyleProject.class, "project");

runXvnc(p).cleanUp = true;;
runXvnc(p).cleanUp = true;

j.buildAndAssertSuccess(p);
j.buildAndAssertSuccess(p);
Expand Down Expand Up @@ -133,6 +134,26 @@ public void jenkins25424() {
assertTrue(desc instanceof DisplayAllocator.Property.DescriptorImpl);
}

@Test @Bug(25424)
public void saveComputerWithDisplayAllocatorProperty() throws Exception {
DumbSlave slave = j.createOnlineSlave();

configRoundtrip(slave); // Without property

FreeStyleProject p = j.jenkins.createProject(FreeStyleProject.class, "project");
p.setAssignedNode(slave);
runXvnc(p).cleanUp = true;
j.buildAndAssertSuccess(p);

configRoundtrip(slave); // With property
}

// TODO available since 1.479 in JenkinsRule
private <N extends Node> N configRoundtrip(N node) throws Exception {
j.submit(j.createWebClient().goTo("/computer/" + node.getNodeName() + "/configure").getFormByName("config"));
return (N)j.jenkins.getNode(node.getNodeName());
}

private Xvnc fakeXvncRun(FreeStyleProject p) throws Exception {
final Xvnc xvnc = new Xvnc(false, false);
p.getBuildWrappersList().add(xvnc);
Expand Down

0 comments on commit c68619d

Please sign in to comment.