Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
|
@@ -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); |
|
|