Skip to content

Commit

Permalink
add ci-group arg for OSD integ tests
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Singh <[email protected]>
  • Loading branch information
rishabh6788 committed Nov 20, 2024
1 parent 42c8c5d commit 3e2eb6a
Show file tree
Hide file tree
Showing 21 changed files with 424 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jacocoTestReport {
}
}

String version = '7.3.4'
String version = '8.0.0'

task updateVersion {
doLast {
Expand Down
9 changes: 5 additions & 4 deletions tests/jenkins/TestRunIntegTestScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class TestRunIntegTestScript extends BuildPipelineTest {
)
)
super.setUp()
super.testPipeline("tests/jenkins/jobs/RunIntegTestScript_OpenSearch_Dashboards_Jenkinsfile")
runScript("tests/jenkins/jobs/RunIntegTestScript_OpenSearch_Dashboards_Jenkinsfile")
assertThat(getShellCommands('sh', 'test.sh'), hasItems('env PATH=$PATH ./test.sh integ-test manifests/tests/data/opensearch-dashboards-1.2.0-test.yml --component functionalTestDashboards --ci-group 1 --test-run-id 987 --paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.2.0/latest/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64/tar --base-path https://dummy_link/dummy_integ_test/1.2.0/215/linux/x64/tar '))
}

@Test
Expand Down Expand Up @@ -92,7 +93,7 @@ class TestRunIntegTestScript extends BuildPipelineTest {
)
super.setUp()
runScript("tests/jenkins/jobs/RunIntegTestScript_Windows_Jenkinsfile")
assertThat(getShellCommands('sh', 'test.sh'), hasItems('env PATH=$PATH ./test.sh integ-test tests/data/opensearch-2.8.0-test.yml --component OpenSearch --test-run-id 987 --paths opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/2.8.0/7923/windows/x64/zip --base-path https://dummy_link/dummy_integ_test/2.8.0/7923/windows/x64/zip '))
assertThat(getShellCommands('sh', 'test.sh'), hasItems('env PATH=$PATH ./test.sh integ-test manifests/tests/data/opensearch-2.8.0-test.yml --component OpenSearch --test-run-id 987 --paths opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/2.8.0/7923/windows/x64/zip --base-path https://dummy_link/dummy_integ_test/2.8.0/7923/windows/x64/zip '))

}

Expand All @@ -109,7 +110,7 @@ class TestRunIntegTestScript extends BuildPipelineTest {
)
super.setUp()
runScript("tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile")
assertThat(getShellCommands('sh', 'test.sh'), hasItems('env PATH=$PATH ./test.sh integ-test tests/data/opensearch-dashboards-1.2.0-test.yml --component OpenSearch-Dashboards --test-run-id 987 --paths opensearch=tests/jenkins/artifacts/tar opensearch-dashboards=tests/jenkins/artifacts/tar --base-path https://dummy_link/dummy_integ_test/1.2.0/215/linux/x64/tar '))
assertThat(getShellCommands('sh', 'test.sh'), hasItems('env PATH=$PATH ./test.sh integ-test manifests/tests/data/opensearch-dashboards-1.2.0-test.yml --component OpenSearch-Dashboards --test-run-id 987 --paths opensearch=tests/jenkins/artifacts/tar opensearch-dashboards=tests/jenkins/artifacts/tar --base-path https://dummy_link/dummy_integ_test/1.2.0/215/linux/x64/tar '))

}

Expand All @@ -126,7 +127,7 @@ class TestRunIntegTestScript extends BuildPipelineTest {
)
super.setUp()
runScript("tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile")
assertThat(getShellCommands('sh', 'test.sh'), hasItems('su `id -un 1000` -c \"env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test tests/data/opensearch-1.3.0-test.yml --component OpenSearch --test-run-id 987 --paths opensearch=tests/jenkins/artifacts/tar --base-path https://dummy_link/dummy_integ_test/1.3.0/29/linux/x64/tar \"'))
assertThat(getShellCommands('sh', 'test.sh'), hasItems('su `id -un 1000` -c \"env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch --test-run-id 987 --paths opensearch=tests/jenkins/artifacts/tar --base-path https://dummy_link/dummy_integ_test/1.3.0/29/linux/x64/tar \"'))

}

Expand Down
57 changes: 57 additions & 0 deletions tests/jenkins/TestRunIntegTestScriptForOSD.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package jenkins.tests

