Skip to content

Commit f1d722a

Browse files
committed
[WFLY-19337] The GitHub Action to test ejb-txn-remote-call is now working
1 parent c808441 commit f1d722a

File tree

14 files changed

+448
-276
lines changed

14 files changed

+448
-276
lines changed

.github/workflows/scripts/kubernetes/core/excluded-directories.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
# microprofile-reactive-messaging-kafka
44
# Can't connect to server... I see something relating to adding a user in the README but nothing in the OpenShift tests about this so it is odd
55
ejb-remote
6-
# Some problems once the operator is installed. I haven't been able to get my go environment set up to the same version
7-
ejb-txn-remote-call
86

.github/workflows/scripts/kubernetes/core/overridable-functions.sh

Lines changed: 114 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#
1010
# Parameters
1111
# 1 - the name of the qs directory (not the full path)
12+
#
1213
function applicationName() {
1314
echo "${1}"
1415
}
@@ -20,6 +21,7 @@ function applicationName() {
2021
#
2122
# Parameters
2223
# 1 - the name of the qs directory
24+
#
2325
function namespace() {
2426
application="${1}"
2527
# Uncomment to make the tests run in the 'testing' namespace
@@ -32,6 +34,7 @@ function namespace() {
3234
#
3335
# Parameters
3436
# 1 - application name
37+
#
3538
function installPrerequisites()
3639
{
3740
application="${1}"
@@ -43,12 +46,35 @@ function installPrerequisites()
4346
#
4447
# Parameters
4548
# 1 - application name
49+
#
4650
function cleanPrerequisites()
4751
{
4852
application="${1}"
4953
echo "No prerequisites to clean for ${application}"
5054
}
5155

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+
5278
# Performs the 'helm install' command.
5379
# The current directory is the quickstart directory
5480
# Parameters
@@ -61,15 +87,33 @@ function cleanPrerequisites()
6187
# * helm_install_timeout - the adjusted timeout for the helm install
6288
#
6389
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
73117
}
74118

75119
# Commands to run once the Helm install has completed
@@ -106,10 +150,70 @@ function helmInstallFailed() {
106150
echo ""
107151
}
108152

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+
109213
# More output when the tests have failed
110214
# Parameters
111215
# 1 - application name
112216
#
113217
function testsFailed() {
114218
echo ""
115-
}
219+
}

.github/workflows/scripts/kubernetes/core/run-quickstart-test-on-kubernetes.sh

Lines changed: 11 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -76,49 +76,23 @@ fi
7676

7777
################################################################################################
7878
# Install any pre-requisites. Function is from overridable-functions.sh
79+
7980
echo "Checking if we need to install pre-requisites"
8081
installPrerequisites "${application}"
8182

8283
################################################################################################
8384
# Provision server and push imagestream
8485

85-
echo "Building application and provisioning server image..."
86-
mvn -B package -Popenshift wildfly:image -DskipTests
87-
88-
echo "Tagging image and pushing to registry..."
89-
export root_image_name="localhost:5000/${application}"
90-
export image="${root_image_name}:latest"
91-
docker tag ${qs_dir} ${image}
92-
docker push ${image}
86+
provisionServer "${application}" "${qs_dir}"
9387

9488
################################################################################################
95-
# Helm install, waiting for the pods to come up
96-
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}"
97-
98-
additional_arguments="No additional arguments"
99-
if [ -n "${helm_set_arguments}" ]; then
100-
additional_arguments="Additional arguments: ${helm_set_arguments}"
101-
fi
10289

103-
echo "Performing Helm install and waiting for completion.... (${additional_arguments})"
10490
# helmInstall is from overridable-functions.sh
105-
helm_install_ret=$(helmInstall "${application}" "${helm_set_arguments}")
106-
107-
# For some reason the above sometimes becomes a multi-line string. actual The exit code will be
108-
# on the last line
109-
helm_install_ret=$(echo "${helm_install_ret}"| tail -n 1)
110-
111-
echo "ret: ${helm_install_ret}"
112-
if [ "${helm_install_ret}" != "0" ]; then
113-
echo "Helm install failed!"
114-
echo "Dumping the application pod(s)"
115-
kubectl logs deployment/"${application}"
116-
helmInstallFailed
117-
fi
91+
helmInstall "${application}" "${helm_set_arg_prefix}" "${helm_install_timeout}"
11892

119-
kubectl port-forward service/${application} 8080:8080 &
120-
kubectl_fwd_pid=$!
121-
echo "Process ID of kubect port-forward: ${kubectl_fwd_pid}"
93+
echo "Performing Port Forward and waiting for completion...."
94+
kubectl_fwd_pids=$(portForward "${application}")
95+
echo "Process ID(s) of kubect port-forward: ${kubectl_fwd_pids}"
12296

12397
################################################################################################
12498
# Run any post install
@@ -130,35 +104,15 @@ runPostHelmInstallCommands
130104
echo "running the tests"
131105
pwd
132106

133-
route="localhost:8080"
134-
135-
mvnVerifyArguments="-Dserver.host=${server_protocol}://${route} "
136-
extraMvnVerifyArguments="$(getMvnVerifyExtraArguments)"
137-
if [ -n "${extraMvnVerifyArguments}" ]; then
138-
mvnVerifyArguments="${mvnVerifyArguments} ${extraMvnVerifyArguments}"
139-
fi
140-
if [ "${QS_DEBUG_TESTS}" = "1" ]; then
141-
mvnVerifyArguments="${mvnVerifyArguments} -Dmaven.failsafe.debug=true"
142-
fi
143-
144-
echo "Verify Arguments: ${mvnVerifyArguments}"
145-
146-
mvn -B verify -Pintegration-testing ${mvnVerifyArguments}
147-
148-
if [ "$?" != "0" ]; then
149-
test_status=1
150-
echo "Tests failed!"
151-
echo "Dumping the application pod(s)"
152-
kubectl logs deployment/"${application}"
153-
testsFailed
154-
fi
107+
runningTests "${application}" "${server_protocol}" "$(getMvnVerifyExtraArguments)"
108+
test_status=$?
155109

156-
kill -9 ${kubectl_fwd_pid}
110+
kill -9 ${kubectl_fwd_pids}
157111

158112
################################################################################################
159113
# Helm uninstall
160114
echo "Running Helm uninstall"
161-
helm uninstall "${application}" --wait --timeout=10m0s
115+
helmUninstall "${application}"
162116

163117
################################################################################################
164118
# Clean pre-requisites (cleanPrerequisites is fromm overridable-functions.sh)
@@ -187,4 +141,4 @@ end=$SECONDS
187141
duration=$((end - start))
188142
echo "${application} tests run in $(($duration / 60))m$(($duration % 60))s."
189143

190-
exit ${test_status}
144+
exit ${test_status}

0 commit comments

Comments
 (0)