Skip to content

Commit

Permalink
Add changes and update testcases
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Madala <divyaasm@amazon.com>
  • Loading branch information
Divyaasm committed Mar 29, 2024
1 parent c81c2b0 commit d810fde
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 41 deletions.
16 changes: 5 additions & 11 deletions jenkins/opensearch/benchmark-test-endpoint.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: 'jenkins@5.11.0', retriever: modernSCM([
lib = library(identifier: 'jenkins@6.4.1', retriever: modernSCM([

$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
Expand All @@ -30,7 +30,7 @@ parameters {
trim: true
)
booleanParam(
name: 'CLUSTER_WITH_SECURITY',
name: 'SECURITY_ENABLED',
description: 'Mention if the cluster is secured or insecured.',
defaultValue: false,
)
Expand All @@ -41,11 +41,6 @@ parameters {
defaultValue: 'nyc_taxis',
trim: true
)
string(
name: 'ADDITIONAL_CONFIG',
description: 'Additional opensearch.yml config parameters passed as JSON. e.g., `opensearch.experimental.feature.segment_replication_experimental.enabled:true cluster.indices.replication.strategy:SEGMENT`',
trim: true
)
string(
name: 'USER_TAGS',
description: 'Attach arbitrary text to the meta-data of each benchmark metric record, without any spaces. e.g., `run-type:adhoc,segrep:enabled,arch:x64`. ',
Expand Down Expand Up @@ -110,18 +105,17 @@ parameters {
steps {
script {
echo "CLUSTER_ENDPOINT: ${CLUSTER_ENDPOINT}"
echo "security-enabled: ${CLUSTER_WITH_SECURITY}"
echo "security-enabled: ${SECURITY_ENABLED}"

runBenchmarkTestScript(
endpoint: CLUSTER_ENDPOINT,
insecure: !CLUSTER_WITH_SECURITY,
insecure: !SECURITY_ENABLED,
workload: TEST_WORKLOAD,
userTag: USER_TAGS.isEmpty() ? "security-enabled:${CLUSTER_WITH_SECURITY}" : "${USER_TAGS},security-enabled:${CLUSTER_WITH_SECURITY}",
userTag: USER_TAGS.isEmpty() ? "security-enabled:${SECURITY_ENABLED}" : "${USER_TAGS},security-enabled:${SECURITY_ENABLED}",
workloadParams: WORKLOAD_PARAMS,
testProcedure: TEST_PROCEDURE,
excludeTasks: EXCLUDE_TASKS,
includeTasks: INCLUDE_TASKS,
additionalConfig: ADDITIONAL_CONFIG,
captureNodeStat: CAPTURE_NODE_STAT,
captureSegmentReplicationStat: CAPTURE_SEGMENT_REPLICATION_STAT,
telemetryParams: TELEMETRY_PARAMS
Expand Down
2 changes: 1 addition & 1 deletion jenkins/opensearch/benchmark-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: 'jenkins@5.11.0', retriever: modernSCM([
lib = library(identifier: 'jenkins@6.4.1', retriever: modernSCM([

$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
Expand Down
27 changes: 24 additions & 3 deletions tests/jenkins/TestRunBenchmarkTestEndpoint.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestRunBenchmarkTestEndpoint extends BuildPipelineTest{
void setUp() {
helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('5.11.0')
.defaultVersion('6.4.1')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
Expand All @@ -51,7 +51,7 @@ class TestRunBenchmarkTestEndpoint extends BuildPipelineTest{
binding.setVariable('ARTIFACT_DOWNLOAD_ROLE_NAME', 'Dummy_Download_Role')
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'dummy_account')
binding.setVariable('CLUSTER_ENDPOINT', 'opensearch-ABCxdfdfhyfk.com')
binding.setVariable('CLUSTER_WITH_SECURITY', true)
binding.setVariable('SECURITY_ENABLED', true)
binding.setVariable('GITHUB_BOT_TOKEN_NAME', 'bot_token_name')
binding.setVariable('GITHUB_USER', 'test_user')
binding.setVariable('GITHUB_TOKEN', 'test_token')
Expand All @@ -73,7 +73,7 @@ class TestRunBenchmarkTestEndpoint extends BuildPipelineTest{
@Test
public void testRunSecureBenchmarkTestScript_verifyPipeline() {
super.testPipeline("jenkins/opensearch/benchmark-test-endpoint.jenkinsfile",
"tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-test-endpoint.jenkinsfile")
"tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-test-endpoint-secure.jenkinsfile")
}

@Test
Expand Down Expand Up @@ -108,6 +108,27 @@ class TestRunBenchmarkTestEndpoint extends BuildPipelineTest{
"./test.sh benchmark-test --cluster-endpoint opensearch-ABCxdfdfhyfk.com --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:true --test-procedure append-no-conflicts --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
))
}
@Test
public void testRunSecureBenchmarkTestWithoutSecurity_verifyPipeline() {
binding.setVariable('SECURITY_ENABLED', false)
super.testPipeline("jenkins/opensearch/benchmark-test-endpoint.jenkinsfile",
"tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-test-endpoint-insecure.jenkinsfile")
}

@Test
void testRunSecureBenchmarkTestScript_verifyWithoutSecurity() {
binding.setVariable('SECURITY_ENABLED', false)
runScript("jenkins/opensearch/benchmark-test-endpoint.jenkinsfile")

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

assertThat(testScriptCommands.size(), equalTo(1))
assertThat(testScriptCommands, hasItems(
"./test.sh benchmark-test --cluster-endpoint opensearch-ABCxdfdfhyfk.com --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false --without-security --test-procedure append-no-conflicts --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
))
}

def getCommandExecutions(methodName, command) {
def shCommands = helper.callStack.findAll {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestRunBenchmarkTestScriptDistributionUrl extends BuildPipelineTest {
void setUp() {
helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('5.11.0')
.defaultVersion('6.4.1')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
Expand Down Expand Up @@ -131,7 +131,7 @@ class TestRunBenchmarkTestScriptDistributionUrl extends BuildPipelineTest {

assertThat(testScriptCommands.size(), equalTo(1))
assertThat(testScriptCommands, hasItems(
"./test.sh benchmark-test --distribution-url https://artifacts.com/artifact.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --suffix 307 --manager-node-count 3 --data-node-count 3 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --data-node-storage 100 ".toString()
"./test.sh benchmark-test --distribution-url https://artifacts.com/artifact.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --suffix 307 --manager-node-count 3 --data-node-count 3 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --data-node-storage 100".toString()
))
}

Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/TestRunNonSecBenchmarkTestScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestRunNonSecBenchmarkTestScript extends BuildPipelineTest{
void setUp() {
helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('5.11.0')
.defaultVersion('6.4.1')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
Expand Down Expand Up @@ -140,7 +140,7 @@ class TestRunNonSecBenchmarkTestScript extends BuildPipelineTest{

assertThat(testScriptCommands.size(), equalTo(1))
assertThat(testScriptCommands, hasItem(
"./test.sh benchmark-test --bundle-manifest tests/jenkins/data/opensearch-1.3.0-non-security-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,run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --suffix 307 --manager-node-count 3 --data-node-count 3 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --exclude-tasks type:search,scroll --include-tasks type:search,scroll --data-node-storage 100 ".toString()
"./test.sh benchmark-test --bundle-manifest tests/jenkins/data/opensearch-1.3.0-non-security-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,run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --suffix 307 --manager-node-count 3 --data-node-count 3 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --exclude-tasks type:search,scroll --include-tasks type:search,scroll --data-node-storage 100".toString()
))
}

Expand Down
6 changes: 3 additions & 3 deletions tests/jenkins/TestRunSecureBenchmarkTestScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestRunSecureBenchmarkTestScript extends BuildPipelineTest{
void setUp() {
helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('5.11.0')
.defaultVersion('6.4.1')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
Expand Down Expand Up @@ -141,8 +141,8 @@ class TestRunSecureBenchmarkTestScript extends BuildPipelineTest{

assertThat(testScriptCommands.size(), equalTo(2))
assertThat(testScriptCommands, hasItems(
"./test.sh benchmark-test --bundle-manifest tests/jenkins/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,run-type:test,security-enabled:true,jenkins-build-id:307 --use-50-percent-heap --enable-remote-store --capture-segment-replication-stat --suffix 307-secure --manager-node-count 3 --data-node-count 3 --data-node-storage 100 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString(),
"./test.sh benchmark-test --bundle-manifest tests/jenkins/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,run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --enable-remote-store --capture-segment-replication-stat --suffix 307 --manager-node-count 3 --data-node-count 3 --data-node-storage 100 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
"./test.sh benchmark-test --bundle-manifest tests/jenkins/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,run-type:test,security-enabled:true,jenkins-build-id:307 --use-50-percent-heap --enable-remote-store --capture-segment-replication-stat --suffix 307-secure --manager-node-count 3 --data-node-count 3 --data-node-storage 100 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString(),
"./test.sh benchmark-test --bundle-manifest tests/jenkins/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,run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --enable-remote-store --capture-segment-replication-stat --suffix 307 --manager-node-count 3 --data-node-count 3 --data-node-storage 100 --telemetry-params '{\"telemetry_setting\":\"value\"}'".toString()
))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
benchmark-test.run()
benchmark-test.modernSCM({$class=GitSCMSource, remote=https://github.com/opensearch-project/opensearch-build-libraries.git})
benchmark-test.library({identifier=jenkins@5.11.0, retriever=null})
benchmark-test.library({identifier=jenkins@6.4.1, retriever=null})
benchmark-test.pipeline(groovy.lang.Closure)
benchmark-test.timeout({time=24, unit=HOURS})
benchmark-test.logRotator({daysToKeepStr=30})
Expand Down Expand Up @@ -133,7 +133,7 @@
benchmark-test.echo(DISTRIBUTION_VERSION: 3.0.0)
benchmark-test.runBenchmarkTestScript({bundleManifest=, distributionUrl=https://artifacts.com/artifact.tar.gz, distributionVersion=3.0.0, workload=nyc-taxis, insecure=true, singleNode=false, minDistribution=false, use50PercentHeap=true, enableRemoteStore=false, suffix=307, managerNodeCount=3, dataNodeCount=3, clientNodeCount=, ingestNodeCount=, mlNodeCount=, dataInstanceType=r5-4xlarge, userTag=run-type:test,security-enabled:false,jenkins-build-id:307, workloadParams=, testProcedure=append-no-conflicts, excludeTasks=, includeTasks=, additionalConfig=, dataStorageSize=100, mlStorageSize=, jvmSysProps=, captureNodeStat=false, captureSegmentReplicationStat=false, telemetryParams=})
runBenchmarkTestScript.legacySCM(groovy.lang.Closure)
runBenchmarkTestScript.library({identifier=jenkins@5.11.0, retriever=null})
runBenchmarkTestScript.library({identifier=jenkins@6.4.1, retriever=null})
runBenchmarkTestScript.string({credentialsId=jenkins-aws-account-public, variable=AWS_ACCOUNT_PUBLIC})
runBenchmarkTestScript.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME})
runBenchmarkTestScript.withCredentials([AWS_ACCOUNT_PUBLIC, ARTIFACT_BUCKET_NAME], groovy.lang.Closure)
Expand All @@ -145,7 +145,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://artifacts.com/artifact.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --suffix 307 --manager-node-count 3 --data-node-count 3 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --data-node-storage 100 )
runBenchmarkTestScript.sh(./test.sh benchmark-test --distribution-url https://artifacts.com/artifact.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false,jenkins-build-id:307 --without-security --use-50-percent-heap --suffix 307 --manager-node-count 3 --data-node-count 3 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --data-node-storage 100)
Messages.asBoolean()
Messages.asBoolean()
Messages.get([benchmark-test])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
benchmark-test-endpoint.run()
benchmark-test-endpoint.modernSCM({$class=GitSCMSource, remote=https://github.com/opensearch-project/opensearch-build-libraries.git})
benchmark-test-endpoint.library({identifier=jenkins@6.4.1, retriever=null})
benchmark-test-endpoint.pipeline(groovy.lang.Closure)
benchmark-test-endpoint.timeout({time=24, unit=HOURS})
benchmark-test-endpoint.logRotator({daysToKeepStr=30})
benchmark-test-endpoint.buildDiscarder(null)
benchmark-test-endpoint.echo(Executing on agent [label:none])
benchmark-test-endpoint.stage(validate-and-set-parameters, groovy.lang.Closure)
benchmark-test-endpoint.echo(Executing on agent [label:Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host])
benchmark-test-endpoint.script(groovy.lang.Closure)
benchmark-test-endpoint.postCleanup()
postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true})
benchmark-test-endpoint.stage(benchmark-test-with-cluster, groovy.lang.Closure)
benchmark-test-endpoint.echo(Executing on agent [label:Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host])
benchmark-test-endpoint.script(groovy.lang.Closure)
benchmark-test-endpoint.echo(CLUSTER_ENDPOINT: opensearch-ABCxdfdfhyfk.com)
benchmark-test-endpoint.echo(security-enabled: false)
benchmark-test-endpoint.runBenchmarkTestScript({endpoint=opensearch-ABCxdfdfhyfk.com, insecure=true, workload=nyc-taxis, userTag=run-type:test,security-enabled:false, workloadParams=, testProcedure=append-no-conflicts, excludeTasks=, includeTasks=, captureNodeStat=false, captureSegmentReplicationStat=false, telemetryParams={"telemetry_setting":"value"}})
runBenchmarkTestScript.legacySCM(groovy.lang.Closure)
runBenchmarkTestScript.library({identifier=jenkins@6.4.1, retriever=null})
runBenchmarkTestScript.string({credentialsId=jenkins-aws-account-public, variable=AWS_ACCOUNT_PUBLIC})
runBenchmarkTestScript.string({credentialsId=jenkins-artifact-bucket-name, variable=ARTIFACT_BUCKET_NAME})
runBenchmarkTestScript.withCredentials([AWS_ACCOUNT_PUBLIC, ARTIFACT_BUCKET_NAME], groovy.lang.Closure)
runBenchmarkTestScript.withAWS({role=opensearch-test, roleAccount=AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure)
runBenchmarkTestScript.s3Download({file=benchmark.ini, bucket=ARTIFACT_BUCKET_NAME, path=test_config/benchmark.ini, force=true})
runBenchmarkTestScript.string({credentialsId=benchmark-metrics-datastore-user, variable=DATASTORE_USER})
runBenchmarkTestScript.string({credentialsId=benchmark-metrics-datastore-password, variable=DATASTORE_PASSWORD})
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 --cluster-endpoint opensearch-ABCxdfdfhyfk.com --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false --without-security --test-procedure append-no-conflicts --telemetry-params '{"telemetry_setting":"value"}')
benchmark-test-endpoint.postCleanup()
postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true})
Loading

0 comments on commit d810fde

Please sign in to comment.