diff --git a/jenkins/opensearch-dashboards/bwc-test.jenkinsfile b/jenkins/opensearch-dashboards/bwc-test.jenkinsfile new file mode 100644 index 0000000000..4aa7c94c45 --- /dev/null +++ b/jenkins/opensearch-dashboards/bwc-test.jenkinsfile @@ -0,0 +1,143 @@ +lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm)) + +pipeline { + options { + timeout(time: 3, unit: 'HOURS') + } + agent none + environment { + BUILD_MANIFEST = "build-manifest.yml" + DEFAULT_BUILD_JOB_NAME = "distribution-build-opensearch-dashboards" + } + parameters { + string( + name: 'TEST_MANIFEST', + description: 'Test manifest under the manifests folder, e.g. 2.0.0/opensearch-dashboards-2.0.0-test.yml.', + trim: true + ) + string( + name: 'BUILD_MANIFEST_URL', + description: 'The build manifest URL, e.g. https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/2.0.0/98/linux/x64/builds/opensearch-dashboards/manifest.yml.', + trim: true + ) + string( + name: 'AGENT_LABEL', + description: 'The agent label where the tests should be executed, e.g. Jenkins-Agent-al2-x64-c54xlarge-Docker-Host.', + trim: true + ) + } + stages { + stage('verify-parameters') { + agent { + node { + label AGENT_LABEL + } + } + steps { + script { + if (AGENT_LABEL == '') { + currentBuild.result = 'ABORTED' + error("BWC Tests failed to start. Missing parameter: AGENT_LABEL.") + } + if (!fileExists("manifests/${TEST_MANIFEST}")) { + currentBuild.result = 'ABORTED' + error("BWC Tests failed to start. Test manifest not found in manifests/${TEST_MANIFEST}.") + } + env.BUILD_JOB_NAME = currentBuild.upstreamBuilds ? + currentBuild.upstreamBuilds[0].fullProjectName : + env.DEFAULT_BUILD_JOB_NAME + } + } + } + stage('detect docker image + args') { + agent { + docker { + label 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' + image 'opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028' + alwaysPull true + } + } + steps { + script { + DOCKER_AGENT = detectTestDockerAgent() + } + } + } + stage('bwc-test') { + agent { + docker { + label AGENT_LABEL + image DOCKER_AGENT.image + args DOCKER_AGENT.args + alwaysPull true + } + } + steps { + script { + def buildManifestObj = downloadBuildManifest( + url: BUILD_MANIFEST_URL, + path: BUILD_MANIFEST + ) + String buildId = buildManifestObj.getArtifactBuildId() + env.BUILD_ID = buildId + echo "BUILD_MANIFEST: ${BUILD_MANIFEST}" + echo "BUILD_ID: ${BUILD_ID}" + + runBwcTestScript( + jobName: BUILD_JOB_NAME, + buildManifest: BUILD_MANIFEST, + testManifest: "manifests/${TEST_MANIFEST}", + buildId: BUILD_ID + ) + } + } + post { + always { + script { + uploadTestResults( + buildManifestFileName: BUILD_MANIFEST, + jobName: JOB_NAME, + buildNumber: BUILD_ID + ) + } + postCleanup() + } + } + } + } + + post { + success { + node(AGENT_LABEL) { + script { + def stashed = lib.jenkins.Messages.new(this).get(['bwc-test']) + publishNotification( + icon: ':white_check_mark:', + message: 'BWC Tests Successful', + extra: stashed, + credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, + ) + + postCleanup() + } + } + } + failure { + node(AGENT_LABEL) { + script { + def stashed = lib.jenkins.Messages.new(this).get(['bwc-test']) + publishNotification( + icon: ':warning:', + message: 'Failed BWC Tests', + extra: stashed, + credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, + ) + + postCleanup() + } + } + } + } +} diff --git a/jenkins/opensearch-dashboards/distribution-build.jenkinsfile b/jenkins/opensearch-dashboards/distribution-build.jenkinsfile index 5e1b550b78..e77e791549 100644 --- a/jenkins/opensearch-dashboards/distribution-build.jenkinsfile +++ b/jenkins/opensearch-dashboards/distribution-build.jenkinsfile @@ -28,6 +28,12 @@ pipeline { defaultValue: "integ-test-opensearch-dashboards", trim: true ) + string( + name: 'BWC_TEST_JOB_NAME', + description: "Name of backwards compatibility test job that will be triggered, e.g. Playground/bwc-test-opensearch-dashboards. A non-null empty value here will skip BWC tests.", + defaultValue: "bwc-test-opensearch-dashboards", + trim: true + ) booleanParam( name: 'BUILD_DOCKER', description: 'Build docker image or not.', @@ -98,6 +104,26 @@ pipeline { absoluteUrl: integTestResults.getAbsoluteUrl() ) } + + Boolean skipBwcTests = BWC_TEST_JOB_NAME == '' + echo "${skipBwcTests ? 'Skipping BWC tests' : 'Running BWC tests'}" + if (!skipBwcTests) { + def bwcTestResults = + build job: BWC_TEST_JOB_NAME, + propagate: false, + wait: true, + parameters: [ + string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), + string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), + string(name: 'AGENT_LABEL', value: AGENT_X64) + ] + + createTestResultsMessage( + testType: "BWC Tests (x64)", + status: bwcTestResults.getResult(), + absoluteUrl: bwcTestResults.getAbsoluteUrl() + ) + } } } post { @@ -175,6 +201,26 @@ pipeline { absoluteUrl: integTestResults.getAbsoluteUrl() ) } + + Boolean skipBwcTests = BWC_TEST_JOB_NAME == '' + echo "${skipBwcTests ? 'Skipping BWC tests' : 'Running BWC tests'}" + if (!skipBwcTests) { + def bwcTestResults = + build job: BWC_TEST_JOB_NAME, + propagate: false, + wait: true, + parameters: [ + string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), + string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), + string(name: 'AGENT_LABEL', value: AGENT_ARM64) + ] + + createTestResultsMessage( + testType: "BWC Tests (arm64)", + status: bwcTestResults.getResult(), + absoluteUrl: bwcTestResults.getAbsoluteUrl() + ) + } } } post { diff --git a/jenkins/opensearch-dashboards/integ-test.jenkinsfile b/jenkins/opensearch-dashboards/integ-test.jenkinsfile index 80a6cdfc43..75afc05113 100644 --- a/jenkins/opensearch-dashboards/integ-test.jenkinsfile +++ b/jenkins/opensearch-dashboards/integ-test.jenkinsfile @@ -59,7 +59,7 @@ pipeline { } steps { script { - dockerAgent = detectTestDockerAgent() + DOCKER_AGENT = detectTestDockerAgent() } } } @@ -67,8 +67,8 @@ pipeline { agent { docker { label AGENT_LABEL - image dockerAgent.image - args dockerAgent.args + image DOCKER_AGENT.image + args DOCKER_AGENT.args alwaysPull true } } @@ -116,6 +116,7 @@ pipeline { message: 'Integration Tests Successful', extra: stashed, credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, ) postCleanup() @@ -131,6 +132,7 @@ pipeline { message: 'Failed Integration Tests', extra: stashed, credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, ) postCleanup() diff --git a/jenkins/opensearch/bwc-test.jenkinsfile b/jenkins/opensearch/bwc-test.jenkinsfile new file mode 100644 index 0000000000..0b3a2034d3 --- /dev/null +++ b/jenkins/opensearch/bwc-test.jenkinsfile @@ -0,0 +1,146 @@ +lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm)) + +pipeline { + options { + timeout(time: 3, unit: 'HOURS') + } + agent none + environment { + BUILD_MANIFEST = "build-manifest.yml" + DEFAULT_BUILD_JOB_NAME = "distribution-build-opensearch" + } + tools { + maven "maven-3.8.2" + } + parameters { + string( + name: 'TEST_MANIFEST', + description: 'Test manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0-test.yml.', + trim: true + ) + string( + name: 'BUILD_MANIFEST_URL', + description: 'The build manifest URL, e.g. https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.2.2/98/linux/x64/builds/opensearch/manifest.yml.', + trim: true + ) + string( + name: 'AGENT_LABEL', + description: 'The agent label where the tests should be executed, e.g. Jenkins-Agent-al2-x64-c54xlarge-Docker-Host.', + trim: true + ) + } + stages { + stage('verify-parameters') { + agent { + node { + label AGENT_LABEL + } + } + steps { + script { + if (AGENT_LABEL == '') { + currentBuild.result = 'ABORTED' + error("BWC Tests failed to start. Missing parameter: AGENT_LABEL.") + } + if (!fileExists("manifests/${TEST_MANIFEST}")) { + currentBuild.result = 'ABORTED' + error("BWC Tests failed to start. Test manifest not found in manifests/${TEST_MANIFEST}.") + } + env.BUILD_JOB_NAME = currentBuild.upstreamBuilds ? + currentBuild.upstreamBuilds[0].fullProjectName : + env.DEFAULT_BUILD_JOB_NAME + } + } + } + stage('detect docker image + args') { + agent { + docker { + label 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' + image 'opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028' + alwaysPull true + } + } + steps { + script { + DOCKER_AGENT = detectTestDockerAgent() + } + } + } + stage('bwc-test') { + agent { + docker { + label AGENT_LABEL + image DOCKER_AGENT.image + args DOCKER_AGENT.args + alwaysPull true + } + } + steps { + script { + def buildManifestObj = downloadBuildManifest( + url: BUILD_MANIFEST_URL, + path: BUILD_MANIFEST + ) + String buildId = buildManifestObj.getArtifactBuildId() + env.BUILD_ID = buildId + echo "BUILD_MANIFEST: ${BUILD_MANIFEST}" + echo "BUILD_ID: ${BUILD_ID}" + + runBwcTestScript( + jobName: BUILD_JOB_NAME, + buildManifest: BUILD_MANIFEST, + testManifest: "manifests/${TEST_MANIFEST}", + buildId: BUILD_ID + ) + } + } + post { + always { + script { + uploadTestResults( + buildManifestFileName: BUILD_MANIFEST, + jobName: JOB_NAME, + buildNumber: BUILD_ID + ) + } + postCleanup() + } + } + } + } + + post { + success { + node(AGENT_LABEL) { + script { + def stashed = lib.jenkins.Messages.new(this).get(['bwc-test']) + publishNotification( + icon: ':white_check_mark:', + message: 'BWC Tests Successful', + extra: stashed, + credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, + ) + + postCleanup() + } + } + } + failure { + node(AGENT_LABEL) { + script { + def stashed = lib.jenkins.Messages.new(this).get(['bwc-test']) + publishNotification( + icon: ':warning:', + message: 'Failed BWC Tests', + extra: stashed, + credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, + ) + + postCleanup() + } + } + } + } +} diff --git a/jenkins/opensearch/distribution-build.jenkinsfile b/jenkins/opensearch/distribution-build.jenkinsfile index 6014b19b0c..e98f1788b5 100644 --- a/jenkins/opensearch/distribution-build.jenkinsfile +++ b/jenkins/opensearch/distribution-build.jenkinsfile @@ -23,6 +23,12 @@ pipeline { defaultValue: "integ-test", trim: true ) + string( + name: 'BWC_TEST_JOB_NAME', + description: "Name of backwards compatibility test job that will be triggered, e.g. Playground/bwc-test. A non-null empty value here will skip BWC tests.", + defaultValue: "bwc-test", + trim: true + ) booleanParam( name: 'BUILD_DOCKER', description: 'Build docker image or not.', @@ -157,7 +163,27 @@ pipeline { status: integTestResults.getResult(), absoluteUrl: integTestResults.getAbsoluteUrl() ) - } + } + + Boolean skipBwcTests = BWC_TEST_JOB_NAME == '' + echo "${skipBwcTests ? 'Skipping BWC tests' : 'Running BWC tests'}" + if (!skipBwcTests) { + def bwcTestResults = + build job: BWC_TEST_JOB_NAME, + propagate: false, + wait: true, + parameters: [ + string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), + string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), + string(name: 'AGENT_LABEL', value: AGENT_X64) + ] + + createTestResultsMessage( + testType: "BWC Tests (x64)", + status: bwcTestResults.getResult(), + absoluteUrl: bwcTestResults.getAbsoluteUrl() + ) + } } } post { @@ -206,6 +232,26 @@ pipeline { absoluteUrl: integTestResults.getAbsoluteUrl() ) } + + Boolean skipBwcTests = BWC_TEST_JOB_NAME == '' + echo "${skipBwcTests ? 'Skipping BWC tests' : 'Running BWC tests'}" + if (!skipBwcTests) { + def bwcTestResults = + build job: BWC_TEST_JOB_NAME, + propagate: false, + wait: true, + parameters: [ + string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), + string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), + string(name: 'AGENT_LABEL', value: AGENT_ARM64) + ] + + createTestResultsMessage( + testType: "BWC Tests (arm64)", + status: bwcTestResults.getResult(), + absoluteUrl: bwcTestResults.getAbsoluteUrl() + ) + } } } post { diff --git a/jenkins/opensearch/integ-test.jenkinsfile b/jenkins/opensearch/integ-test.jenkinsfile index 8ab3f9f597..1dfb33e094 100644 --- a/jenkins/opensearch/integ-test.jenkinsfile +++ b/jenkins/opensearch/integ-test.jenkinsfile @@ -1,13 +1,15 @@ lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm)) pipeline { + options { + timeout(time: 3, unit: 'HOURS') + } agent none environment { BUILD_MANIFEST = "build-manifest.yml" DEFAULT_BUILD_JOB_NAME = "distribution-build-opensearch" } tools { - jdk "JDK14" maven "maven-3.8.2" } parameters { @@ -60,7 +62,7 @@ pipeline { } steps { script { - dockerAgent = detectTestDockerAgent() + DOCKER_AGENT = detectTestDockerAgent() } } } @@ -68,8 +70,8 @@ pipeline { agent { docker { label AGENT_LABEL - image dockerAgent.image - args dockerAgent.args + image DOCKER_AGENT.image + args DOCKER_AGENT.args alwaysPull true } } @@ -117,6 +119,7 @@ pipeline { message: 'Integration Tests Successful', extra: stashed, credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, ) postCleanup() @@ -132,6 +135,7 @@ pipeline { message: 'Failed Integration Tests', extra: stashed, credentialsId: 'INTEG_TEST_WEBHOOK', + manifest: TEST_MANIFEST, ) postCleanup() diff --git a/src/test_workflow/bwc_test/bwc_test_suite.py b/src/test_workflow/bwc_test/bwc_test_suite.py index d4822b2246..293f4285e8 100644 --- a/src/test_workflow/bwc_test/bwc_test_suite.py +++ b/src/test_workflow/bwc_test/bwc_test_suite.py @@ -64,7 +64,7 @@ def execute_bwctest_sh(self, config): test_result_data = TestResultData( self.component.name, - self.test_config, + config, status, stdout, stderr, diff --git a/tests/jenkins/TestOpenSearchBwcTest.groovy b/tests/jenkins/TestOpenSearchBwcTest.groovy new file mode 100644 index 0000000000..aa16b426dd --- /dev/null +++ b/tests/jenkins/TestOpenSearchBwcTest.groovy @@ -0,0 +1,58 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + + +import jenkins.tests.BuildPipelineTest +import org.junit.Before +import org.junit.Test +import org.yaml.snakeyaml.Yaml + +class TestOpenSearchBwcTest extends BuildPipelineTest { + + @Before + void setUp() { + def jobName = "dummy_job" + def testManifest = "tests/jenkins/data/opensearch-1.3.0-test.yml" + def buildId = 717 + def buildManifest = "tests/jenkins/data/opensearch-1.3.0-build.yml" + def buildManifestUrl = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/${buildId}/linux/x64/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz" + def agentLabel = "Jenkins-Agent-al2-x64-c54xlarge-Docker-Host" + + this.registerLibTester(new DetectTestDockerAgentLibTester()) + this.registerLibTester(new DownloadBuildManifestLibTester(buildManifestUrl, buildManifest)) + this.registerLibTester(new RunBwcTestScriptLibTester(jobName, buildManifest, "manifests/${testManifest}", "${buildId}")) + this.registerLibTester(new UploadTestResultsLibTester(buildManifest, jobName, buildId)) + this.registerLibTester(new PublishNotificationLibTester( + ':white_check_mark:', + 'BWC Tests Successful', + '', + testManifest, + 'INTEG_TEST_WEBHOOK')) + super.setUp() + + // Variables + binding.setVariable('TEST_MANIFEST', testManifest) + binding.setVariable('BUILD_MANIFEST_URL', buildManifestUrl) + binding.setVariable('AGENT_LABEL', agentLabel) + binding.setVariable('BUILD_MANIFEST', buildManifest) + binding.setVariable('BUILD_ID', "${buildId}") + def env = binding.getVariable('env') + env['DOCKER_AGENT'] = [image:'opensearchstaging/ci-runner:ci-runner-centos7-v1', args:'-e JAVA_HOME=/opt/java/openjdk-11'] + + binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]] + + helper.registerAllowedMethod('fileExists', [String.class], { args -> + return true; + }) + + helper.registerAllowedMethod('findFiles', [Map.class], null) + } + + @Test + void bwcTests_runs_consistently() { + super.testPipeline('jenkins/opensearch/bwc-test.jenkinsfile', + 'tests/jenkins/jenkinsjob-regression-files/opensearch/bwc-test.jenkinsfile') + } +} diff --git a/tests/jenkins/TestOpenSearchDashboardsBwcTest.groovy b/tests/jenkins/TestOpenSearchDashboardsBwcTest.groovy new file mode 100644 index 0000000000..1654746e56 --- /dev/null +++ b/tests/jenkins/TestOpenSearchDashboardsBwcTest.groovy @@ -0,0 +1,58 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + + +import jenkins.tests.BuildPipelineTest +import org.junit.Before +import org.junit.Test +import org.yaml.snakeyaml.Yaml + +class TestOpenSearchDashboardsBwcTest extends BuildPipelineTest { + + @Before + void setUp() { + def jobName = "dummy_job" + def testManifest = "tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml" + def buildId = 215 + def buildManifest = "tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml" + def buildManifestUrl = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.2.0/${buildId}/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-1.2.0-linux-x64.tar.gz" + def agentLabel = "Jenkins-Agent-al2-x64-c54xlarge-Docker-Host" + + this.registerLibTester(new DetectTestDockerAgentLibTester()) + this.registerLibTester(new DownloadBuildManifestLibTester(buildManifestUrl, buildManifest)) + this.registerLibTester(new RunBwcTestScriptLibTester(jobName, buildManifest, "manifests/${testManifest}", "${buildId}")) + this.registerLibTester(new UploadTestResultsLibTester(buildManifest, jobName, buildId)) + this.registerLibTester(new PublishNotificationLibTester( + ':white_check_mark:', + 'BWC Tests Successful', + '', + testManifest, + 'INTEG_TEST_WEBHOOK')) + super.setUp() + + // Variables + binding.setVariable('TEST_MANIFEST', testManifest) + binding.setVariable('BUILD_MANIFEST_URL', buildManifestUrl) + binding.setVariable('AGENT_LABEL', agentLabel) + binding.setVariable('BUILD_MANIFEST', buildManifest) + binding.setVariable('BUILD_ID', "${buildId}") + def env = binding.getVariable('env') + env['DOCKER_AGENT'] = [image:'opensearchstaging/ci-runner:ci-runner-centos7-v1', args:'-e JAVA_HOME=/opt/java/openjdk-11'] + + binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]] + + helper.registerAllowedMethod('fileExists', [String.class], { args -> + return true; + }) + + helper.registerAllowedMethod('findFiles', [Map.class], null) + } + + @Test + void bwcTests_runs_consistently() { + super.testPipeline('jenkins/opensearch-dashboards/bwc-test.jenkinsfile', + 'tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/bwc-test.jenkinsfile') + } +} diff --git a/tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy b/tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy new file mode 100644 index 0000000000..d703355c32 --- /dev/null +++ b/tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy @@ -0,0 +1,58 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + + +import jenkins.tests.BuildPipelineTest +import org.junit.Before +import org.junit.Test +import org.yaml.snakeyaml.Yaml + +class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest { + + @Before + void setUp() { + def jobName = "dummy_job" + def testManifest = "tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml" + def buildId = 215 + def buildManifest = "tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml" + def buildManifestUrl = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.2.0/${buildId}/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-1.2.0-linux-x64.tar.gz" + def agentLabel = "Jenkins-Agent-al2-x64-c54xlarge-Docker-Host" + + this.registerLibTester(new DetectTestDockerAgentLibTester()) + this.registerLibTester(new DownloadBuildManifestLibTester(buildManifestUrl, buildManifest)) + this.registerLibTester(new RunIntegTestScriptLibTester(jobName, buildManifest, "manifests/${testManifest}", "${buildId}")) + this.registerLibTester(new UploadTestResultsLibTester(buildManifest, jobName, buildId)) + this.registerLibTester(new PublishNotificationLibTester( + ':white_check_mark:', + 'Integration Tests Successful', + '', + testManifest, + 'INTEG_TEST_WEBHOOK')) + super.setUp() + + // Variables + binding.setVariable('TEST_MANIFEST', testManifest) + binding.setVariable('BUILD_MANIFEST_URL', buildManifestUrl) + binding.setVariable('AGENT_LABEL', agentLabel) + binding.setVariable('BUILD_MANIFEST', buildManifest) + binding.setVariable('BUILD_ID', "${buildId}") + def env = binding.getVariable('env') + env['DOCKER_AGENT'] = [image:'opensearchstaging/ci-runner:ci-runner-centos7-v1', args:'-e JAVA_HOME=/opt/java/openjdk-11'] + + binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]] + + helper.registerAllowedMethod('fileExists', [String.class], { args -> + return true; + }) + + helper.registerAllowedMethod('findFiles', [Map.class], null) + } + + @Test + void integTests_runs_consistently() { + super.testPipeline('jenkins/opensearch-dashboards/integ-test.jenkinsfile', + 'tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/integ-test.jenkinsfile') + } +} diff --git a/tests/jenkins/TestOpenSearchIntegTest.groovy b/tests/jenkins/TestOpenSearchIntegTest.groovy new file mode 100644 index 0000000000..10816b0fda --- /dev/null +++ b/tests/jenkins/TestOpenSearchIntegTest.groovy @@ -0,0 +1,58 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + + +import jenkins.tests.BuildPipelineTest +import org.junit.Before +import org.junit.Test +import org.yaml.snakeyaml.Yaml + +class TestOpenSearchIntegTest extends BuildPipelineTest { + + @Before + void setUp() { + def jobName = "dummy_job" + def testManifest = "tests/jenkins/data/opensearch-1.3.0-test.yml" + def buildId = 717 + def buildManifest = "tests/jenkins/data/opensearch-1.3.0-build.yml" + def buildManifestUrl = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/${buildId}/linux/x64/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz" + def agentLabel = "Jenkins-Agent-al2-x64-c54xlarge-Docker-Host" + + this.registerLibTester(new DetectTestDockerAgentLibTester()) + this.registerLibTester(new DownloadBuildManifestLibTester(buildManifestUrl, buildManifest)) + this.registerLibTester(new RunIntegTestScriptLibTester(jobName, buildManifest, "manifests/${testManifest}", "${buildId}")) + this.registerLibTester(new UploadTestResultsLibTester(buildManifest, jobName, buildId)) + this.registerLibTester(new PublishNotificationLibTester( + ':white_check_mark:', + 'Integration Tests Successful', + '', + testManifest, + 'INTEG_TEST_WEBHOOK')) + super.setUp() + + // Variables + binding.setVariable('TEST_MANIFEST', testManifest) + binding.setVariable('BUILD_MANIFEST_URL', buildManifestUrl) + binding.setVariable('AGENT_LABEL', agentLabel) + binding.setVariable('BUILD_MANIFEST', buildManifest) + binding.setVariable('BUILD_ID', "${buildId}") + def env = binding.getVariable('env') + env['DOCKER_AGENT'] = [image:'opensearchstaging/ci-runner:ci-runner-centos7-v1', args:'-e JAVA_HOME=/opt/java/openjdk-11'] + + binding.getVariable('currentBuild').upstreamBuilds = [[fullProjectName: jobName]] + + helper.registerAllowedMethod('fileExists', [String.class], { args -> + return true; + }) + + helper.registerAllowedMethod('findFiles', [Map.class], null) + } + + @Test + void integTests_runs_consistently() { + super.testPipeline('jenkins/opensearch/integ-test.jenkinsfile', + 'tests/jenkins/jenkinsjob-regression-files/opensearch/integ-test.jenkinsfile') + } +} diff --git a/tests/jenkins/TestRunBwcTestScript.groovy b/tests/jenkins/TestRunBwcTestScript.groovy new file mode 100644 index 0000000000..c9f94ade89 --- /dev/null +++ b/tests/jenkins/TestRunBwcTestScript.groovy @@ -0,0 +1,41 @@ +/* + * 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. + */ + +import jenkins.tests.BuildPipelineTest +import org.junit.Before +import org.junit.Test + + +class TestRunBwcTestScript extends BuildPipelineTest { + + @Test + public void TestRunBwcTestScript() { + this.registerLibTester(new RunBwcTestScriptLibTester( + 'dummy_job', + 'tests/jenkins/data/opensearch-1.3.0-build.yml', + 'tests/jenkins/data/opensearch-1.3.0-test.yml', + '717' + ) + ) + + super.testPipeline("tests/jenkins/jobs/RunBwcTestScript_Jenkinsfile") + } + + @Test + public void TestRunBwcTestScript_OpenSearch_Dashboards() { + this.registerLibTester(new RunBwcTestScriptLibTester( + 'dummy_job', + 'tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml', + 'tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml', + '215' + ) + ) + + super.testPipeline("tests/jenkins/jobs/RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile") + } +} diff --git a/tests/jenkins/TestRunIntegTestScript.groovy b/tests/jenkins/TestRunIntegTestScript.groovy index cf8ee09bb7..b441cc40bb 100644 --- a/tests/jenkins/TestRunIntegTestScript.groovy +++ b/tests/jenkins/TestRunIntegTestScript.groovy @@ -27,7 +27,7 @@ class TestRunIntegTestScript extends BuildPipelineTest { } @Test - public void TestRunIntegTestScript_OpenSearch_Dasbhoards() { + public void TestRunIntegTestScript_OpenSearch_Dashboards() { this.registerLibTester(new RunIntegTestScriptLibTester( 'dummy_job', 'tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml', diff --git a/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml b/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml index fd08a7471f..c26a0c3c09 100644 --- a/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml +++ b/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml @@ -7,3 +7,8 @@ components: test-configs: - with-security - without-security + - name: queryWorkbenchDashboards + bwc-test: + test-configs: + - with-security + - without-security diff --git a/tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/bwc-test.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/bwc-test.jenkinsfile.txt new file mode 100644 index 0000000000..79382ec2e1 --- /dev/null +++ b/tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/bwc-test.jenkinsfile.txt @@ -0,0 +1,74 @@ + bwc-test.run() + bwc-test.legacySCM(groovy.lang.Closure) + bwc-test.library({identifier=jenkins@20211118, retriever=null}) + bwc-test.pipeline(groovy.lang.Closure) + bwc-test.timeout({time=3, unit=HOURS}) + bwc-test.echo(Executing on agent [label:none]) + bwc-test.stage(verify-parameters, groovy.lang.Closure) + bwc-test.echo(Executing on agent [label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]) + bwc-test.script(groovy.lang.Closure) + bwc-test.fileExists(manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml) + bwc-test.stage(detect docker image + args, groovy.lang.Closure) + bwc-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028, reuseNode:false, stages:[:], args:, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + bwc-test.script(groovy.lang.Closure) + bwc-test.detectTestDockerAgent() + detectTestDockerAgent.legacySCM(groovy.lang.Closure) + detectTestDockerAgent.library({identifier=jenkins@20211123, retriever=null}) + detectTestDockerAgent.readYaml({file=manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml}) + TestManifest.asBoolean() + detectTestDockerAgent.echo(Using Docker image opensearchstaging/ci-runner:ci-runner-centos7-v1 (null)) + bwc-test.stage(bwc-test, groovy.lang.Closure) + bwc-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:ci-runner-centos7-v1, reuseNode:false, stages:[:], args:-e JAVA_HOME=/opt/java/openjdk-11, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + bwc-test.script(groovy.lang.Closure) + bwc-test.downloadBuildManifest({url=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.2.0/215/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-1.2.0-linux-x64.tar.gz, path=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + downloadBuildManifest.legacySCM(groovy.lang.Closure) + downloadBuildManifest.library({identifier=jenkins@20211123, retriever=null}) + downloadBuildManifest.sh(curl https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.2.0/215/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-1.2.0-linux-x64.tar.gz --output tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml) + downloadBuildManifest.readYaml({file=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactBuildId() + bwc-test.echo(BUILD_MANIFEST: tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml) + bwc-test.echo(BUILD_ID: 215) + bwc-test.runBwcTestScript({jobName=dummy_job, buildManifest=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml, testManifest=manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml, buildId=215}) + runBwcTestScript.legacySCM(groovy.lang.Closure) + runBwcTestScript.library({identifier=jenkins@20211123, retriever=null}) + runBwcTestScript.readYaml({file=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRootUrl(dummy_job, 215) + runBwcTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + runBwcTestScript.echo(Paths: opensearch-dashboards=https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + runBwcTestScript.sh(./test.sh bwc-test manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml --paths opensearch-dashboards=https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + bwc-test.script(groovy.lang.Closure) + bwc-test.uploadTestResults({buildManifestFileName=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml, jobName=dummy_job, buildNumber=215}) + uploadTestResults.legacySCM(groovy.lang.Closure) + uploadTestResults.library({identifier=jenkins@20211123, retriever=null}) + uploadTestResults.readYaml({file=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRoot(dummy_job, 215) + uploadTestResults.echo(Uploading to s3://DUMMY_ARTIFACT_BUCKET_NAME/dummy_job/1.2.0/215/linux/x64) + uploadTestResults.withAWS({role=opensearch-test, roleAccount=DUMMY_AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) + uploadTestResults.s3Upload({file=test-results, bucket=DUMMY_ARTIFACT_BUCKET_NAME, path=dummy_job/1.2.0/215/linux/x64/test-results}) + BuildManifest.getArtifactRootUrl(DUMMY_PUBLIC_ARTIFACT_URL, dummy_job, 215) + Messages.asBoolean() + Messages.add(DUMMY_STAGE_NAME, DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.2.0/215/linux/x64/test-results/) + uploadTestResults.writeFile({file=messages/DUMMY_STAGE_NAME.msg, text=DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.2.0/215/linux/x64/test-results/}) + uploadTestResults.stash({includes=messages/*, name=messages-DUMMY_STAGE_NAME}) + bwc-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) + bwc-test.node(Jenkins-Agent-al2-x64-c54xlarge-Docker-Host, groovy.lang.Closure) + bwc-test.script(groovy.lang.Closure) + Messages.asBoolean() + Messages.get([bwc-test]) + bwc-test.unstash({name=messages-bwc-test}) + bwc-test.findFiles({excludes=, glob=messages/*}) + bwc-test.dir(messages, groovy.lang.Closure) + bwc-test.deleteDir() + bwc-test.publishNotification({icon=:white_check_mark:, message=BWC Tests Successful, extra=, credentialsId=INTEG_TEST_WEBHOOK, manifest=tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml}) + publishNotification.string({credentialsId=INTEG_TEST_WEBHOOK, variable=WEBHOOK_URL}) + publishNotification.withCredentials([WEBHOOK_URL], groovy.lang.Closure) + publishNotification.sh(curl -XPOST --header "Content-Type: application/json" --data '{"result_text":":white_check_mark: dummy_job [123] BWC Tests Successful +Build: htth://BUILD_URL_dummy.com +tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml +"}' "WEBHOOK_URL") + bwc-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) diff --git a/tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/integ-test.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/integ-test.jenkinsfile.txt new file mode 100644 index 0000000000..3d24e03de7 --- /dev/null +++ b/tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/integ-test.jenkinsfile.txt @@ -0,0 +1,74 @@ + integ-test.run() + integ-test.legacySCM(groovy.lang.Closure) + integ-test.library({identifier=jenkins@20211118, retriever=null}) + integ-test.pipeline(groovy.lang.Closure) + integ-test.timeout({time=3, unit=HOURS}) + integ-test.echo(Executing on agent [label:none]) + integ-test.stage(verify-parameters, groovy.lang.Closure) + integ-test.echo(Executing on agent [label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]) + integ-test.script(groovy.lang.Closure) + integ-test.fileExists(manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml) + integ-test.stage(detect docker image + args, groovy.lang.Closure) + integ-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028, reuseNode:false, stages:[:], args:, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + integ-test.script(groovy.lang.Closure) + integ-test.detectTestDockerAgent() + detectTestDockerAgent.legacySCM(groovy.lang.Closure) + detectTestDockerAgent.library({identifier=jenkins@20211123, retriever=null}) + detectTestDockerAgent.readYaml({file=manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml}) + TestManifest.asBoolean() + detectTestDockerAgent.echo(Using Docker image opensearchstaging/ci-runner:ci-runner-centos7-v1 (null)) + integ-test.stage(integ-test, groovy.lang.Closure) + integ-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:ci-runner-centos7-v1, reuseNode:false, stages:[:], args:-e JAVA_HOME=/opt/java/openjdk-11, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + integ-test.script(groovy.lang.Closure) + integ-test.downloadBuildManifest({url=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.2.0/215/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-1.2.0-linux-x64.tar.gz, path=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + downloadBuildManifest.legacySCM(groovy.lang.Closure) + downloadBuildManifest.library({identifier=jenkins@20211123, retriever=null}) + downloadBuildManifest.sh(curl https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1.2.0/215/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-1.2.0-linux-x64.tar.gz --output tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml) + downloadBuildManifest.readYaml({file=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactBuildId() + integ-test.echo(BUILD_MANIFEST: tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml) + integ-test.echo(BUILD_ID: 215) + integ-test.runIntegTestScript({jobName=dummy_job, buildManifest=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml, testManifest=manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml, buildId=215}) + runIntegTestScript.legacySCM(groovy.lang.Closure) + runIntegTestScript.library({identifier=jenkins@20211123, retriever=null}) + runIntegTestScript.readYaml({file=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRootUrl(dummy_job, 215) + runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + runIntegTestScript.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.2.0/latest/linux/x64 opensearch-dashboards=https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + runIntegTestScript.sh(./test.sh integ-test manifests/tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml --paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.2.0/latest/linux/x64 opensearch-dashboards=https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + integ-test.script(groovy.lang.Closure) + integ-test.uploadTestResults({buildManifestFileName=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml, jobName=dummy_job, buildNumber=215}) + uploadTestResults.legacySCM(groovy.lang.Closure) + uploadTestResults.library({identifier=jenkins@20211123, retriever=null}) + uploadTestResults.readYaml({file=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRoot(dummy_job, 215) + uploadTestResults.echo(Uploading to s3://DUMMY_ARTIFACT_BUCKET_NAME/dummy_job/1.2.0/215/linux/x64) + uploadTestResults.withAWS({role=opensearch-test, roleAccount=DUMMY_AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) + uploadTestResults.s3Upload({file=test-results, bucket=DUMMY_ARTIFACT_BUCKET_NAME, path=dummy_job/1.2.0/215/linux/x64/test-results}) + BuildManifest.getArtifactRootUrl(DUMMY_PUBLIC_ARTIFACT_URL, dummy_job, 215) + Messages.asBoolean() + Messages.add(DUMMY_STAGE_NAME, DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.2.0/215/linux/x64/test-results/) + uploadTestResults.writeFile({file=messages/DUMMY_STAGE_NAME.msg, text=DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.2.0/215/linux/x64/test-results/}) + uploadTestResults.stash({includes=messages/*, name=messages-DUMMY_STAGE_NAME}) + integ-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) + integ-test.node(Jenkins-Agent-al2-x64-c54xlarge-Docker-Host, groovy.lang.Closure) + integ-test.script(groovy.lang.Closure) + Messages.asBoolean() + Messages.get([integ-test]) + integ-test.unstash({name=messages-integ-test}) + integ-test.findFiles({excludes=, glob=messages/*}) + integ-test.dir(messages, groovy.lang.Closure) + integ-test.deleteDir() + integ-test.publishNotification({icon=:white_check_mark:, message=Integration Tests Successful, extra=, credentialsId=INTEG_TEST_WEBHOOK, manifest=tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml}) + publishNotification.string({credentialsId=INTEG_TEST_WEBHOOK, variable=WEBHOOK_URL}) + publishNotification.withCredentials([WEBHOOK_URL], groovy.lang.Closure) + publishNotification.sh(curl -XPOST --header "Content-Type: application/json" --data '{"result_text":":white_check_mark: dummy_job [123] Integration Tests Successful +Build: htth://BUILD_URL_dummy.com +tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml +"}' "WEBHOOK_URL") + integ-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) diff --git a/tests/jenkins/jenkinsjob-regression-files/opensearch/bwc-test.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/opensearch/bwc-test.jenkinsfile.txt new file mode 100644 index 0000000000..5323e8bf4f --- /dev/null +++ b/tests/jenkins/jenkinsjob-regression-files/opensearch/bwc-test.jenkinsfile.txt @@ -0,0 +1,74 @@ + bwc-test.run() + bwc-test.legacySCM(groovy.lang.Closure) + bwc-test.library({identifier=jenkins@20211118, retriever=null}) + bwc-test.pipeline(groovy.lang.Closure) + bwc-test.timeout({time=3, unit=HOURS}) + bwc-test.echo(Executing on agent [label:none]) + bwc-test.stage(verify-parameters, groovy.lang.Closure) + bwc-test.echo(Executing on agent [label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]) + bwc-test.script(groovy.lang.Closure) + bwc-test.fileExists(manifests/tests/jenkins/data/opensearch-1.3.0-test.yml) + bwc-test.stage(detect docker image + args, groovy.lang.Closure) + bwc-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028, reuseNode:false, stages:[:], args:, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + bwc-test.script(groovy.lang.Closure) + bwc-test.detectTestDockerAgent() + detectTestDockerAgent.legacySCM(groovy.lang.Closure) + detectTestDockerAgent.library({identifier=jenkins@20211123, retriever=null}) + detectTestDockerAgent.readYaml({file=manifests/tests/jenkins/data/opensearch-1.3.0-test.yml}) + TestManifest.asBoolean() + detectTestDockerAgent.echo(Using Docker image opensearchstaging/ci-runner:ci-runner-centos7-v1 (null)) + bwc-test.stage(bwc-test, groovy.lang.Closure) + bwc-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:ci-runner-centos7-v1, reuseNode:false, stages:[:], args:-e JAVA_HOME=/opt/java/openjdk-11, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + bwc-test.script(groovy.lang.Closure) + bwc-test.downloadBuildManifest({url=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/717/linux/x64/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz, path=tests/jenkins/data/opensearch-1.3.0-build.yml}) + downloadBuildManifest.legacySCM(groovy.lang.Closure) + downloadBuildManifest.library({identifier=jenkins@20211123, retriever=null}) + downloadBuildManifest.sh(curl https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/717/linux/x64/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz --output tests/jenkins/data/opensearch-1.3.0-build.yml) + downloadBuildManifest.readYaml({file=tests/jenkins/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactBuildId() + bwc-test.echo(BUILD_MANIFEST: tests/jenkins/data/opensearch-1.3.0-build.yml) + bwc-test.echo(BUILD_ID: 717) + bwc-test.runBwcTestScript({jobName=dummy_job, buildManifest=tests/jenkins/data/opensearch-1.3.0-build.yml, testManifest=manifests/tests/jenkins/data/opensearch-1.3.0-test.yml, buildId=717}) + runBwcTestScript.legacySCM(groovy.lang.Closure) + runBwcTestScript.library({identifier=jenkins@20211123, retriever=null}) + runBwcTestScript.readYaml({file=tests/jenkins/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRootUrl(dummy_job, 717) + runBwcTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + runBwcTestScript.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + runBwcTestScript.sh(./test.sh bwc-test manifests/tests/jenkins/data/opensearch-1.3.0-test.yml --paths opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + bwc-test.script(groovy.lang.Closure) + bwc-test.uploadTestResults({buildManifestFileName=tests/jenkins/data/opensearch-1.3.0-build.yml, jobName=dummy_job, buildNumber=717}) + uploadTestResults.legacySCM(groovy.lang.Closure) + uploadTestResults.library({identifier=jenkins@20211123, retriever=null}) + uploadTestResults.readYaml({file=tests/jenkins/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRoot(dummy_job, 717) + uploadTestResults.echo(Uploading to s3://DUMMY_ARTIFACT_BUCKET_NAME/dummy_job/1.3.0/717/linux/x64) + uploadTestResults.withAWS({role=opensearch-test, roleAccount=DUMMY_AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) + uploadTestResults.s3Upload({file=test-results, bucket=DUMMY_ARTIFACT_BUCKET_NAME, path=dummy_job/1.3.0/717/linux/x64/test-results}) + BuildManifest.getArtifactRootUrl(DUMMY_PUBLIC_ARTIFACT_URL, dummy_job, 717) + Messages.asBoolean() + Messages.add(DUMMY_STAGE_NAME, DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.3.0/717/linux/x64/test-results/) + uploadTestResults.writeFile({file=messages/DUMMY_STAGE_NAME.msg, text=DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.3.0/717/linux/x64/test-results/}) + uploadTestResults.stash({includes=messages/*, name=messages-DUMMY_STAGE_NAME}) + bwc-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) + bwc-test.node(Jenkins-Agent-al2-x64-c54xlarge-Docker-Host, groovy.lang.Closure) + bwc-test.script(groovy.lang.Closure) + Messages.asBoolean() + Messages.get([bwc-test]) + bwc-test.unstash({name=messages-bwc-test}) + bwc-test.findFiles({excludes=, glob=messages/*}) + bwc-test.dir(messages, groovy.lang.Closure) + bwc-test.deleteDir() + bwc-test.publishNotification({icon=:white_check_mark:, message=BWC Tests Successful, extra=, credentialsId=INTEG_TEST_WEBHOOK, manifest=tests/jenkins/data/opensearch-1.3.0-test.yml}) + publishNotification.string({credentialsId=INTEG_TEST_WEBHOOK, variable=WEBHOOK_URL}) + publishNotification.withCredentials([WEBHOOK_URL], groovy.lang.Closure) + publishNotification.sh(curl -XPOST --header "Content-Type: application/json" --data '{"result_text":":white_check_mark: dummy_job [123] BWC Tests Successful +Build: htth://BUILD_URL_dummy.com +tests/jenkins/data/opensearch-1.3.0-test.yml +"}' "WEBHOOK_URL") + bwc-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) diff --git a/tests/jenkins/jenkinsjob-regression-files/opensearch/integ-test.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/opensearch/integ-test.jenkinsfile.txt new file mode 100644 index 0000000000..4e78b0f62e --- /dev/null +++ b/tests/jenkins/jenkinsjob-regression-files/opensearch/integ-test.jenkinsfile.txt @@ -0,0 +1,74 @@ + integ-test.run() + integ-test.legacySCM(groovy.lang.Closure) + integ-test.library({identifier=jenkins@20211118, retriever=null}) + integ-test.pipeline(groovy.lang.Closure) + integ-test.timeout({time=3, unit=HOURS}) + integ-test.echo(Executing on agent [label:none]) + integ-test.stage(verify-parameters, groovy.lang.Closure) + integ-test.echo(Executing on agent [label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]) + integ-test.script(groovy.lang.Closure) + integ-test.fileExists(manifests/tests/jenkins/data/opensearch-1.3.0-test.yml) + integ-test.stage(detect docker image + args, groovy.lang.Closure) + integ-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028, reuseNode:false, stages:[:], args:, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + integ-test.script(groovy.lang.Closure) + integ-test.detectTestDockerAgent() + detectTestDockerAgent.legacySCM(groovy.lang.Closure) + detectTestDockerAgent.library({identifier=jenkins@20211123, retriever=null}) + detectTestDockerAgent.readYaml({file=manifests/tests/jenkins/data/opensearch-1.3.0-test.yml}) + TestManifest.asBoolean() + detectTestDockerAgent.echo(Using Docker image opensearchstaging/ci-runner:ci-runner-centos7-v1 (null)) + integ-test.stage(integ-test, groovy.lang.Closure) + integ-test.echo(Executing on agent [docker:[image:opensearchstaging/ci-runner:ci-runner-centos7-v1, reuseNode:false, stages:[:], args:-e JAVA_HOME=/opt/java/openjdk-11, alwaysPull:true, containerPerStageRoot:false, label:Jenkins-Agent-al2-x64-c54xlarge-Docker-Host]]) + integ-test.script(groovy.lang.Closure) + integ-test.downloadBuildManifest({url=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/717/linux/x64/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz, path=tests/jenkins/data/opensearch-1.3.0-build.yml}) + downloadBuildManifest.legacySCM(groovy.lang.Closure) + downloadBuildManifest.library({identifier=jenkins@20211123, retriever=null}) + downloadBuildManifest.sh(curl https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/717/linux/x64/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz --output tests/jenkins/data/opensearch-1.3.0-build.yml) + downloadBuildManifest.readYaml({file=tests/jenkins/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactBuildId() + integ-test.echo(BUILD_MANIFEST: tests/jenkins/data/opensearch-1.3.0-build.yml) + integ-test.echo(BUILD_ID: 717) + integ-test.runIntegTestScript({jobName=dummy_job, buildManifest=tests/jenkins/data/opensearch-1.3.0-build.yml, testManifest=manifests/tests/jenkins/data/opensearch-1.3.0-test.yml, buildId=717}) + runIntegTestScript.legacySCM(groovy.lang.Closure) + runIntegTestScript.library({identifier=jenkins@20211123, retriever=null}) + runIntegTestScript.readYaml({file=tests/jenkins/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRootUrl(dummy_job, 717) + runIntegTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + runIntegTestScript.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + runIntegTestScript.sh(./test.sh integ-test manifests/tests/jenkins/data/opensearch-1.3.0-test.yml --paths opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + integ-test.script(groovy.lang.Closure) + integ-test.uploadTestResults({buildManifestFileName=tests/jenkins/data/opensearch-1.3.0-build.yml, jobName=dummy_job, buildNumber=717}) + uploadTestResults.legacySCM(groovy.lang.Closure) + uploadTestResults.library({identifier=jenkins@20211123, retriever=null}) + uploadTestResults.readYaml({file=tests/jenkins/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRoot(dummy_job, 717) + uploadTestResults.echo(Uploading to s3://DUMMY_ARTIFACT_BUCKET_NAME/dummy_job/1.3.0/717/linux/x64) + uploadTestResults.withAWS({role=opensearch-test, roleAccount=DUMMY_AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) + uploadTestResults.s3Upload({file=test-results, bucket=DUMMY_ARTIFACT_BUCKET_NAME, path=dummy_job/1.3.0/717/linux/x64/test-results}) + BuildManifest.getArtifactRootUrl(DUMMY_PUBLIC_ARTIFACT_URL, dummy_job, 717) + Messages.asBoolean() + Messages.add(DUMMY_STAGE_NAME, DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.3.0/717/linux/x64/test-results/) + uploadTestResults.writeFile({file=messages/DUMMY_STAGE_NAME.msg, text=DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/1.3.0/717/linux/x64/test-results/}) + uploadTestResults.stash({includes=messages/*, name=messages-DUMMY_STAGE_NAME}) + integ-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) + integ-test.node(Jenkins-Agent-al2-x64-c54xlarge-Docker-Host, groovy.lang.Closure) + integ-test.script(groovy.lang.Closure) + Messages.asBoolean() + Messages.get([integ-test]) + integ-test.unstash({name=messages-integ-test}) + integ-test.findFiles({excludes=, glob=messages/*}) + integ-test.dir(messages, groovy.lang.Closure) + integ-test.deleteDir() + integ-test.publishNotification({icon=:white_check_mark:, message=Integration Tests Successful, extra=, credentialsId=INTEG_TEST_WEBHOOK, manifest=tests/jenkins/data/opensearch-1.3.0-test.yml}) + publishNotification.string({credentialsId=INTEG_TEST_WEBHOOK, variable=WEBHOOK_URL}) + publishNotification.withCredentials([WEBHOOK_URL], groovy.lang.Closure) + publishNotification.sh(curl -XPOST --header "Content-Type: application/json" --data '{"result_text":":white_check_mark: dummy_job [123] Integration Tests Successful +Build: htth://BUILD_URL_dummy.com +tests/jenkins/data/opensearch-1.3.0-test.yml +"}' "WEBHOOK_URL") + integ-test.postCleanup() + postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) diff --git a/tests/jenkins/jobs/RunBwcTestScript_Jenkinsfile b/tests/jenkins/jobs/RunBwcTestScript_Jenkinsfile new file mode 100644 index 0000000000..247819aaef --- /dev/null +++ b/tests/jenkins/jobs/RunBwcTestScript_Jenkinsfile @@ -0,0 +1,25 @@ +/* + * 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('bwc-test') { + steps { + script { + runBwcTestScript( + jobName: 'dummy_job', + buildManifest: 'tests/jenkins/data/opensearch-1.3.0-build.yml', + testManifest: 'tests/jenkins/data/opensearch-1.3.0-test.yml', + buildId: '717' + ) + } + } + } + } +} \ No newline at end of file diff --git a/tests/jenkins/jobs/RunBwcTestScript_Jenkinsfile.txt b/tests/jenkins/jobs/RunBwcTestScript_Jenkinsfile.txt new file mode 100644 index 0000000000..69b681d51c --- /dev/null +++ b/tests/jenkins/jobs/RunBwcTestScript_Jenkinsfile.txt @@ -0,0 +1,14 @@ + RunBwcTestScript_Jenkinsfile.run() + RunBwcTestScript_Jenkinsfile.pipeline(groovy.lang.Closure) + RunBwcTestScript_Jenkinsfile.echo(Executing on agent [label:none]) + RunBwcTestScript_Jenkinsfile.stage(bwc-test, groovy.lang.Closure) + RunBwcTestScript_Jenkinsfile.script(groovy.lang.Closure) + RunBwcTestScript_Jenkinsfile.runBwcTestScript({jobName=dummy_job, buildManifest=tests/jenkins/data/opensearch-1.3.0-build.yml, testManifest=tests/jenkins/data/opensearch-1.3.0-test.yml, buildId=717}) + runBwcTestScript.legacySCM(groovy.lang.Closure) + runBwcTestScript.library({identifier=jenkins@20211123, retriever=null}) + runBwcTestScript.readYaml({file=tests/jenkins/data/opensearch-1.3.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRootUrl(dummy_job, 717) + runBwcTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + runBwcTestScript.echo(Paths: opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) + runBwcTestScript.sh(./test.sh bwc-test tests/jenkins/data/opensearch-1.3.0-test.yml --paths opensearch=https://ci.opensearch.org/ci/dbc/dummy_job/1.3.0/717/linux/x64) diff --git a/tests/jenkins/jobs/RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile b/tests/jenkins/jobs/RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile new file mode 100644 index 0000000000..6990c3cb1d --- /dev/null +++ b/tests/jenkins/jobs/RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile @@ -0,0 +1,25 @@ +/* + * 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('bwc-test') { + steps { + script { + runBwcTestScript( + jobName: 'dummy_job', + buildManifest: 'tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml', + testManifest: 'tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml', + buildId: '215' + ) + } + } + } + } +} \ No newline at end of file diff --git a/tests/jenkins/jobs/RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.txt b/tests/jenkins/jobs/RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.txt new file mode 100644 index 0000000000..61ca8ed86a --- /dev/null +++ b/tests/jenkins/jobs/RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.txt @@ -0,0 +1,14 @@ + RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.run() + RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.pipeline(groovy.lang.Closure) + RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.echo(Executing on agent [label:none]) + RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.stage(bwc-test, groovy.lang.Closure) + RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.script(groovy.lang.Closure) + RunBwcTestScript_OpenSearch_Dashboards_Jenkinsfile.runBwcTestScript({jobName=dummy_job, buildManifest=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml, testManifest=tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml, buildId=215}) + runBwcTestScript.legacySCM(groovy.lang.Closure) + runBwcTestScript.library({identifier=jenkins@20211123, retriever=null}) + runBwcTestScript.readYaml({file=tests/jenkins/data/opensearch-dashboards-1.2.0-build.yml}) + BuildManifest.asBoolean() + BuildManifest.getArtifactRootUrl(dummy_job, 215) + runBwcTestScript.echo(Artifact root URL: https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + runBwcTestScript.echo(Paths: opensearch-dashboards=https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) + runBwcTestScript.sh(./test.sh bwc-test tests/jenkins/data/opensearch-dashboards-1.2.0-test.yml --paths opensearch-dashboards=https://ci.opensearch.org/ci/dbc/dummy_job/1.2.0/215/linux/x64) diff --git a/tests/jenkins/lib-testers/DetectTestDockerAgentLibTester.groovy b/tests/jenkins/lib-testers/DetectTestDockerAgentLibTester.groovy index 186ad8b997..d318ec3688 100644 --- a/tests/jenkins/lib-testers/DetectTestDockerAgentLibTester.groovy +++ b/tests/jenkins/lib-testers/DetectTestDockerAgentLibTester.groovy @@ -1,25 +1,28 @@ import static org.hamcrest.CoreMatchers.notNullValue import static org.hamcrest.MatcherAssert.assertThat +import org.yaml.snakeyaml.Yaml class DetectTestDockerAgentLibTester extends LibFunctionTester { private String testManifest - public DetectTestDockerAgentLibTester(testManifest){ + public DetectTestDockerAgentLibTester(testManifest=null){ this.testManifest = testManifest } void configure(helper, binding) { - // N/A + helper.registerAllowedMethod('readYaml', [Map.class], { args -> + return new Yaml().load((this.testManifest ?: binding.getVariable('TEST_MANIFEST') as File).text) + }) } void parameterInvariantsAssertions(call) { - assertThat(call.args.testManifest.first(), notNullValue()) + // NA } boolean expectedParametersMatcher(call) { - return call.args.testManifest.first().toString().equals(this.testManifest) + return this.testManifest != null ? call.args.testManifest.first().toString().equals(this.testManifest) : true } String libFunctionName() { diff --git a/tests/jenkins/lib-testers/DownloadBuildManifestLibTester.groovy b/tests/jenkins/lib-testers/DownloadBuildManifestLibTester.groovy new file mode 100644 index 0000000000..8ded36d5a8 --- /dev/null +++ b/tests/jenkins/lib-testers/DownloadBuildManifestLibTester.groovy @@ -0,0 +1,35 @@ +import static org.hamcrest.CoreMatchers.notNullValue +import static org.hamcrest.MatcherAssert.assertThat +import org.yaml.snakeyaml.Yaml + + +class DownloadBuildManifestLibTester extends LibFunctionTester { + + private String url + private String path + + public DownloadBuildManifestLibTester(url, path){ + this.url = url + this.path = path + } + + void configure(helper, binding) { + helper.registerAllowedMethod('readYaml', [Map.class], { args -> + return new Yaml().load((path as File).text) + }) + } + + void parameterInvariantsAssertions(call) { + assertThat(call.args.url.first(), notNullValue()) + assertThat(call.args.path.first(), notNullValue()) + } + + boolean expectedParametersMatcher(call) { + return call.args.url.first().toString().equals(this.url) + && call.args.path.first().toString().equals(this.path) + } + + String libFunctionName() { + return 'downloadBuildManifest' + } +} diff --git a/tests/jenkins/lib-testers/RunBwcTestScriptLibTest.groovy b/tests/jenkins/lib-testers/RunBwcTestScriptLibTest.groovy new file mode 100644 index 0000000000..268d3273e8 --- /dev/null +++ b/tests/jenkins/lib-testers/RunBwcTestScriptLibTest.groovy @@ -0,0 +1,39 @@ +import static org.hamcrest.CoreMatchers.notNullValue +import static org.hamcrest.MatcherAssert.assertThat + + +class RunBwcTestScriptLibTester extends LibFunctionTester { + + private String jobName + private String buildManifest + private String testManifest + private String buildId + + public RunBwcTestScriptLibTester(jobName, buildManifest, testManifest, buildId){ + this.jobName = jobName + this.buildManifest = buildManifest + this.testManifest = testManifest + this.buildId = buildId + } + + void configure(helper, binding) { + // N/A + } + + void parameterInvariantsAssertions(call) { + assertThat(call.args.buildManifest.first().toString(), notNullValue()) + assertThat(call.args.testManifest.first().toString(), notNullValue()) + assertThat(call.args.buildId.first().toString(), notNullValue()) + } + + boolean expectedParametersMatcher(call) { + return call.args.jobName.first().toString().equals(this.jobName) + && call.args.buildManifest.first().toString().equals(this.buildManifest) + && call.args.testManifest.first().toString().equals(this.testManifest) + && call.args.buildId.first().toString().equals(this.buildId) + } + + String libFunctionName() { + return 'runBwcTestScript' + } +} diff --git a/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch.py b/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch.py index 7b89c53988..2ae71854db 100644 --- a/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch.py +++ b/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch.py @@ -149,7 +149,7 @@ def test_execute_bwctest_sh(self, mock_execute, mock_git, mock_test_result_data, mock_test_result_data.assert_called_once_with( "dashboards-reports", - test_config, + "with-security", "test_status", "test_stdout", "", diff --git a/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch_dashboards.py b/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch_dashboards.py index 0c8e02d4ee..10c65aaf53 100644 --- a/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch_dashboards.py +++ b/tests/tests_test_workflow/test_bwc_workflow/bwc_test/test_bwc_test_suite_opensearch_dashboards.py @@ -156,7 +156,7 @@ def test_execute_bwctest_sh(self, mock_execute, mock_git, mock_test_result_data, mock_test_result_data.assert_called_once_with( "dashboards-reports", - test_config, + "with-security", "test_status", "test_stdout", "", diff --git a/vars/runBwcTestScript.groovy b/vars/runBwcTestScript.groovy new file mode 100644 index 0000000000..41f09623c3 --- /dev/null +++ b/vars/runBwcTestScript.groovy @@ -0,0 +1,24 @@ +void call(Map args = [:]) { + String jobName = args.jobName ?: 'distribution-build-opensearch' + lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm)) + def buildManifest = lib.jenkins.BuildManifest.new(readYaml(file: args.buildManifest)) + String artifactRootUrl = buildManifest.getArtifactRootUrl(jobName, args.buildId) + echo "Artifact root URL: ${artifactRootUrl}" + + String paths = generatePaths(buildManifest, artifactRootUrl) + echo "Paths: ${paths}" + + sh([ + './test.sh', + 'bwc-test', + "${args.testManifest}", + "--paths ${paths}", + ].join(' ')) +} + +String generatePaths(buildManifest, artifactRootUrl) { + String name = buildManifest.build.name + return name == 'OpenSearch' ? + "opensearch=${artifactRootUrl}" : + "opensearch-dashboards=${artifactRootUrl}" +} \ No newline at end of file