1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-11-06 09:09:19 +02:00

[E2E Tests step] Allow Conditional check with on_k8s env variable (#3985)

* Conditional check with on_k8s env variable

* Add ON_K8S unit test

Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>
This commit is contained in:
Srinikitha Kondreddy
2022-09-06 11:23:12 +02:00
committed by GitHub
parent e610bda779
commit ac9bd28c42
2 changed files with 25 additions and 2 deletions

View File

@@ -239,7 +239,7 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
}
@Test
void parallelE2eTestOnKubernetes() {
void parallelE2eTestOnKubernetes_setWith_POD_NAME_EnvVariable() {
def appUrl = [url: "http://my-url.com", credentialId: 'testCred']
binding.variables.env.POD_NAME = "name"
@@ -259,4 +259,27 @@ class NpmExecuteEndToEndTestsTest extends BasePiperTest {
assertFalse(executedOnNode)
assertTrue(executedOnKubernetes)
}
@Test
void parallelE2eTestOnKubernetes_setWith_ON_K8S_EnvVariable() {
def appUrl = [url: "http://my-url.com", credentialId: 'testCred']
binding.variables.env.ON_K8S = "true"
nullScript.commonPipelineEnvironment.configuration = [
general: [parallelExecution: true],
stages: [
myStage:[
appUrls: [appUrl]
]]]
stepRule.step.npmExecuteEndToEndTests(
script: nullScript,
stageName: "myStage",
runScript: "ci-e2e"
)
assertTrue(executedInParallel)
assertFalse(executedOnNode)
assertTrue(executedOnKubernetes)
}
}