9
9
#
10
10
# Parameters
11
11
# 1 - the name of the qs directory (not the full path)
12
+ #
12
13
function applicationName() {
13
14
echo " ${1} "
14
15
}
@@ -20,6 +21,7 @@ function applicationName() {
20
21
#
21
22
# Parameters
22
23
# 1 - the name of the qs directory
24
+ #
23
25
function namespace() {
24
26
application=" ${1} "
25
27
# Uncomment to make the tests run in the 'testing' namespace
@@ -32,6 +34,7 @@ function namespace() {
32
34
#
33
35
# Parameters
34
36
# 1 - application name
37
+ #
35
38
function installPrerequisites()
36
39
{
37
40
application=" ${1} "
@@ -43,12 +46,35 @@ function installPrerequisites()
43
46
#
44
47
# Parameters
45
48
# 1 - application name
49
+ #
46
50
function cleanPrerequisites()
47
51
{
48
52
application=" ${1} "
49
53
echo " No prerequisites to clean for ${application} "
50
54
}
51
55
56
+ # Provision server and push imagestream
57
+ # The current directory is the quickstart directory
58
+ #
59
+ # Parameters
60
+ # 1 - application name
61
+ # 2 - quickstart dir
62
+ #
63
+ function provisionServer()
64
+ {
65
+ application=" ${1} "
66
+ qs_dir=" ${2} "
67
+
68
+ echo " Building application and provisioning server image..."
69
+ mvn -B package -Popenshift wildfly:image -DskipTests
70
+
71
+ echo " Tagging image and pushing to registry..."
72
+ export root_image_name=" localhost:5000/${application} "
73
+ export image=" ${root_image_name} :latest"
74
+ docker tag ${qs_dir} ${image}
75
+ docker push ${image}
76
+ }
77
+
52
78
# Performs the 'helm install' command.
53
79
# The current directory is the quickstart directory
54
80
# Parameters
@@ -61,15 +87,33 @@ function cleanPrerequisites()
61
87
# * helm_install_timeout - the adjusted timeout for the helm install
62
88
#
63
89
function helmInstall() {
64
- application=" ${1} "
65
- helm_set_arguments=" $2 "
66
-
67
- # '--wait' waits until the pods are ready
68
- # `--timeout` sets the timeout for the wait.
69
- # https://helm.sh/docs/helm/helm_install/ has more details
70
- # Don't quote ${helm_set_arguments} since then it fails when there are none
71
- helm install " ${application} " wildfly/wildfly -f charts/helm.yaml --wait --timeout=${helm_install_timeout} ${helm_set_arguments}
72
- echo " $? "
90
+ application=" ${1} "
91
+ helm_set_arg_prefix=" ${2} "
92
+ helm_install_timeout=" ${3} "
93
+
94
+ # Helm install, waiting for the pods to come up
95
+ helm_set_arguments=" --set ${helm_set_arg_prefix} build.enabled=false --set ${helm_set_arg_prefix} deploy.route.enabled=false --set ${helm_set_arg_prefix} image.name=${root_image_name} "
96
+
97
+ additional_arguments=" No additional arguments"
98
+ if [ -n " ${helm_set_arguments} " ]; then
99
+ additional_arguments=" Additional arguments: ${helm_set_arguments} "
100
+ fi
101
+
102
+ echo " Performing Helm install and waiting for completion.... (${additional_arguments} )"
103
+
104
+ # '--wait' waits until the pods are ready
105
+ # `--timeout` sets the timeout for the wait.
106
+ # https://helm.sh/docs/helm/helm_install/ has more details
107
+ # Don't quote ${helm_set_arguments} since then it fails when there are none
108
+ helm install " ${application} " wildfly/wildfly -f charts/helm.yaml --wait --timeout=${helm_install_timeout} ${helm_set_arguments}
109
+
110
+ echo " ret: $? "
111
+ if [ " $? " != " 0" ]; then
112
+ echo " Helm install failed!"
113
+ echo " Dumping the application pod(s)"
114
+ kubectl logs deployment/" ${application} "
115
+ helmInstallFailed
116
+ fi
73
117
}
74
118
75
119
# Commands to run once the Helm install has completed
@@ -106,10 +150,70 @@ function helmInstallFailed() {
106
150
echo " "
107
151
}
108
152
153
+ # Port forward to test the quickstart
154
+ # Parameters
155
+ # 1 - application name
156
+ #
157
+ function portForward() {
158
+ application=" ${1} "
159
+
160
+ kubectl port-forward service/${application} 8080:8080 &
161
+ kubectl_fwd_pid=$!
162
+ echo " ${kubectl_fwd_pid} "
163
+ }
164
+
165
+ # Running tests of the quickstart
166
+ # Parameters
167
+ # 1 - application name
168
+ # 2 - server protocol
169
+ # 3 - extra maven argument for the verify target
170
+ #
171
+ function runningTests() {
172
+ application=" ${1} "
173
+ server_protocol=" ${2} "
174
+ extraMvnVerifyArguments=" ${3} "
175
+
176
+ route=" localhost:8080"
177
+
178
+ mvnVerifyArguments=" -Dserver.host=${server_protocol} ://${route} "
179
+ if [ -n " ${extraMvnVerifyArguments} " ]; then
180
+ mvnVerifyArguments=" ${mvnVerifyArguments} ${extraMvnVerifyArguments} "
181
+ fi
182
+ if [ " ${QS_DEBUG_TESTS} " = " 1" ]; then
183
+ mvnVerifyArguments=" ${mvnVerifyArguments} -Dmaven.failsafe.debug=true"
184
+ fi
185
+
186
+ echo " Verify Arguments: ${mvnVerifyArguments} "
187
+
188
+ mvn -B verify -Pintegration-testing ${mvnVerifyArguments}
189
+
190
+ test_status=" $? "
191
+
192
+ if [ " $? " != " 0" ]; then
193
+ test_status=1
194
+ echo " Tests failed!"
195
+ echo " Dumping the application pod(s)"
196
+ kubectl logs deployment/" ${application} "
197
+ testsFailed
198
+ fi
199
+
200
+ echo " ${test_status} "
201
+ }
202
+
203
+ # Performs the 'helm uninstall' command.
204
+ # Parameters
205
+ # 1 - application name
206
+ #
207
+ function helmUninstall() {
208
+ application=" ${1} "
209
+
210
+ helm uninstall " ${application} " --wait --timeout=10m0s
211
+ }
212
+
109
213
# More output when the tests have failed
110
214
# Parameters
111
215
# 1 - application name
112
216
#
113
217
function testsFailed() {
114
218
echo " "
115
- }
219
+ }
0 commit comments