-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update parameter requirement for manifest-commit-lock workflow (#5067)
Signed-off-by: Divya Madala <[email protected]>
- Loading branch information
Showing
2 changed files
with
26 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,12 +34,13 @@ class TestReleaseManifestCommitLock extends BuildPipelineTest { | |
|
||
super.setUp() | ||
addParam('RELEASE_VERSION', '2.0.0') | ||
addParam('OPENSEARCH_RELEASE_CANDIDATE', '3813') | ||
addParam('OPENSEARCH_DASHBOARDS_RELEASE_CANDIDATE', '3050') | ||
addParam('COMPONENTS', 'OpenSearch') | ||
|
||
helper.registerAllowedMethod("withCredentials", [Map]) | ||
def buildManifest = "tests/jenkins/data/opensearch-2.0.0.yml" | ||
helper.registerAllowedMethod('error', [String], { String message -> | ||
throw new Exception(message) | ||
}) | ||
helper.registerAllowedMethod('readYaml', [Map.class], { args -> | ||
return new Yaml().load((buildManifest as File).text) | ||
}) | ||
|
@@ -49,13 +50,27 @@ class TestReleaseManifestCommitLock extends BuildPipelineTest { | |
@Test | ||
public void testManifestCommitLock_matchBuildManifest() { | ||
addParam('MANIFEST_LOCK_ACTION', 'MATCH_BUILD_MANIFEST') | ||
addParam('OPENSEARCH_RELEASE_CANDIDATE', '3813') | ||
addParam('OPENSEARCH_DASHBOARDS_RELEASE_CANDIDATE', '3050') | ||
super.testPipeline('jenkins/release-workflows/release-manifest-commit-lock.jenkinsfile', | ||
'tests/jenkins/jenkinsjob-regression-files/release-workflows/testManifestCommitLock_matchBuildManifest') | ||
def callStack = helper.getCallStack() | ||
assertCallStack().contains('stage(Parameters Check, groovy.lang.Closure)') | ||
assertCallStack().contains('stage(MATCH_BUILD_MANIFEST, groovy.lang.Closure)') | ||
} | ||
|
||
@Test | ||
public void testManifestCommitLock_matchBuildManifest_exception() { | ||
addParam('MANIFEST_LOCK_ACTION', 'MATCH_BUILD_MANIFEST') | ||
binding.setVariable('OPENSEARCH_RELEASE_CANDIDATE', '') | ||
binding.setVariable('OPENSEARCH_DASHBOARDS_RELEASE_CANDIDATE', '') | ||
Exception exception = assertThrows(Exception) { | ||
runScript('jenkins/release-workflows/release-manifest-commit-lock.jenkinsfile') | ||
} | ||
def callStack = helper.getCallStack() | ||
assertCallStack().contains('OPENSEARCH_RELEASE_CANDIDATE and/or OPENSEARCH_DASHBOARDS_RELEASE_CANDIDATE cannot be empty when MANIFEST_LOCK_ACTION is MATCH_BUILD_MANIFEST.') | ||
} | ||
|
||
@Test | ||
public void testManifestCommitLock_updateToRecentCommits() { | ||
addParam('MANIFEST_LOCK_ACTION', 'UPDATE_TO_RECENT_COMMITS') | ||
|
@@ -81,6 +96,8 @@ class TestReleaseManifestCommitLock extends BuildPipelineTest { | |
|
||
@Test | ||
public void testManifestCommitLock_createPullRequest() { | ||
addParam('OPENSEARCH_RELEASE_CANDIDATE', '3813') | ||
addParam('OPENSEARCH_DASHBOARDS_RELEASE_CANDIDATE', '3050') | ||
super.testPipeline('jenkins/release-workflows/release-manifest-commit-lock.jenkinsfile', | ||
'tests/jenkins/jenkinsjob-regression-files/release-workflows/testManifestCommitLock_createPullRequest') | ||
assertThat(getShellCommands('git'), hasItem("\n git remote set-url origin \"https://opensearch-ci:[email protected]/opensearch-project/opensearch-build\"\n git config user.email \"[email protected]\"\n git config user.name \"opensearch-ci\"\n git checkout -b manifest-lock\n ")) | ||
|
@@ -106,6 +123,8 @@ class TestReleaseManifestCommitLock extends BuildPipelineTest { | |
@Test | ||
public void testMatchBuildManifest() { | ||
addParam('MANIFEST_LOCK_ACTION', 'MATCH_BUILD_MANIFEST') | ||
addParam('OPENSEARCH_RELEASE_CANDIDATE', '3813') | ||
addParam('OPENSEARCH_DASHBOARDS_RELEASE_CANDIDATE', '3050') | ||
def buildManifest = "tests/jenkins/data/opensearch-2.0.0-build.yml" | ||
helper.registerAllowedMethod('readYaml', [Map.class], { args -> | ||
return new Yaml().load((buildManifest as File).text) | ||
|