From e17dfea4f5588a94361b05512ff85f08e6ac3e8e Mon Sep 17 00:00:00 2001 From: Willem Borgesius Date: Wed, 30 Sep 2020 15:47:58 +0200 Subject: [PATCH] Add test for nesting stages including parallel --- .../declarative/TestDeclarativePipeline.groovy | 6 ++++++ .../Parallel_NestedStages_Jenkinsfile | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/test/jenkins/jenkinsfiles/Parallel_NestedStages_Jenkinsfile diff --git a/src/test/groovy/com/lesfurets/jenkins/unit/declarative/TestDeclarativePipeline.groovy b/src/test/groovy/com/lesfurets/jenkins/unit/declarative/TestDeclarativePipeline.groovy index 26a6ae9b..6be725d7 100644 --- a/src/test/groovy/com/lesfurets/jenkins/unit/declarative/TestDeclarativePipeline.groovy +++ b/src/test/groovy/com/lesfurets/jenkins/unit/declarative/TestDeclarativePipeline.groovy @@ -213,6 +213,12 @@ class TestDeclarativePipeline extends DeclarativePipelineTest { assertJobStatusSuccess() } + @Test void should_parallel_nested_stages() throws Exception { + runScript('Parallel_NestedStages_Jenkinsfile') + printCallStack() + assertJobStatusSuccess() + } + @Test void should_sub_stages() throws Exception { runScript('ComplexStages_Jenkinsfile') printCallStack() diff --git a/src/test/jenkins/jenkinsfiles/Parallel_NestedStages_Jenkinsfile b/src/test/jenkins/jenkinsfiles/Parallel_NestedStages_Jenkinsfile new file mode 100644 index 00000000..806b19be --- /dev/null +++ b/src/test/jenkins/jenkinsfiles/Parallel_NestedStages_Jenkinsfile @@ -0,0 +1,17 @@ +pipeline { + stages { + stage('Parallel Stage') { + parallel { + stage('Branch A') { + stages { + stage('Nested 1') { + steps { + echo "In stage Nested 1 within Branch A" + } + } + } + } + } + } + } +}