Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya committed Oct 25, 2024
1 parent c48b88b commit c3abc79
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/jenkins/TestCreateGithubIssue.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TestCreateGithubIssue extends BuildPipelineTest {
helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/opensearch-build -S "Test GH issue title in:title is:closed closed:>=2023-10-24" --json number --jq '.[0].number'""") { script ->
return [stdout: "", exitValue: 0]
}
super.testPipeline('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
runScript('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
assertThat(getCommands('println', ''), hasItem("Creating new issue"))
assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue create --title \"Test GH issue title\" --body \"Test GH issue body\" --label \"label101\" --label \"untriaged\" --repo https://github.com/opensearch-project/opensearch-build, returnStdout=true}"))
}
Expand All @@ -90,7 +90,7 @@ class TestCreateGithubIssue extends BuildPipelineTest {
helper.addShMock("""gh label list --repo https://github.com/opensearch-project/opensearch-build -S "label101" --json name --jq '.[0].name'""") { script ->
return [stdout: "no labels in opensearch-project/opensearch-build matched your search", exitValue: 0]
}
super.testPipeline('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
runScript('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
assertThat(getCommands('println', ''), hasItem("Creating new issue"))
assertThat(getCommands('sh', 'script'), hasItem("{script=gh label create label101 --repo https://github.com/opensearch-project/opensearch-build, returnStdout=true}"))
assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue create --title \"Test GH issue title\" --body \"Test GH issue body\" --label \"label101\" --label \"untriaged\" --repo https://github.com/opensearch-project/opensearch-build, returnStdout=true}"))
Expand All @@ -113,7 +113,7 @@ class TestCreateGithubIssue extends BuildPipelineTest {
helper.addShMock("""gh issue list --repo https://github.com/opensearch-project/opensearch-build -S "Test GH issue title in:title is:closed closed:>=2023-10-24" --json number --jq '.[0].number'""") { script ->
return [stdout: "22", exitValue: 0]
}
super.testPipeline('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
runScript('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
assertThat(getCommands('println', ''), hasItem("Re-opening a recently closed issue and commenting on it"))
assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue reopen --repo https://github.com/opensearch-project/opensearch-build 22, returnStdout=true}"))
assertThat(getCommands('sh', 'script'), hasItem("{script=gh issue comment 22 --repo https://github.com/opensearch-project/opensearch-build --body \"Test GH issue body\", returnStdout=true}"))
Expand All @@ -128,7 +128,7 @@ class TestCreateGithubIssue extends BuildPipelineTest {
"label101",
"5"
))
super.testPipeline('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
runScript('tests/jenkins/jobs/CreateGithubIssue_Jenkinsfile')
assertThat(getCommands('sh', 'script'), hasItem("{script=date -d \"5 days ago\" +'%Y-%m-%d', returnStdout=true}"))
}

Expand Down

0 comments on commit c3abc79

Please sign in to comment.