import org.junit.Test
import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString
import static org.hamcrest.CoreMatchers.hasItems
import static org.hamcrest.MatcherAssert.assertThat

class TestRunIntegTestScriptForOSD extends BuildPipelineTest {

@Test
public void TestRunProcessScript() {
this.registerLibTester(new RunIntegTestScriptForOSDLibTester(
'OpenSearch',
'',
'false'
)
)
super.setUp()
super.testPipeline("tests/jenkins/jobs/RunIntegTestScriptForOSD_Jenkinsfile")
runScript("tests/jenkins/jobs/RunIntegTestScriptForOSD_Jenkinsfile")
assertThat(getShellCommands('sh', 'test.sh'), hasItems('env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar '))
}

@Test
public void TestRunProcessScriptWithoutCiGroup() {
this.registerLibTester(new RunIntegTestScriptForOSDLibTester(
'OpenSearch-Dashboards',
'1',
'false'
)
)
super.setUp()
super.testPipeline("tests/jenkins/jobs/RunIntegTestScriptForOSDCiGroup_Jenkinsfile")
runScript("tests/jenkins/jobs/RunIntegTestScriptForOSDCiGroup_Jenkinsfile")
assertThat(getShellCommands('sh','test.sh'), hasItems('env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch-Dashboards --ci-group 1 --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar '))
}

def getShellCommands(methodName, searchString) {
def shCommands = helper.callStack.findAll { call ->
call.methodName == methodName
}.collect { call ->
callArgsToString(call)
}.findAll { command ->
command.contains(searchString)
}
return shCommands
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ProcessAndRunOsdIntegTestCiGroup_Jenkinsfile.run()
ProcessAndRunOsdIntegTestCiGroup_Jenkinsfile.pipeline(groovy.lang.Closure)
ProcessAndRunOsdIntegTestCiGroup_Jenkinsfile.echo(Executing on agent [label:none])
ProcessAndRunOsdIntegTestCiGroup_Jenkinsfile.stage(integ-test, groovy.lang.Closure)
ProcessAndRunOsdIntegTestCiGroup_Jenkinsfile.script(groovy.lang.Closure)
ProcessAndRunOsdIntegTestCiGroup_Jenkinsfile.processAndRunOsdIntegTest({localComponent=OpenSearch-Dashboards, ciGroup=1, switchUserNonRoot=false})
processAndRunOsdIntegTest.legacySCM(groovy.lang.Closure)
processAndRunOsdIntegTest.library({identifier=jenkins@main, retriever=null})
processAndRunOsdIntegTest.unstash(integtest-opensearch-dashboards-307)
processAndRunOsdIntegTest.echo(Not on Windows, unstash repository+artifacts)
processAndRunOsdIntegTest.sh(rm -rf test-results)
processAndRunOsdIntegTest.runIntegTestScript({jobName=dummy-integ-test, componentName=OpenSearch-Dashboards, buildManifest=tests/data/opensearch-1.3.0-build.yml, testManifest=tests/data/opensearch-1.3.0-test.yml, localPath=/home/user/x64, switchUserNonRoot=false, ciGroup=1})
runIntegTestScript.legacySCM(groovy.lang.Closure)
runIntegTestScript.library({identifier=jenkins@main, retriever=null})
runIntegTestScript.readYaml({file=tests/data/opensearch-1.3.0-build.yml})
BuildManifest.asBoolean()
BuildManifest.getArtifactArchitecture()
BuildManifest.getDistribution()
BuildManifest.getArtifactPlatform()
runIntegTestScript.echo(Start integTest on: tar x64 linux)
runIntegTestScript.detectTestDockerAgent({testManifest=tests/data/opensearch-1.3.0-test.yml})
detectTestDockerAgent.legacySCM(groovy.lang.Closure)
detectTestDockerAgent.library({identifier=jenkins@main, retriever=null})
detectTestDockerAgent.readYaml({file=tests/data/opensearch-1.3.0-test.yml})
TestManifest.asBoolean()
detectTestDockerAgent.echo(Using Docker image opensearchstaging/ci-runner:ci-runner-centos7-v1 (-e JAVA_HOME=/opt/java/openjdk-11))
detectTestDockerAgent.echo(Using java version openjdk-11)
runIntegTestScript.echo(Possible Java Home: JAVA_HOME=/opt/java/openjdk-11)
runIntegTestScript.echo(Build Id: 29)
BuildManifest.getArtifactRootUrl(dummy-integ-test, 29)
runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy-integ-test/1.3.0/29/linux/x64/tar)
runIntegTestScript.echo(User provides localPath, use local artifacts: /home/user/x64)
runIntegTestScript.echo(Paths: opensearch=/home/user/x64)
runIntegTestScript.echo(Base Path null/null/1.3.0/29/linux/x64/tar)
runIntegTestScript.echo(Component: OpenSearch-Dashboards)
runIntegTestScript.echo(Switch User to Non-Root (uid=1000): false)
runIntegTestScript.echo(Run command: env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch-Dashboards --ci-group 1 --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar )
runIntegTestScript.sh(env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch-Dashboards --ci-group 1 --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar )
38 changes: 38 additions & 0 deletions tests/jenkins/jobs/ProcessAndRunOsdIntegTest_Jenkinsfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ProcessAndRunOsdIntegTest_Jenkinsfile.run()
ProcessAndRunOsdIntegTest_Jenkinsfile.pipeline(groovy.lang.Closure)
ProcessAndRunOsdIntegTest_Jenkinsfile.echo(Executing on agent [label:none])
ProcessAndRunOsdIntegTest_Jenkinsfile.stage(integ-test, groovy.lang.Closure)
ProcessAndRunOsdIntegTest_Jenkinsfile.script(groovy.lang.Closure)
ProcessAndRunOsdIntegTest_Jenkinsfile.processAndRunOsdIntegTest({localComponent=OpenSearch, ciGroup=, switchUserNonRoot=false})
processAndRunOsdIntegTest.legacySCM(groovy.lang.Closure)
processAndRunOsdIntegTest.library({identifier=jenkins@main, retriever=null})
processAndRunOsdIntegTest.unstash(integtest-opensearch-dashboards-307)
processAndRunOsdIntegTest.echo(Not on Windows, unstash repository+artifacts)
processAndRunOsdIntegTest.sh(rm -rf test-results)
processAndRunOsdIntegTest.runIntegTestScript({jobName=dummy-integ-test, componentName=OpenSearch, buildManifest=tests/data/opensearch-1.3.0-build.yml, testManifest=tests/data/opensearch-1.3.0-test.yml, localPath=/home/user/x64, switchUserNonRoot=false, ciGroup=})
runIntegTestScript.legacySCM(groovy.lang.Closure)
runIntegTestScript.library({identifier=jenkins@main, retriever=null})
runIntegTestScript.readYaml({file=tests/data/opensearch-1.3.0-build.yml})
BuildManifest.asBoolean()
BuildManifest.getArtifactArchitecture()
BuildManifest.getDistribution()
BuildManifest.getArtifactPlatform()
runIntegTestScript.echo(Start integTest on: tar x64 linux)
runIntegTestScript.detectTestDockerAgent({testManifest=tests/data/opensearch-1.3.0-test.yml})
detectTestDockerAgent.legacySCM(groovy.lang.Closure)
detectTestDockerAgent.library({identifier=jenkins@main, retriever=null})
detectTestDockerAgent.readYaml({file=tests/data/opensearch-1.3.0-test.yml})
TestManifest.asBoolean()
detectTestDockerAgent.echo(Using Docker image opensearchstaging/ci-runner:ci-runner-centos7-v1 (-e JAVA_HOME=/opt/java/openjdk-11))
detectTestDockerAgent.echo(Using java version openjdk-11)
runIntegTestScript.echo(Possible Java Home: JAVA_HOME=/opt/java/openjdk-11)
runIntegTestScript.echo(Build Id: 29)
BuildManifest.getArtifactRootUrl(dummy-integ-test, 29)
runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy-integ-test/1.3.0/29/linux/x64/tar)
runIntegTestScript.echo(User provides localPath, use local artifacts: /home/user/x64)
runIntegTestScript.echo(Paths: opensearch=/home/user/x64)
runIntegTestScript.echo(Base Path null/null/1.3.0/29/linux/x64/tar)
runIntegTestScript.echo(Component: OpenSearch)
runIntegTestScript.echo(Switch User to Non-Root (uid=1000): false)
runIntegTestScript.echo(Run command: env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar )
runIntegTestScript.sh(env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar )
25 changes: 25 additions & 0 deletions tests/jenkins/jobs/RunIntegTestScriptForOSDCiGroup_Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

