From 1c40f81464ca712294333558230dc3751cc1a69b Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 14 Sep 2023 23:29:05 +0000 Subject: [PATCH] Add test cases Signed-off-by: Peter Zhu --- tests/jenkins/TestRunIntegTestScript.groovy | 62 +++++++++---------- .../jobs/RunIntegTestScript_Jenkinsfile.txt | 13 +++- .../RunIntegTestScript_LocalPath_Jenkinsfile | 6 +- ...nIntegTestScript_LocalPath_Jenkinsfile.txt | 20 +++--- ...ript_LocalPath_Switch_Non_Root_Jenkinsfile | 2 +- ..._LocalPath_Switch_Non_Root_Jenkinsfile.txt | 6 +- 6 files changed, 58 insertions(+), 51 deletions(-) diff --git a/tests/jenkins/TestRunIntegTestScript.groovy b/tests/jenkins/TestRunIntegTestScript.groovy index 1597eb994..7ede2e7da 100644 --- a/tests/jenkins/TestRunIntegTestScript.groovy +++ b/tests/jenkins/TestRunIntegTestScript.groovy @@ -22,12 +22,12 @@ class TestRunIntegTestScript extends BuildPipelineTest { @Test public void TestRunIntegTestScript() { this.registerLibTester(new RunIntegTestScriptLibTester( - 'dummy_job', - 'OpenSearch', - 'tests/data/opensearch-1.3.0-build.yml', - 'tests/data/opensearch-1.3.0-test.yml', - '', - '', + 'dummy_job', + 'OpenSearch', + 'tests/data/opensearch-1.3.0-build.yml', + 'tests/data/opensearch-1.3.0-test.yml', + '', + '', ) ) super.setUp() @@ -37,12 +37,12 @@ class TestRunIntegTestScript extends BuildPipelineTest { @Test public void TestRunIntegTestScript_OpenSearch_Dashboards() { this.registerLibTester(new RunIntegTestScriptLibTester( - 'dummy_job', - 'functionalTestDashboards', - 'tests/data/opensearch-dashboards-1.2.0-build.yml', - 'tests/data/opensearch-dashboards-1.2.0-test.yml', - '', - '', + 'dummy_job', + 'functionalTestDashboards', + 'tests/data/opensearch-dashboards-1.2.0-build.yml', + 'tests/data/opensearch-dashboards-1.2.0-test.yml', + '', + '', ) ) super.setUp() @@ -52,12 +52,12 @@ class TestRunIntegTestScript extends BuildPipelineTest { @Test public void TestRunIntegTestScript_LocalPath() { this.registerLibTester(new RunIntegTestScriptLibTester( - 'dummy_job', - 'OpenSearch', - 'tests/data/opensearch-1.3.0-build.yml', - 'tests/data/opensearch-1.3.0-test.yml', - 'tests/jenkins/artifacts/tar', - '', + 'dummy_job', + 'OpenSearch-Dashboards', + 'tests/data/opensearch-dashboards-1.2.0-build.yml', + 'tests/data/opensearch-dashboards-1.2.0-test.yml', + 'tests/jenkins/artifacts/tar', + '', ) ) super.setUp() @@ -67,12 +67,12 @@ class TestRunIntegTestScript extends BuildPipelineTest { @Test public void TestRunIntegTestScript_LocalPath_Switch_Non_Root() { this.registerLibTester(new RunIntegTestScriptLibTester( - 'distribution-build-opensearch', - 'OpenSearch', - 'tests/data/opensearch-1.3.0-build.yml', - 'tests/data/opensearch-1.3.0-test.yml', - 'tests/jenkins/artifacts/tar', - 'true', + 'dummy_job', + 'OpenSearch', + 'tests/data/opensearch-1.3.0-build.yml', + 'tests/data/opensearch-1.3.0-test.yml', + 'tests/jenkins/artifacts/tar', + 'true', ) ) super.setUp() @@ -100,28 +100,28 @@ class TestRunIntegTestScript extends BuildPipelineTest { void 'IntegTest LocalPath SwitchNonRoot=false'() { this.registerLibTester(new RunIntegTestScriptLibTester( 'dummy_job', - 'OpenSearch', - 'tests/data/opensearch-1.3.0-build.yml', - 'tests/data/opensearch-1.3.0-test.yml', + 'OpenSearch-Dashboards', + 'tests/data/opensearch-dashboards-1.2.0-build.yml', + 'tests/data/opensearch-dashboards-1.2.0-test.yml', 'tests/jenkins/artifacts/tar', - 'false' + 'false', ) ) 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-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/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar ')) + 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 ')) } @Test void 'IntegTest LocalPath SwitchNonRoot=true with JAVA_HOME'() { this.registerLibTester(new RunIntegTestScriptLibTester( - 'distribution-build-opensearch', + 'dummy_job', 'OpenSearch', 'tests/data/opensearch-1.3.0-build.yml', 'tests/data/opensearch-1.3.0-test.yml', 'tests/jenkins/artifacts/tar', - 'true' + 'true', ) ) super.setUp() diff --git a/tests/jenkins/jobs/RunIntegTestScript_Jenkinsfile.txt b/tests/jenkins/jobs/RunIntegTestScript_Jenkinsfile.txt index 56174e473..825a109b3 100644 --- a/tests/jenkins/jobs/RunIntegTestScript_Jenkinsfile.txt +++ b/tests/jenkins/jobs/RunIntegTestScript_Jenkinsfile.txt @@ -12,7 +12,14 @@ BuildManifest.getDistribution() BuildManifest.getArtifactPlatform() runIntegTestScript.echo(Start integTest on: tar x64 linux) - runIntegTestScript.echo(Possible Java Home: ) + 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: c3ff7a232d25403fa8cc14c97799c323) BuildManifest.getArtifactRootUrl(dummy_job, c3ff7a232d25403fa8cc14c97799c323) runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar) @@ -21,5 +28,5 @@ runIntegTestScript.echo(Base Path https://dummy_link/dummy_integ_test/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar) runIntegTestScript.echo(Component: OpenSearch) runIntegTestScript.echo(Switch User to Non-Root (uid=1000): false) - runIntegTestScript.echo(Run command: env PATH=$PATH ./test.sh integ-test tests/data/opensearch-1.3.0-test.yml --component OpenSearch --test-run-id 987 --paths opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar --base-path https://dummy_link/dummy_integ_test/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar ) - runIntegTestScript.sh(env PATH=$PATH ./test.sh integ-test tests/data/opensearch-1.3.0-test.yml --component OpenSearch --test-run-id 987 --paths opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar --base-path https://dummy_link/dummy_integ_test/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar ) + runIntegTestScript.echo(Run command: 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=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar --base-path https://dummy_link/dummy_integ_test/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar ) + runIntegTestScript.sh(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=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar --base-path https://dummy_link/dummy_integ_test/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar ) diff --git a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile index 36a10de2f..3d528e989 100644 --- a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile +++ b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile @@ -15,9 +15,9 @@ pipeline { script { runIntegTestScript( jobName: 'dummy_job', - componentName: 'OpenSearch', - buildManifest: 'tests/data/opensearch-1.3.0-build.yml', - testManifest: 'tests/data/opensearch-1.3.0-test.yml', + componentName: 'OpenSearch-Dashboards', + buildManifest: 'tests/data/opensearch-dashboards-1.2.0-build.yml', + testManifest: 'tests/data/opensearch-dashboards-1.2.0-test.yml', localPath: 'tests/jenkins/artifacts/tar', ) } diff --git a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile.txt b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile.txt index a751711c9..972fa002c 100644 --- a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile.txt +++ b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Jenkinsfile.txt @@ -3,23 +3,23 @@ RunIntegTestScript_LocalPath_Jenkinsfile.echo(Executing on agent [label:none]) RunIntegTestScript_LocalPath_Jenkinsfile.stage(integ-test, groovy.lang.Closure) RunIntegTestScript_LocalPath_Jenkinsfile.script(groovy.lang.Closure) - RunIntegTestScript_LocalPath_Jenkinsfile.runIntegTestScript({jobName=dummy_job, componentName=OpenSearch, buildManifest=tests/data/opensearch-1.3.0-build.yml, testManifest=tests/data/opensearch-1.3.0-test.yml, localPath=tests/jenkins/artifacts/tar}) + RunIntegTestScript_LocalPath_Jenkinsfile.runIntegTestScript({jobName=dummy_job, componentName=OpenSearch-Dashboards, buildManifest=tests/data/opensearch-dashboards-1.2.0-build.yml, testManifest=tests/data/opensearch-dashboards-1.2.0-test.yml, localPath=tests/jenkins/artifacts/tar}) runIntegTestScript.legacySCM(groovy.lang.Closure) runIntegTestScript.library({identifier=jenkins@main, retriever=null}) - runIntegTestScript.readYaml({file=tests/data/opensearch-1.3.0-build.yml}) + runIntegTestScript.readYaml({file=tests/data/opensearch-dashboards-1.2.0-build.yml}) BuildManifest.asBoolean() BuildManifest.getArtifactArchitecture() BuildManifest.getDistribution() BuildManifest.getArtifactPlatform() runIntegTestScript.echo(Start integTest on: tar x64 linux) runIntegTestScript.echo(Possible Java Home: ) - runIntegTestScript.echo(Build Id: c3ff7a232d25403fa8cc14c97799c323) - BuildManifest.getArtifactRootUrl(dummy_job, c3ff7a232d25403fa8cc14c97799c323) - runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar) + runIntegTestScript.echo(Build Id: 215) + BuildManifest.getArtifactRootUrl(dummy_job, 215) + runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64/tar) runIntegTestScript.echo(User provides localPath, use local artifacts: tests/jenkins/artifacts/tar) - runIntegTestScript.echo(Paths: opensearch=tests/jenkins/artifacts/tar) - runIntegTestScript.echo(Base Path https://dummy_link/dummy_integ_test/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar) - runIntegTestScript.echo(Component: OpenSearch) + runIntegTestScript.echo(Paths: opensearch=tests/jenkins/artifacts/tar opensearch-dashboards=tests/jenkins/artifacts/tar) + runIntegTestScript.echo(Base Path https://dummy_link/dummy_integ_test/1.2.0/215/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 ./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/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar ) - runIntegTestScript.sh(env PATH=$PATH ./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/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar ) + runIntegTestScript.echo(Run command: 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 ) + runIntegTestScript.sh(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 ) diff --git a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile index b3801a110..02579aeeb 100644 --- a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile +++ b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile @@ -14,7 +14,7 @@ pipeline { steps { script { runIntegTestScript( - jobName: 'distribution-build-opensearch', + jobName: 'dummy_job', componentName: 'OpenSearch', buildManifest: 'tests/data/opensearch-1.3.0-build.yml', testManifest: 'tests/data/opensearch-1.3.0-test.yml', diff --git a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.txt b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.txt index 89ced635b..3b633e010 100644 --- a/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.txt +++ b/tests/jenkins/jobs/RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.txt @@ -3,7 +3,7 @@ RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.echo(Executing on agent [label:none]) RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.stage(integ-test, groovy.lang.Closure) RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.script(groovy.lang.Closure) - RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.runIntegTestScript({jobName=distribution-build-opensearch, componentName=OpenSearch, buildManifest=tests/data/opensearch-1.3.0-build.yml, testManifest=tests/data/opensearch-1.3.0-test.yml, localPath=tests/jenkins/artifacts/tar, switchUserNonRoot=true}) + RunIntegTestScript_LocalPath_Switch_Non_Root_Jenkinsfile.runIntegTestScript({jobName=dummy_job, componentName=OpenSearch, buildManifest=tests/data/opensearch-1.3.0-build.yml, testManifest=tests/data/opensearch-1.3.0-test.yml, localPath=tests/jenkins/artifacts/tar, switchUserNonRoot=true}) runIntegTestScript.legacySCM(groovy.lang.Closure) runIntegTestScript.library({identifier=jenkins@main, retriever=null}) runIntegTestScript.readYaml({file=tests/data/opensearch-1.3.0-build.yml}) @@ -21,8 +21,8 @@ detectTestDockerAgent.echo(Using java version openjdk-11) runIntegTestScript.echo(Possible Java Home: JAVA_HOME=/opt/java/openjdk-11) runIntegTestScript.echo(Build Id: c3ff7a232d25403fa8cc14c97799c323) - BuildManifest.getArtifactRootUrl(distribution-build-opensearch, c3ff7a232d25403fa8cc14c97799c323) - runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar) + BuildManifest.getArtifactRootUrl(dummy_job, c3ff7a232d25403fa8cc14c97799c323) + runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar) runIntegTestScript.echo(User provides localPath, use local artifacts: tests/jenkins/artifacts/tar) runIntegTestScript.echo(Paths: opensearch=tests/jenkins/artifacts/tar) runIntegTestScript.echo(Base Path https://dummy_link/dummy_integ_test/1.3.0/c3ff7a232d25403fa8cc14c97799c323/linux/x64/tar)