Skip to content

Commit

Permalink
Add changes to benchmark groovy library to support test runs against …
Browse files Browse the repository at this point in the history
…any endpoint (#400)

Signed-off-by: Divya Madala <[email protected]>
  • Loading branch information
Divyaasm authored Mar 28, 2024
1 parent 2d571f5 commit 71c8079
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jacocoTestReport {
}
}

String version = '6.4.0'
String version = '6.4.1'

task updateVersion {
doLast {
Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/TestRunBenchmarkTestScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ class TestRunBenchmarkTestScript extends BuildPipelineTest {

assertThat(testScriptCommands.size(), equalTo(2))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,security-enabled:true --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307-secure --data-instance-type r5.8xlarge --workload-params '{\"key2\":\"value2\"}' --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 ".toString()
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,security-enabled:true --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307-secure --data-instance-type r5.8xlarge --workload-params '{\"key2\":\"value2\"}' --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200"
))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,security-enabled:false --without-security --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307 --data-instance-type r5.8xlarge --workload-params '{\"key2\":\"value2\"}' --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 ".toString()
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,security-enabled:false --without-security --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307 --data-instance-type r5.8xlarge --workload-params '{\"key2\":\"value2\"}' --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200"
))
}

Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/TestRunBenchmarkTestScriptMultiNode.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class TestRunBenchmarkTestScriptMultiNode extends BuildPipelineTest {

assertThat(testScriptCommands.size(), equalTo(2))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:true --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307-secure --manager-node-count 3 --data-node-count 3 --workload-params '{\"key2\":\"value2\"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:true --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307-secure --manager-node-count 3 --data-node-count 3 --workload-params '{\"key2\":\"value2\"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:false --without-security --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307 --manager-node-count 3 --data-node-count 3 --workload-params '{\"key2\":\"value2\"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
"./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:false --without-security --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307 --manager-node-count 3 --data-node-count 3 --workload-params '{\"key2\":\"value2\"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
))
}

Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/TestRunBenchmarkTestScriptNoTags.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ class TestRunBenchmarkTestScriptNoManifest extends BuildPipelineTest {

assertThat(testScriptCommands.size(), equalTo(2))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:true --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307-secure --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 ".toString()
"./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:true --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307-secure --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200"
))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:false --without-security --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307 --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 ".toString()
"./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:false --without-security --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307 --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200"
))
}

Expand Down
73 changes: 73 additions & 0 deletions tests/jenkins/TestRunBenchmarkTestScriptWithEndpoint.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

/*
* 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.
*/

import jenkins.tests.BuildPipelineTest
import org.junit.Before
import org.junit.Test

import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString
import static org.hamcrest.CoreMatchers.equalTo
import static org.hamcrest.CoreMatchers.hasItem
import static org.hamcrest.MatcherAssert.assertThat

class TestRunBenchmarkTestScriptWithEndpoint extends BuildPipelineTest {

@Before
void setUp() {
this.registerLibTester(new RunBenchmarkTestEndpointLibTester(
'opensearch-ABCxdfdfhyfk.com',
'false',
'nyc_taxis',
'true',
'',
'',
'',
'',
'',
''
))
super.setUp()
}

@Test
public void testRunBenchmarkTestScript_PipelineSingleNode() {
super.testPipeline("tests/jenkins/jobs/BenchmarkTestWithEndpoint_Jenkinsfile")
}

@Test
void testRunBenchmarkTestScript_verifyScriptExecutionsNoManifest() {
runScript("tests/jenkins/jobs/BenchmarkTestWithEndpoint_Jenkinsfile")

def testScriptCommands = getCommandExecutions('sh', './test.sh').findAll {
shCommand -> shCommand.contains('./test.sh')
}

assertThat(testScriptCommands.size(), equalTo(1))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --cluster-endpoint opensearch-ABCxdfdfhyfk.com --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag true,security-enabled:true"
))
}

