forked from opensearch-project/opensearch-build-libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add changes to benchmark groovy library to support test runs against …
…an endpoint Signed-off-by: Divya Madala <divyaasm@amazon.com>
- Loading branch information
Showing
12 changed files
with
274 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
tests/jenkins/TestRunBenchmarkTestScriptWithEndpoint.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.