-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add compare logic to opensearch build libraries
Signed-off-by: Michael Oviedo <[email protected]>
- Loading branch information
Showing
14 changed files
with
312 additions
and
53 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
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,93 @@ | ||
/* | ||
* 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 TestRunCompareTestScript extends BuildPipelineTest { | ||
@Before | ||
void setUp() { | ||
this.registerLibTester(new RunBenchmarkTestScriptLibTester( | ||
'compare', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'', | ||
'12345', | ||
'54321', | ||
'csv', | ||
'left', | ||
'/results/final_results', | ||
'true' | ||
)) | ||
super.setUp() | ||
} | ||
|
||
@Test | ||
public void testRunCompareTestScript_PipelineSingleNode() { | ||
super.testPipeline("tests/jenkins/jobs/CompareTest_Jenkinsfile") | ||
} | ||
|
||
@Test | ||
void testRunCompareTestScript_verifyScriptExecutionSingleNode() { | ||
runScript("tests/jenkins/jobs/CompareTest_Jenkinsfile") | ||
|
||
def testScriptCommands = getCommandExecutions('sh', './test.sh').findAll { | ||
shCommand -> shCommand.contains('./test.sh') | ||
} | ||
|
||
assertThat(testScriptCommands.size(), equalTo(2)) | ||
assertThat(testScriptCommands, hasItem( | ||
"set +x && ./test.sh benchmark-test compare 12345 54321" | ||
)) | ||
assertThat(testScriptCommands, hasItem( | ||
"set +x && ./test.sh benchmark-test compare 12345 54321 --results-format=csv --results-numbers-align=left --results-file=/results/final_results --show-in-results=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
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
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.