def getCommandExecutions(methodName, command) {
def shCommands = helper.callStack.findAll {
call ->
call.methodName == methodName
}.
collect {
call ->
callArgsToString(call)
}.findAll {
shCommand ->
shCommand.contains(command)
}

return shCommands
}
}
4 changes: 2 additions & 2 deletions tests/jenkins/jobs/BenchmarkTestMultinode_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
BuildManifest.getArtifactBuildId()
BuildManifest.getArtifactArchitecture()
BuildManifest.getCommitId(OpenSearch)
runBenchmarkTestScript.sh(./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:true --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307-secure --manager-node-count 3 --data-node-count 3 --workload-params '{"key2":"value2"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{"telemetry_setting":"value"}')
runBenchmarkTestScript.sh(./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:true --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307-secure --manager-node-count 3 --data-node-count 3 --workload-params '{"key2":"value2"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{"telemetry_setting":"value"}')
BenchmarkTestMultinode_Jenkinsfile.stage(test-without-security, groovy.lang.Closure)
BenchmarkTestMultinode_Jenkinsfile.script(groovy.lang.Closure)
BenchmarkTestMultinode_Jenkinsfile.downloadBuildManifest({url=test://artifact.url, path=tests/data/opensearch-1.3.0-bundle.yml})
Expand Down Expand Up @@ -56,4 +56,4 @@
BuildManifest.getArtifactBuildId()
BuildManifest.getArtifactArchitecture()
BuildManifest.getCommitId(OpenSearch)
runBenchmarkTestScript.sh(./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:false --without-security --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307 --manager-node-count 3 --data-node-count 3 --workload-params '{"key2":"value2"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{"telemetry_setting":"value"}')
runBenchmarkTestScript.sh(./test.sh benchmark-test --bundle-manifest tests/data/opensearch-1.3.0-bundle.yml --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag distribution-build-id:1236,arch:x64,os-commit-id:22408088f002a4fc8cdd3b2ed7438866c14c5069,key1:value1,security-enabled:false --without-security --use-50-percent-heap --enable-remote-store --capture-node-stat --suffix 307 --manager-node-count 3 --data-node-count 3 --workload-params '{"key2":"value2"}' --test-procedure custom-test-procedure --exclude-tasks index-append,default --include-tasks type:search,index --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 --telemetry-params '{"telemetry_setting":"value"}')
4 changes: 2 additions & 2 deletions tests/jenkins/jobs/BenchmarkTestNoManifest_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
runBenchmarkTestScript.withCredentials([DATASTORE_USER, DATASTORE_PASSWORD], groovy.lang.Closure)
runBenchmarkTestScript.readFile({file=/tmp/workspace/benchmark.ini})
runBenchmarkTestScript.writeFile({file=/tmp/workspace/benchmark.ini, text=})
runBenchmarkTestScript.sh(./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:true --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307-secure --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 )
runBenchmarkTestScript.sh(./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:true --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307-secure --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200)
BenchmarkTestNoManifest_Jenkinsfile.stage(test-without-security, groovy.lang.Closure)
BenchmarkTestNoManifest_Jenkinsfile.script(groovy.lang.Closure)
BenchmarkTestNoManifest_Jenkinsfile.runBenchmarkTestScript({bundleManifest=, distributionUrl=https://www.exmaple.com/example.tar.gz, distributionVersion=3.0.0, workload=nyc_taxis, insecure=true, singleNode=true, minDistribution=false, use50PercentHeap=true, enableRemoteStore=false, suffix=307, managerNodeCount=, dataNodeCount=, clientNodeCount=, ingestNodeCount=, mlNodeCount=, dataInstanceType=r5.8xlarge, userTag=security-enabled:false, workloadParams=, testProcedure=custom-test-procedure, excludeTasks=, includeTasks=, additionalConfig=cluster.indices.replication.strategy:SEGMENT, dataStorageSize=200, mlStorageSize=200, jvmSysProps=, captureNodeStat=false, captureSegmentReplicationStat=true, telemetryParams=})
Expand All @@ -34,4 +34,4 @@
runBenchmarkTestScript.withCredentials([DATASTORE_USER, DATASTORE_PASSWORD], groovy.lang.Closure)
runBenchmarkTestScript.readFile({file=/tmp/workspace/benchmark.ini})
runBenchmarkTestScript.writeFile({file=/tmp/workspace/benchmark.ini, text=})
runBenchmarkTestScript.sh(./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:false --without-security --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307 --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200 )
runBenchmarkTestScript.sh(./test.sh benchmark-test --distribution-url https://www.exmaple.com/example.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc_taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag security-enabled:false --without-security --single-node --use-50-percent-heap --capture-segment-replication-stat --suffix 307 --data-instance-type r5.8xlarge --test-procedure custom-test-procedure --additional-config cluster.indices.replication.strategy:SEGMENT --data-node-storage 200 --ml-node-storage 200)
Loading

0 comments on commit 71c8079

Please sign in to comment.