Skip to content

Commit

Permalink
move logic around in runBenchmarkTestScript
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Oviedo <[email protected]>
  • Loading branch information
OVI3D0 authored and rishabh6788 committed Aug 8, 2024
1 parent d990de2 commit 1ecc724
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
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=config.yml, bucket=ARTIFACT_BUCKET_NAME, path=test_config/config.yml, force=true})
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})
Expand Down
2 changes: 1 addition & 1 deletion tests/jenkins/jobs/CompareBenchmarkRun_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CompareBenchmarkRun_Jenkinsfile.getCompareBenchmarkIds({baselineClusterConfig=test-baseline-config, distributionVersion=3.0.0, workload=big5, pullRequestNumber=12345})
getCompareBenchmarkIds.string({credentialsId=benchmark-metrics-datastore-user, variable=DATASTORE_USER})
getCompareBenchmarkIds.string({credentialsId=benchmark-metrics-datastore-password, variable=DATASTORE_PASSWORD})
getCompareBenchmarkIds.string({credentialsId=benchmark-metrics-datastore-endpoint, variable=DATASTORE_ENDPOINT})
getCompareBenchmarkIds.string({credentialsId=benchmark-metrics-datastore-nlb-endpoint, variable=DATASTORE_ENDPOINT})
getCompareBenchmarkIds.withCredentials([DATASTORE_USER, DATASTORE_PASSWORD, DATASTORE_ENDPOINT], groovy.lang.Closure)
getCompareBenchmarkIds.sh({script=
curl -X POST "https://DATASTORE_ENDPOINT/benchmark-results-*/_search" -ku DATASTORE_USER:DATASTORE_PASSWORD -H 'Content-Type: application/json' -d '{
Expand Down
28 changes: 28 additions & 0 deletions tests/jenkins/jobs/CompareTest_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,36 @@
CompareTest_Jenkinsfile.stage(test-with-all-args, groovy.lang.Closure)
CompareTest_Jenkinsfile.script(groovy.lang.Closure)
CompareTest_Jenkinsfile.runBenchmarkTestScript({command=compare, baseline=12345, contender=54321, results_format=csv, results_numbers_align=left, results_file=/results/final_results, show_in_results=true, suffix=compare-tester, bundleManifest=tests/data/opensearch-1.3.0-bundle.yml})
runBenchmarkTestScript.legacySCM(groovy.lang.Closure)
runBenchmarkTestScript.library({identifier=jenkins@main, retriever=null})
runBenchmarkTestScript.readYaml({file=tests/data/opensearch-1.3.0-bundle.yml})
BuildManifest.asBoolean()
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(set +x && ./test.sh benchmark-test compare 12345 54321 --benchmark-config /tmp/workspace/benchmark.ini --suffix compare-tester --results-format=csv --results-numbers-align=left --results-file=/results/final_results --show-in-results=true)
CompareTest_Jenkinsfile.stage(test-with-base-args, groovy.lang.Closure)
CompareTest_Jenkinsfile.script(groovy.lang.Closure)
CompareTest_Jenkinsfile.runBenchmarkTestScript({command=compare, baseline=12345, contender=54321, suffix=compare-tester, bundleManifest=tests/data/opensearch-1.3.0-bundle.yml})
runBenchmarkTestScript.legacySCM(groovy.lang.Closure)
runBenchmarkTestScript.library({identifier=jenkins@main, retriever=null})
runBenchmarkTestScript.readYaml({file=tests/data/opensearch-1.3.0-bundle.yml})
BuildManifest.asBoolean()
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(set +x && ./test.sh benchmark-test compare 12345 54321 --benchmark-config /tmp/workspace/benchmark.ini --suffix compare-tester)
16 changes: 15 additions & 1 deletion tests/jenkins/lib-testers/RunCompareTestScriptLibTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RunCompareTestScriptLibTester extends LibFunctionTester{
private String suffix
private String bundleManifest

public RunCompareTestScriptLibTester(command, baseline, contender, results_format,
public RunCompareTestScriptLibTester(command, baseline, contender, results_format,
results_numbers_align, results_file, show_in_results,
suffix, bundleManifest){
this.command = command
Expand Down Expand Up @@ -64,5 +64,19 @@ class RunCompareTestScriptLibTester extends LibFunctionTester{
binding.setVariable('RESULTS_FILE', results_file)
binding.setVariable('SHOW_IN_RESULTS', show_in_results)
binding.setVariable('BUNDLE_MANIFEST', bundleManifest)
helper.registerAllowedMethod("withAWS", [Map, Closure], {
args,
closure ->
closure.delegate = delegate
return helper.callClosure(closure)
})
helper.registerAllowedMethod("s3Download", [Map])
helper.registerAllowedMethod("withAWS", [Map, Closure], {
args,
closure ->
closure.delegate = delegate
return helper.callClosure(closure)
})
helper.registerAllowedMethod("withCredentials", [Map])
}
}
2 changes: 1 addition & 1 deletion vars/getCompareBenchmarkIds.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Map<String, String> call(Map args = [:]) {
String getBaselineTestExecutionId(baselineClusterConfig, distributionVersion, workload) {
withCredentials([string(credentialsId: 'benchmark-metrics-datastore-user', variable: 'DATASTORE_USER'),
string(credentialsId: 'benchmark-metrics-datastore-password', variable: 'DATASTORE_PASSWORD'),
string(credentialsId: 'benchmark-metrics-datastore-endpoint', variable: 'DATASTORE_ENDPOINT')]) {
string(credentialsId: 'benchmark-metrics-datastore-nlb-endpoint', variable: 'DATASTORE_ENDPOINT')]) {
def curlCommand = """
curl -X POST "https://${DATASTORE_ENDPOINT}/benchmark-results-*/_search" -ku ${DATASTORE_USER}:${DATASTORE_PASSWORD} -H 'Content-Type: application/json' -d '{
"size": 1,
Expand Down
5 changes: 3 additions & 2 deletions vars/runBenchmarkTestScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ void call(Map args = [:]) {
}
}

def command
editBenchmarkConfig("${WORKSPACE}/benchmark.ini")

String command = ''

if(args.command == 'execute-test') {

Expand All @@ -82,7 +84,6 @@ void call(Map args = [:]) {
sleep(120)
}

editBenchmarkConfig("${WORKSPACE}/benchmark.ini")
String userTags = getMetadataTags(args.userTag.toString(), buildManifest)

command = [
Expand Down

0 comments on commit 1ecc724

Please sign in to comment.