forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestOpenSearchReleasePromotionTest.groovy
168 lines (143 loc) · 11.4 KB
/
TestOpenSearchReleasePromotionTest.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import jenkins.tests.BuildPipelineTest
import org.junit.Before
import org.junit.Test
import org.yaml.snakeyaml.Yaml
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource
import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString
import static org.hamcrest.CoreMatchers.hasItem
import static org.hamcrest.MatcherAssert.assertThat
import static org.junit.jupiter.api.Assertions.assertThrows
class TestOpenSearchReleasePromotionTest extends BuildPipelineTest {
@Override
@Before
void setUp() {
helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('5.11.1')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)
super.setUp()
addParam('RELEASE_VERSION', '1.0.0')
addParam('OPENSEARCH_RC_BUILD_NUMBER', '2050')
addParam('OPENSEARCH_DASHBOARDS_RC_BUILD_NUMBER', '3050')
binding.setVariable('AGENT_LINUX_X64', 'Jenkins-Agent-AL2023-X64-C54xlarge-Docker-Host')
}
@Test
void shouldExecuteWithoutErrors() {
super.testPipeline('jenkins/promotion/release-promotion.jenkinsfile',
'tests/jenkins/jenkinsjob-regression-files/promotion/release-promotion.jenkinsfile')
def callStack = helper.getCallStack()
// Parameters Check
assertCallStack().contains('stage(Parameters Check, groovy.lang.Closure)')
// OpenSearch Debian Apt promotion
assertCallStack().contains('stage(OpenSearch Debian Apt promotion, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_REPO_TYPE, value=apt})")
// OpenSearch Yum promotion
assertCallStack().contains('stage(OpenSearch Yum promotion, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_REPO_TYPE, value=yum})")
// OpenSearch Dashboards Debian Apt promotion
assertCallStack().contains('stage(OpenSearch Dashboards Debian Apt promotion, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_REPO_TYPE, value=apt})")
// OpenSearch Dashboards Yum promotion
assertCallStack().contains('stage(OpenSearch Dashboards Yum promotion, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_REPO_TYPE, value=yum})")
// OpenSearch Windows promotion
assertCallStack().contains('stage(OpenSearch Windows promotion, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=windows})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=zip})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
// OpenSearch Dashboards Windows promotion
assertCallStack().contains('stage(OpenSearch Dashboards Windows promotion, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=windows})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=zip})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
// OpenSearch Linux deb arm64
assertCallStack().contains('stage(OpenSearch Linux deb arm64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=deb})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=arm64})")
// OpenSearch Linux deb x64
assertCallStack().contains('stage(OpenSearch Linux deb x64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=deb})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
// OpenSearch Dashboards Linux deb arm64
assertCallStack().contains('stage(OpenSearch Dashboards Linux deb arm64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=deb})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=arm64})")
// OpenSearch Dashboards Linux deb x64
assertCallStack().contains('stage(OpenSearch Dashboards Linux deb x64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=deb})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
assertCallStack().contains("release-promotion.string({name=DISTRIBUTION_BUILD_NUMBER, value=3050})")
// OpenSearch Linux rpm arm64
assertCallStack().contains('stage(OpenSearch Linux rpm arm64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=rpm})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=arm64})")
// OpenSearch Linux rpm x64
assertCallStack().contains('stage(OpenSearch Linux rpm x64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=rpm})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
// OpenSearch Dashboards Linux rpm arm64
assertCallStack().contains('stage(OpenSearch Dashboards Linux rpm arm64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=rpm})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=arm64})")
// OpenSearch Dashboards Linux rpm x64
assertCallStack().contains('stage(OpenSearch Dashboards Linux rpm x64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=rpm})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
// OpenSearch Linux tar arm64
assertCallStack().contains('stage(OpenSearch Linux tar arm64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=tar})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=arm64})")
// OpenSearch Linux tar x64
assertCallStack().contains('stage(OpenSearch Linux tar x64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=tar})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
// OpenSearch Dashboards Linux tar arm64
assertCallStack().contains('stage(OpenSearch Dashboards Linux tar arm64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=tar})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=arm64})")
// OpenSearch Dashboards Linux tar x64
assertCallStack().contains('stage(OpenSearch Dashboards Linux tar x64, groovy.lang.Closure)')
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_JOB_NAME, value=distribution-build-opensearch-dashboards})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_PLATFORM, value=linux})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_NAME, value=tar})")
assertCallStack().contains("release-promotion.choice({name=DISTRIBUTION_ARCHITECTURE, value=x64})")
}
}