Skip to content

Commit

Permalink
Applying suggested fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Serghei Anikeev committed Oct 10, 2016
1 parent 792ab8f commit f37a813
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class MultiJobStepContext extends StepContext {
stepNodes << new NodeBuilder().'com.tikal.jenkins.plugins.multijob.MultiJobBuilder' {
phaseName phaseContext.phaseName
delegate.continuationCondition(phaseContext.continuationCondition)
delegate.executionType(phaseContext.executionType)
if (jobManagement.isMinimumPluginVersionInstalled('jenkins-multijob-plugin', '1.22')) {
delegate.executionType(phaseContext.executionType)
}
phaseJobs {
phaseContext.jobsInPhase.each { PhaseJobContext jobInPhase ->
Node phaseJobNode = 'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ class MultiJobStepContextSpec extends Specification {
then:
with(context.stepNodes[0]) {
name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder'
children().size() == 4
children().size() == 3
phaseName[0].value() == 'First'
continuationCondition[0].value() == 'SUCCESSFUL'
executionType[0].value() == 'PARALLEL'
phaseJobs[0].value().empty
}

Expand All @@ -33,10 +32,9 @@ class MultiJobStepContextSpec extends Specification {
then:
with(context.stepNodes[1]) {
name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder'
children().size() == 4
children().size() == 3
phaseName[0].value() == 'Second'
continuationCondition[0].value() == 'SUCCESSFUL'
executionType[0].value() == 'PARALLEL'
phaseJobs[0].children().size() == 1
with(phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0]) {
children().size() == 7
Expand All @@ -62,10 +60,9 @@ class MultiJobStepContextSpec extends Specification {
then:
with(context.stepNodes[0]) {
name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder'
children().size() == 4
children().size() == 3
phaseName[0].value() == 'Third'
continuationCondition[0].value() == 'SUCCESSFUL'
executionType[0].value() == 'PARALLEL'
phaseJobs[0].children().size() == 3
phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0].jobName[0].value() == 'JobA'
phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[1].jobName[0].value() == 'JobB'
Expand Down Expand Up @@ -103,10 +100,9 @@ class MultiJobStepContextSpec extends Specification {

then:
with(context.stepNodes[0]) {
children().size() == 4
children().size() == 3
phaseName[0].value() == 'Fourth'
continuationCondition[0].value() == 'SUCCESSFUL'
executionType[0].value() == 'PARALLEL'
phaseJobs[0].children().size() == 1
with(phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0]) {
children().size() == 8
Expand Down Expand Up @@ -192,10 +188,9 @@ class MultiJobStepContextSpec extends Specification {
then:
with(context.stepNodes[0]) {
name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder'
children().size() == 4
children().size() == 3
phaseName[0].value() == 'Second'
continuationCondition[0].value() == 'SUCCESSFUL'
executionType[0].value() == 'PARALLEL'
phaseJobs[0].children().size() == 1
with(phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0]) {
children().size() == 7
Expand Down Expand Up @@ -232,20 +227,17 @@ class MultiJobStepContextSpec extends Specification {
thrown(DslScriptException)
}

def 'call phase with unsupported execution type'(String execution) {
def 'call phase with unsupported execution type'() {
setup:
jobManagement.isMinimumPluginVersionInstalled('jenkins-multijob-plugin', '1.22') >> true

when:
context.phase('test') {
executionType execution
executionType 'FOO'
}

then:
thrown(DslScriptException)

where:
execution << ['FOO']
}

def 'call phase with supported condition'(String condition) {
Expand Down Expand Up @@ -290,7 +282,7 @@ class MultiJobStepContextSpec extends Specification {
}

where:
execution << ['SEQUENTIALLY']
execution << ['PARALLEL', 'SEQUENTIALLY']
}

def 'phase works inside conditionalSteps'() {
Expand Down

0 comments on commit f37a813

Please sign in to comment.