pipeline {
agent none
stages {
stage('integ-test') {
steps {
script {
runIntegTestScriptForOSD(
localComponent: 'OpenSearch-Dashboards',
ciGroup: "1",
switchUserNonRoot: 'false'
)
}
}
}
}
}
38 changes: 38 additions & 0 deletions tests/jenkins/jobs/RunIntegTestScriptForOSDCiGroup_Jenkinsfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
RunIntegTestScriptForOSDCiGroup_Jenkinsfile.run()
RunIntegTestScriptForOSDCiGroup_Jenkinsfile.pipeline(groovy.lang.Closure)
RunIntegTestScriptForOSDCiGroup_Jenkinsfile.echo(Executing on agent [label:none])
RunIntegTestScriptForOSDCiGroup_Jenkinsfile.stage(integ-test, groovy.lang.Closure)
RunIntegTestScriptForOSDCiGroup_Jenkinsfile.script(groovy.lang.Closure)
RunIntegTestScriptForOSDCiGroup_Jenkinsfile.runIntegTestScriptForOSD({localComponent=OpenSearch-Dashboards, ciGroup=1, switchUserNonRoot=false})
runIntegTestScriptForOSD.legacySCM(groovy.lang.Closure)
runIntegTestScriptForOSD.library({identifier=jenkins@main, retriever=null})
runIntegTestScriptForOSD.unstash(integtest-opensearch-dashboards-307)
runIntegTestScriptForOSD.echo(Not on Windows, unstash repository+artifacts)
runIntegTestScriptForOSD.sh(rm -rf test-results)
runIntegTestScriptForOSD.runIntegTestScript({jobName=dummy-integ-test, componentName=OpenSearch-Dashboards, buildManifest=tests/data/opensearch-1.3.0-build.yml, testManifest=tests/data/opensearch-1.3.0-test.yml, localPath=/home/user/x64, switchUserNonRoot=false, ciGroup=1})
runIntegTestScript.legacySCM(groovy.lang.Closure)
runIntegTestScript.library({identifier=jenkins@main, retriever=null})
runIntegTestScript.readYaml({file=tests/data/opensearch-1.3.0-build.yml})
BuildManifest.asBoolean()
BuildManifest.getArtifactArchitecture()
BuildManifest.getDistribution()
BuildManifest.getArtifactPlatform()
runIntegTestScript.echo(Start integTest on: tar x64 linux)
runIntegTestScript.detectTestDockerAgent({testManifest=tests/data/opensearch-1.3.0-test.yml})
detectTestDockerAgent.legacySCM(groovy.lang.Closure)
detectTestDockerAgent.library({identifier=jenkins@main, retriever=null})
detectTestDockerAgent.readYaml({file=tests/data/opensearch-1.3.0-test.yml})
TestManifest.asBoolean()
detectTestDockerAgent.echo(Using Docker image opensearchstaging/ci-runner:ci-runner-centos7-v1 (-e JAVA_HOME=/opt/java/openjdk-11))
detectTestDockerAgent.echo(Using java version openjdk-11)
runIntegTestScript.echo(Possible Java Home: JAVA_HOME=/opt/java/openjdk-11)
runIntegTestScript.echo(Build Id: 29)
BuildManifest.getArtifactRootUrl(dummy-integ-test, 29)
runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy-integ-test/1.3.0/29/linux/x64/tar)
runIntegTestScript.echo(User provides localPath, use local artifacts: /home/user/x64)
runIntegTestScript.echo(Paths: opensearch=/home/user/x64)
runIntegTestScript.echo(Base Path null/null/1.3.0/29/linux/x64/tar)
runIntegTestScript.echo(Component: OpenSearch-Dashboards)
runIntegTestScript.echo(Switch User to Non-Root (uid=1000): false)
runIntegTestScript.echo(Run command: env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch-Dashboards --ci-group 1 --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar )
runIntegTestScript.sh(env PATH=$PATH JAVA_HOME=/opt/java/openjdk-11 ./test.sh integ-test manifests/tests/data/opensearch-1.3.0-test.yml --component OpenSearch-Dashboards --ci-group 1 --test-run-id null --paths opensearch=/home/user/x64 --base-path null/null/1.3.0/29/linux/x64/tar )
25 changes: 25 additions & 0 deletions tests/jenkins/jobs/RunIntegTestScriptForOSD_Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

pipeline {
agent none
stages {
stage('integ-test') {
steps {
script {
runIntegTestScriptForOSD(
localComponent: 'OpenSearch',
ciGroup: "",
switchUserNonRoot: 'false'
)
}
}
}
}
}
Loading

0 comments on commit 3e2eb6a

Please sign in to comment.