forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestGetManifestSHA.groovy
59 lines (48 loc) · 1.56 KB
/
TestGetManifestSHA.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* 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.
*/
package jenkins.tests
import org.junit.*
import java.util.*
class TestGetManifestSHA extends BuildPipelineTest {
@Override
@Before
void setUp() {
super.setUp()
binding.setVariable('JOB_NAME', 'get-manifest-sha-build')
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'account')
binding.setVariable('ARTIFACT_BUCKET_NAME', 'artifact-bucket')
helper.registerAllowedMethod("sha1", [String], { filename ->
return 'sha1'
})
helper.registerAllowedMethod("withAWS", [Map, Closure], { args, closure ->
closure.delegate = delegate
return helper.callClosure(closure)
})
helper.registerAllowedMethod("git", [Map])
}
@Test
public void testExists() {
helper.registerAllowedMethod("s3DoesObjectExist", [Map], { args ->
return true
})
super.testPipeline(
"tests/jenkins/jobs/GetManifestSHA_Jenkinsfile",
"tests/jenkins/jobs/GetManifestSHA_Jenkinsfile_exists"
)
}
@Test
public void testDoesNotExist() {
helper.registerAllowedMethod("s3DoesObjectExist", [Map], { args ->
return false
})
super.testPipeline(
"tests/jenkins/jobs/GetManifestSHA_Jenkinsfile",
"tests/jenkins/jobs/GetManifestSHA_Jenkinsfile_does_not_exist"
)
}
}