-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for docker agent with Closure param
- Loading branch information
Willem Borgesius
authored and
Willem Borgesius
committed
Oct 1, 2020
1 parent
dff6f47
commit af51895
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/test/groovy/com/lesfurets/jenkins/unit/declarative/TestDockerAgentInStep.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.lesfurets.jenkins.unit.declarative | ||
|
||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class TestDockerAgentInStep extends DeclarativePipelineTest { | ||
|
||
@Before | ||
@Override | ||
void setUp() throws Exception { | ||
super.setUp() | ||
} | ||
|
||
@Test | ||
void test_example() { | ||
runScript("src/test/jenkins/jenkinsfiles/Docker_agentInStep_JenkinsFile") | ||
assertJobStatusSuccess() | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/jenkins/jenkinsfiles/Docker_agentInStep_JenkinsFile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pipeline { | ||
|
||
stages { | ||
stage('Maven Build') { | ||
agent { docker { image 'maven' } } | ||
steps { | ||
sh 'mvn install' | ||
} | ||
} | ||
} | ||
} |