mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
Better readable rule names: dockerExecuteRule
This commit is contained in:
parent
b486f32dc1
commit
4e01b94458
@ -46,7 +46,7 @@ class ArtifactSetVersionTest extends BasePiperTest {
|
||||
def sshAgentList = []
|
||||
|
||||
private ExpectedException thrown = ExpectedException.none()
|
||||
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
|
||||
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
|
||||
private JenkinsWriteFileRule jwfr = new JenkinsWriteFileRule(this)
|
||||
@ -62,7 +62,7 @@ class ArtifactSetVersionTest extends BasePiperTest {
|
||||
.around(shellRule)
|
||||
.around(new JenkinsReadMavenPomRule(this, 'test/resources/versioning/MavenArtifactVersioning'))
|
||||
.around(jwfr)
|
||||
.around(jder)
|
||||
.around(dockerExecuteRule)
|
||||
.around(stepRule)
|
||||
.around(jer)
|
||||
|
||||
|
@ -16,14 +16,14 @@ class BatsExecuteTestsTest extends BasePiperTest {
|
||||
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
|
||||
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
|
||||
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
|
||||
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
|
||||
|
||||
@Rule
|
||||
public RuleChain rules = Rules
|
||||
.getCommonRules(this)
|
||||
.around(new JenkinsReadYamlRule(this))
|
||||
.around(thrown)
|
||||
.around(jder)
|
||||
.around(dockerExecuteRule)
|
||||
.around(shellRule)
|
||||
.around(loggingRule)
|
||||
.around(stepRule)
|
||||
@ -61,8 +61,8 @@ class BatsExecuteTestsTest extends BasePiperTest {
|
||||
assertThat(shellRule.shell, hasItem('bats-core/bin/bats --recursive --tap src/test > \'TEST-testPackage.tap\''))
|
||||
assertThat(shellRule.shell, hasItem('cat \'TEST-testPackage.tap\''))
|
||||
|
||||
assertThat(jder.dockerParams.dockerImage, is('node:8-stretch'))
|
||||
assertThat(jder.dockerParams.dockerWorkspace, is('/home/node'))
|
||||
assertThat(dockerExecuteRule.dockerParams.dockerImage, is('node:8-stretch'))
|
||||
assertThat(dockerExecuteRule.dockerParams.dockerWorkspace, is('/home/node'))
|
||||
|
||||
assertThat(shellRule.shell, hasItem('npm install tap-xunit -g'))
|
||||
assertThat(shellRule.shell, hasItem('cat \'TEST-testPackage.tap\' | tap-xunit --package=\'testPackage\' > TEST-testPackage.xml'))
|
||||
@ -77,7 +77,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
|
||||
juStabUtils: utils,
|
||||
outputFormat: 'tap'
|
||||
)
|
||||
assertThat(jder.dockerParams.size(), is(0))
|
||||
assertThat(dockerExecuteRule.dockerParams.size(), is(0))
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -116,7 +116,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
|
||||
|
||||
assertThat(gitRepository.size(), is(1))
|
||||
assertThat(gitRepository.url, is('testRepo'))
|
||||
assertThat(jder.dockerParams.stashContent, hasItem(startsWith('testContent-')))
|
||||
assertThat(dockerExecuteRule.dockerParams.stashContent, hasItem(startsWith('testContent-')))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -24,7 +24,7 @@ import static org.junit.Assert.assertFalse
|
||||
|
||||
class DockerExecuteOnKubernetesTest extends BasePiperTest {
|
||||
private ExpectedException exception = ExpectedException.none()
|
||||
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
|
||||
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
|
||||
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
|
||||
@ -34,7 +34,7 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
|
||||
.getCommonRules(this)
|
||||
.around(new JenkinsReadYamlRule(this))
|
||||
.around(exception)
|
||||
.around(jder)
|
||||
.around(dockerExecuteRule)
|
||||
.around(shellRule)
|
||||
.around(loggingRule)
|
||||
.around(stepRule)
|
||||
|
@ -22,14 +22,14 @@ class MavenExecuteTest extends BasePiperTest {
|
||||
Map dockerParameters
|
||||
|
||||
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
|
||||
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
|
||||
|
||||
@Rule
|
||||
public RuleChain ruleChain = Rules
|
||||
.getCommonRules(this)
|
||||
.around(new JenkinsReadYamlRule(this))
|
||||
.around(jder)
|
||||
.around(dockerExecuteRule)
|
||||
.around(shellRule)
|
||||
.around(stepRule)
|
||||
|
||||
@ -37,7 +37,7 @@ class MavenExecuteTest extends BasePiperTest {
|
||||
void testExecuteBasicMavenCommand() throws Exception {
|
||||
|
||||
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install')
|
||||
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
|
||||
assertEquals('maven:3.5-jdk-7', dockerExecuteRule.dockerParams.dockerImage)
|
||||
|
||||
assert shellRule.shell[0] == 'mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install'
|
||||
}
|
||||
@ -46,7 +46,7 @@ class MavenExecuteTest extends BasePiperTest {
|
||||
void testExecuteBasicMavenCommandWithDownloadLogsEnabled() throws Exception {
|
||||
|
||||
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install', logSuccessfulMavenTransfers: true)
|
||||
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
|
||||
assertEquals('maven:3.5-jdk-7', dockerExecuteRule.dockerParams.dockerImage)
|
||||
|
||||
assert shellRule.shell[0] == 'mvn --batch-mode clean install'
|
||||
}
|
||||
@ -64,7 +64,7 @@ class MavenExecuteTest extends BasePiperTest {
|
||||
flags: '-o',
|
||||
m2Path: 'm2Path',
|
||||
defines: '-Dmaven.tests.skip=true')
|
||||
assertEquals('maven:3.5-jdk-8-alpine', jder.dockerParams.dockerImage)
|
||||
assertEquals('maven:3.5-jdk-8-alpine', dockerExecuteRule.dockerParams.dockerImage)
|
||||
String mvnCommand = "mvn --global-settings 'globalSettingsFile.xml' -Dmaven.repo.local='m2Path' --settings 'projectSettingsFile.xml' --file 'pom.xml' -o --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install -Dmaven.tests.skip=true"
|
||||
assertTrue(shellRule.shell.contains(mvnCommand))
|
||||
}
|
||||
@ -72,7 +72,7 @@ class MavenExecuteTest extends BasePiperTest {
|
||||
@Test
|
||||
void testMavenCommandForwardsDockerOptions() throws Exception {
|
||||
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install')
|
||||
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
|
||||
assertEquals('maven:3.5-jdk-7', dockerExecuteRule.dockerParams.dockerImage)
|
||||
|
||||
assertEquals('mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install', shellRule.shell[0])
|
||||
}
|
||||
@ -80,7 +80,7 @@ class MavenExecuteTest extends BasePiperTest {
|
||||
@Test
|
||||
void testMavenCommandWithShortBatchModeFlag() throws Exception {
|
||||
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install', flags: '-B')
|
||||
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
|
||||
assertEquals('maven:3.5-jdk-7', dockerExecuteRule.dockerParams.dockerImage)
|
||||
|
||||
assertEquals('mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install', shellRule.shell[0])
|
||||
}
|
||||
@ -88,7 +88,7 @@ class MavenExecuteTest extends BasePiperTest {
|
||||
@Test
|
||||
void testMavenCommandWithFalsePositiveMinusBFlag() throws Exception {
|
||||
stepRule.step.mavenExecute(script: nullScript, goals: 'clean install', flags: '-Blah')
|
||||
assertEquals('maven:3.5-jdk-7', jder.dockerParams.dockerImage)
|
||||
assertEquals('maven:3.5-jdk-7', dockerExecuteRule.dockerParams.dockerImage)
|
||||
|
||||
assertThat(shellRule.shell[0],
|
||||
allOf(containsString('-Blah'),
|
||||
|
@ -23,7 +23,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
private ExpectedException thrown = new ExpectedException()
|
||||
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
|
||||
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
|
||||
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
|
||||
private JenkinsReadYamlRule jryr = new JenkinsReadYamlRule(this).registerYaml('mta.yaml', defaultMtaYaml() )
|
||||
|
||||
@ -34,7 +34,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
.around(thrown)
|
||||
.around(loggingRule)
|
||||
.around(shellRule)
|
||||
.around(jder)
|
||||
.around(dockerExecuteRule)
|
||||
.around(stepRule)
|
||||
|
||||
@Before
|
||||
@ -193,7 +193,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
stepRule.step.mtaBuild(script: nullScript, dockerImage: 'mta-docker-image:latest')
|
||||
|
||||
assert 'mta-docker-image:latest' == jder.dockerParams.dockerImage
|
||||
assert 'mta-docker-image:latest' == dockerExecuteRule.dockerParams.dockerImage
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -201,7 +201,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
stepRule.step.mtaBuild(script: nullScript, dockerOptions: 'something')
|
||||
|
||||
assert 'something' == jder.dockerParams.dockerOptions
|
||||
assert 'something' == dockerExecuteRule.dockerParams.dockerOptions
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -19,7 +19,7 @@ import util.Rules
|
||||
|
||||
class SnykExecuteTest extends BasePiperTest {
|
||||
private ExpectedException thrown = ExpectedException.none()
|
||||
private JenkinsDockerExecuteRule jder = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
|
||||
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
|
||||
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
|
||||
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
|
||||
@ -29,7 +29,7 @@ class SnykExecuteTest extends BasePiperTest {
|
||||
.getCommonRules(this)
|
||||
.around(new JenkinsReadYamlRule(this))
|
||||
.around(thrown)
|
||||
.around(jder)
|
||||
.around(dockerExecuteRule)
|
||||
.around(shellRule)
|
||||
.around(loggingRule)
|
||||
.around(stepRule)
|
||||
@ -89,9 +89,9 @@ class SnykExecuteTest extends BasePiperTest {
|
||||
)
|
||||
|
||||
assertThat(withCredentialsParameters.credentialsId, is('myPassword'))
|
||||
assertThat(jder.dockerParams, hasEntry('dockerImage', 'node:8-stretch'))
|
||||
assertThat(jder.dockerParams.stashContent, hasItem('buildDescriptor'))
|
||||
assertThat(jder.dockerParams.stashContent, hasItem('opensourceConfiguration'))
|
||||
assertThat(dockerExecuteRule.dockerParams, hasEntry('dockerImage', 'node:8-stretch'))
|
||||
assertThat(dockerExecuteRule.dockerParams.stashContent, hasItem('buildDescriptor'))
|
||||
assertThat(dockerExecuteRule.dockerParams.stashContent, hasItem('opensourceConfiguration'))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user