Skip to content

Commit

Permalink
JENKINS-43642 Add Pipeline round trip integration test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceilfors committed Aug 8, 2017
1 parent 9555dfb commit 8948655
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Expand Up @@ -60,6 +60,9 @@ dependencies {
testCompile 'cglib:cglib-nodep:2.2.2' // used by Spock
testCompile 'org.objenesis:objenesis:1.2' // used by Spock
integrationTestCompile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1'
jenkinsTest 'org.jenkins-ci.plugins.workflow:workflow-job:2.11.2@jar'
jenkinsTest 'org.jenkins-ci.plugins.workflow:workflow-api:2.15@jar' // used by workflow-job
jenkinsTest 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.10@jar' // used by workflow-job
}

task integrationTest(type: Test) {
Expand Down
Expand Up @@ -14,6 +14,7 @@ import hudson.security.HudsonPrivateSecurityRealm
import hudson.util.Secret
import jenkins.model.GlobalConfiguration
import org.acegisecurity.context.SecurityContextHolder
import org.jenkinsci.plugins.workflow.job.WorkflowJob
import org.junit.Rule
import org.junit.rules.RuleChain
import org.jvnet.hudson.test.Issue
Expand Down Expand Up @@ -80,6 +81,25 @@ class JiraTriggerIntegrationTest extends Specification {
jenkins.assertEqualBeans(before, after, 'changelogMatchers')
}

def 'WorkflowJob configuration round trip'() {
given:
WorkflowJob p = jenkins.jenkins.createProject(WorkflowJob, 'pipeline')
JiraChangelogTrigger before = new JiraChangelogTrigger()
before.changelogMatchers = [
new JiraFieldChangelogMatcher('status', 'new value', 'old value'),
new CustomFieldChangelogMatcher('custom field', 'new value', 'old value'),
]
p.addTrigger(before)
p.save()

when:
jenkins.configRoundtrip()

then:
JiraChangelogTrigger after = ++p.getTriggers().values().iterator() as JiraChangelogTrigger
jenkins.assertEqualBeans(before, after, 'changelogMatchers')
}

def 'Comment pattern by default must not be empty'() {
when:
def project = jenkins.createJiraCommentTriggeredProject('job')
Expand Down

0 comments on commit 8948655

Please sign in to comment.