1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-10 10:50:11 +02:00

Set script 'ci-e2e' as default for acceptance stage (#4000)

* Set script 'ci-e2e' as default for acceptance stage

* Refactor test case

* Clean up

* Adjust parameter comment
This commit is contained in:
Srinikitha Kondreddy 2022-09-05 11:38:45 +02:00 committed by GitHub
parent c7342cfb0e
commit e610bda779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 38 deletions

View File

@ -354,6 +354,8 @@ steps:
dockerImage: 'node:lts-stretch'
npmExecuteScripts:
install: true
npmExecuteEndToEndTests:
runScript: 'ci-e2e'
whitesourceExecuteScan:
vulnerabilityReportFileName: 'piper_whitesource_vulnerability_report'
stashExcludes:

View File

@ -75,24 +75,6 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
thrown.expect(hudson.AbortException)
thrown.expectMessage('[npmExecuteEndToEndTests] The execution failed, since no appUrls are defined. Please provide appUrls as a list of maps.')
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
)
}
@Test
void noRunScript() {
def appUrl = [url: "http://my-url.com"]
nullScript.commonPipelineEnvironment.configuration = [stages: [myStage:[
appUrls: [appUrl]
]]]
thrown.expect(hudson.AbortException)
thrown.expectMessage('[npmExecuteEndToEndTests] No runScript was defined.')
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage"
@ -112,8 +94,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
}
@ -130,8 +111,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
}
@ -148,8 +128,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
}
@ -163,8 +142,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
assertFalse(executedInParallel)
@ -185,8 +163,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
assert npmExecuteScriptsRule.hasParameter('script', nullScript)
@ -207,8 +184,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
assert npmExecuteScriptsRule.hasParameter('script', nullScript)
@ -231,7 +207,6 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
script: nullScript,
stageName: "myStage",
buildDescriptorExcludeList: ["path/to/package.json"],
runScript: "ci-e2e"
)
assert npmExecuteScriptsRule.hasParameter('script', nullScript)
@ -255,8 +230,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
assertTrue(executedInParallel)
@ -278,8 +252,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
stageName: "myStage"
)
assertTrue(executedInParallel)

View File

@ -194,6 +194,5 @@ class PiperPipelineStageAcceptanceTest extends BasePiperTest {
)
assertThat(stepsCalled, hasItem('npmExecuteEndToEndTests'))
assertThat(stepParameters.npmExecuteEndToEndTests.runScript, is('ci-e2e'))
}
}

View File

@ -33,7 +33,7 @@ import static com.sap.piper.Prerequisites.checkScript
*/
'buildDescriptorExcludeList',
/**
* Script to be executed from package.json.
* Script to be executed from package.json. Defaults to `ci-e2e`.
*/
'runScript',
/**

View File

@ -131,7 +131,7 @@ void call(Map parameters = [:]) {
if (config.npmExecuteEndToEndTests) {
durationMeasure(script: script, measurementName: 'npmExecuteEndToEndTests_duration') {
npmExecuteEndToEndTests script: script, stageName: stageName, runScript: 'ci-e2e'
npmExecuteEndToEndTests script: script, stageName: stageName
}
}