Skip to content

Commit

Permalink
Add more testcases
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Madala <[email protected]>
  • Loading branch information
Divyaasm committed Feb 28, 2024
1 parent fa5aad0 commit 8349d74
Show file tree
Hide file tree
Showing 4 changed files with 996 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/jenkins/TestOpenSearchDashboardsIntegTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest {
void integTests_runs_for_all_components() {
super.testPipeline('jenkins/opensearch-dashboards/integ-test.jenkinsfile',
'tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/integ-test.jenkinsfile')
assert getCommandExecutions('stage', 'validate-artifacts').size() == 1
assertThat(getCommandExecutions('sh', 'test.sh'), hasItems(
'env PATH=$PATH ./test.sh integ-test manifests/tests/jenkins/data/opensearch-dashboards-3.0.0-test.yml --component ganttChartDashboards --test-run-id 215 --paths opensearch=/tmp/workspace/tar opensearch-dashboards=/tmp/workspace/tar --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/215/linux/x64/tar '.toString(),
'env PATH=$PATH ./test.sh integ-test manifests/tests/jenkins/data/opensearch-dashboards-3.0.0-test.yml --component anomalyDetectionDashboards --test-run-id 215 --paths opensearch=/tmp/workspace/tar opensearch-dashboards=/tmp/workspace/tar --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/215/linux/x64/tar '.toString(),
Expand Down Expand Up @@ -236,6 +237,14 @@ class TestOpenSearchDashboardsIntegTest extends BuildPipelineTest {
assertThat(getCommandExecutions('sh', 'gh issue'), hasItem('{script=gh issue edit 99 -R https://github.com/opensearch-project/dashboards-observability.git --add-label \"linux:tar:x64\", returnStdout=true}'))
}

@Test
void whenValidationIsNotChecked() {
addParam('VALIDATE_ARTIFACTS', false)
super.testPipeline('jenkins/opensearch-dashboards/integ-test.jenkinsfile',
'tests/jenkins/jenkinsjob-regression-files/opensearch-dashboards/integ-test-without-validation.jenkinsfile')
assert getCommandExecutions('stage', 'validate-artifacts').size() == 0
}

def getCommandExecutions(methodName, command) {
def shCommands = helper.callStack.findAll {
call ->
Expand Down
9 changes: 9 additions & 0 deletions tests/jenkins/TestOpenSearchIntegTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
addParam('UPDATE_GITHUB_ISSUES', true)
super.testPipeline('jenkins/opensearch/integ-test.jenkinsfile',
'tests/jenkins/jenkinsjob-regression-files/opensearch/integ-test.jenkinsfile')
assert getCommandExecutions('stage', 'validate-artifacts').size() == 1
assertThat(getCommandExecutions('sh', 'test.sh'), hasItem('env PATH=$PATH JAVA_HOME=/opt/java/openjdk-17 ./test.sh integ-test manifests/tests/jenkins/data/opensearch-3.0.0-test.yml --component k-NN --test-run-id 234 --paths opensearch=/tmp/workspace/tar --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/9010/linux/x64/tar '))
assertThat(getCommandExecutions('sh', 'report.sh'), hasItem('./report.sh manifests/tests/jenkins/data/opensearch-3.0.0-test.yml --artifact-paths opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/9010/linux/x64/tar --test-run-id 234 --test-type integ-test --base-path DUMMY_PUBLIC_ARTIFACT_URL/dummy_job/3.0.0/9010/linux/x64/tar '))
assertThat(getCommandExecutions('echo', 'Testing'), hasItem('Testing components: [ml-commons, anomaly-detection, neural-search, security-analytics, security, k-NN, notifications]'))
Expand Down Expand Up @@ -213,6 +214,14 @@ class TestOpenSearchIntegTest extends BuildPipelineTest {
assertThat(getCommandExecutions('sh', 'gh issue'), hasItem('{script=gh issue edit 99 -R https://github.com/opensearch-project/k-NN.git --add-label \"linux:tar:x64\", returnStdout=true}'))
}

@Test
void whenValidationIsNotChecked() {
addParam('VALIDATE_ARTIFACTS', false)
super.testPipeline('jenkins/opensearch/integ-test.jenkinsfile',
'tests/jenkins/jenkinsjob-regression-files/opensearch/integ-test-without-validation.jenkinsfile')
assert getCommandExecutions('stage', 'validate-artifacts').size() == 0
}

def getCommandExecutions(methodName, command) {
def shCommands = helper.callStack.findAll {
call ->
Expand Down
Loading

0 comments on commit 8349d74

Please sign in to comment.