Skip to content
Permalink
Browse files

Merge pull request #262 from jglick/GitStatus-multibranch-JENKINS-31884

[JENKINS-31884] Integration test for Git webhooks in multibranch projects
  • Loading branch information
jglick committed Dec 4, 2015
2 parents ba9d22d + cbb2bdb commit 9eb0a8668a509c3f9c27a0eff00b01604ce230ac
@@ -24,6 +24,8 @@

package org.jenkinsci.plugins.workflow.steps.scm;

import com.gargoylesoftware.htmlunit.WebResponse;
import org.apache.commons.httpclient.NameValuePair;
import org.jvnet.hudson.test.JenkinsRule;

/**
@@ -45,7 +47,13 @@ public void git(String... cmds) throws Exception {

public void notifyCommit(JenkinsRule r) throws Exception {
synchronousPolling(r);
System.out.println(r.createWebClient().goTo("git/notifyCommit?url=" + bareUrl(), "text/plain").getWebResponse().getContentAsString());
WebResponse webResponse = r.createWebClient().goTo("git/notifyCommit?url=" + bareUrl(), "text/plain").getWebResponse();
System.out.println(webResponse.getContentAsString());
for (NameValuePair pair : webResponse.getResponseHeaders()) {
if (pair.getName().equals("Triggered")) {
System.out.println("Triggered: " + pair.getValue());
}
}
r.waitUntilNoActivity();
}

@@ -123,7 +123,8 @@
sampleGitRepo.write("file", "subsequent content");
sampleGitRepo.git("commit", "--all", "--message=tweaked");
SemaphoreStep.success("wait/1", null);
WorkflowRun b2 = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
sampleGitRepo.notifyCommit(story.j);
WorkflowRun b2 = p.getLastBuild();
assertEquals(2, b2.getNumber());
story.j.assertLogContains("initial content", story.j.waitForCompletion(b1));
story.j.assertLogContains("SUBSEQUENT CONTENT", b2);

0 comments on commit 9eb0a86

Please sign in to comment.