Skip to content

Commit ed9db7d

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

14 files changed

+486
-278
lines changed

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

-2
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

+103-1
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,53 @@ 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+
# Trigger the custom behaviour when it comes to
57+
# provision the server and push the imagestream.
58+
# Returns
59+
# 0 - false
60+
# 1 - true
61+
#
62+
function customProvisionServer() {
63+
echo 0
64+
}
65+
66+
# Provision server and push imagestream
67+
# The current directory is the quickstart directory
68+
#
69+
# Parameters
70+
# 1 - application name
71+
# 2 - quickstart dir
72+
#
73+
function provisionServer()
74+
{
75+
echo "Nothing to do in provisionServer()..."
76+
}
77+
78+
# Trigger a custom behaviour when it comes to
79+
# setting up the environment
80+
# Returns
81+
# 0 - false
82+
# 1 - true
83+
#
84+
function customDeploy() {
85+
echo 0
86+
}
87+
88+
# Set up the environment before testing
89+
# Parameters
90+
# 1 - application name
91+
#
92+
function deploy() {
93+
echo "Nothing to do in deploy()..."
94+
}
95+
5296
# Performs the 'helm install' command.
5397
# The current directory is the quickstart directory
5498
# Parameters
@@ -106,10 +150,68 @@ function helmInstallFailed() {
106150
echo ""
107151
}
108152

153+
# Trigger a custom behaviour when it comes to
154+
# forward ports
155+
# Returns
156+
# 0 - false
157+
# 1 - true
158+
#
159+
function customPortForward() {
160+
echo 0
161+
}
162+
163+
# Port forward to test the quickstart
164+
# Parameters
165+
# 1 - application name
166+
#
167+
function portForward() {
168+
echo "Nothing to do in portForward()..."
169+
}
170+
171+
# Trigger a custom behaviour when it comes to
172+
# running tests
173+
# Returns
174+
# 0 - false
175+
# 1 - true
176+
#
177+
function customRunningTests() {
178+
echo 0
179+
}
180+
181+
# Running tests of the quickstart
182+
# Parameters
183+
# 1 - application name
184+
# 2 - server protocol
185+
# 3 - extra maven argument for the verify target
186+
#
187+
function runningTests() {
188+
echo "Nothing to do in portForward()..."
189+
}
190+
191+
# Trigger a custom behaviour when it comes to
192+
# running tests
193+
# Returns
194+
# 0 - false
195+
# 1 - true
196+
#
197+
function customHelmUninstall() {
198+
echo 0
199+
}
200+
201+
# Performs the 'helm uninstall' command.
202+
# Parameters
203+
# 1 - application name
204+
#
205+
function helmUninstall() {
206+
application="${1}"
207+
208+
helm uninstall "${application}" --wait --timeout=10m0s
209+
}
210+
109211
# More output when the tests have failed
110212
# Parameters
111213
# 1 - application name
112214
#
113215
function testsFailed() {
114216
echo ""
115-
}
217+
}

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

+84-53
Original file line numberDiff line numberDiff line change
@@ -76,50 +76,69 @@ 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
86+
customProvisionServer=$(customProvisionServer)
87+
if [ "0" = "${customProvisionServer}" ]; then
88+
echo "Building application and provisioning server image..."
89+
mvn -B package -Popenshift wildfly:image -DskipTests
8790

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}
91+
echo "Tagging image and pushing to registry..."
92+
export root_image_name="localhost:5000/${application}"
93+
export image="${root_image_name}:latest"
94+
docker tag ${qs_dir} ${image}
95+
docker push ${image}
96+
else
97+
provisionServer "${application}" "${qs_dir}"
98+
fi
9399

94100
################################################################################################
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}"
97101

98-
additional_arguments="No additional arguments"
99-
if [ -n "${helm_set_arguments}" ]; then
100-
additional_arguments="Additional arguments: ${helm_set_arguments}"
102+
customDeploy=$(customDeploy)
103+
if [ "0" = "${customDeploy}" ]; then
104+
# Helm install, waiting for the pods to come up
105+
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}"
106+
107+
additional_arguments="No additional arguments"
108+
if [ -n "${helm_set_arguments}" ]; then
109+
additional_arguments="Additional arguments: ${helm_set_arguments}"
110+
fi
111+
112+
echo "Performing Helm install and waiting for completion.... (${additional_arguments})"
113+
# helmInstall is from overridable-functions.sh
114+
helm_install_ret=$(helmInstall "${application}" "${helm_set_arguments}")
115+
116+
# For some reason the above sometimes becomes a multi-line string. actual The exit code will be
117+
# on the last line
118+
helm_install_ret=$(echo "${helm_install_ret}"| tail -n 1)
119+
120+
echo "ret: ${helm_install_ret}"
121+
if [ "${helm_install_ret}" != "0" ]; then
122+
echo "Helm install failed!"
123+
echo "Dumping the application pod(s)"
124+
kubectl logs deployment/"${application}"
125+
helmInstallFailed
126+
fi
127+
else
128+
deploy
101129
fi
102130

103-
echo "Performing Helm install and waiting for completion.... (${additional_arguments})"
104-
# 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
131+
customPortForward=$(customPortForward)
132+
if [ "0" = "${customPortForward}" ]; then
133+
nohup kubectl port-forward service/${application} 8080:8080 > /dev/null 2>&1 &
134+
kubectl_fwd_pids=$!
135+
echo "Process ID of kubect port-forward: ${kubectl_fwd_pids}"
136+
else
137+
echo "Performing Port Forward and waiting for completion...."
138+
kubectl_fwd_pids=$(portForward "${application}")
139+
echo "Process ID(s) of kubect port-forward: ${kubectl_fwd_pids}"
117140
fi
118141

119-
kubectl port-forward service/${application} 8080:8080 &
120-
kubectl_fwd_pid=$!
121-
echo "Process ID of kubect port-forward: ${kubectl_fwd_pid}"
122-
123142
################################################################################################
124143
# Run any post install
125144
echo "Running post Helm install commands in $(pwd)"
@@ -130,35 +149,47 @@ runPostHelmInstallCommands
130149
echo "running the tests"
131150
pwd
132151

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
152+
customRunningTests=$(customRunningTests)
153+
if [ "0" = "${customRunningTests}" ]; then
154+
route="localhost:8080"
155+
156+
mvnVerifyArguments="-Dserver.host=${server_protocol}://${route} "
157+
extraMvnVerifyArguments="$(getMvnVerifyExtraArguments)"
158+
if [ -n "${extraMvnVerifyArguments}" ]; then
159+
mvnVerifyArguments="${mvnVerifyArguments} ${extraMvnVerifyArguments}"
160+
fi
161+
if [ "${QS_DEBUG_TESTS}" = "1" ]; then
162+
mvnVerifyArguments="${mvnVerifyArguments} -Dmaven.failsafe.debug=true"
163+
fi
164+
165+
echo "Verify Arguments: ${mvnVerifyArguments}"
166+
167+
mvn -B verify -Pintegration-testing ${mvnVerifyArguments}
168+
169+
if [ "$?" != "0" ]; then
170+
test_status=1
171+
echo "Tests failed!"
172+
echo "Dumping the application pod(s)"
173+
kubectl logs deployment/"${application}"
174+
testsFailed
175+
fi
176+
else
177+
runningTests "${application}" "${server_protocol}" "$(getMvnVerifyExtraArguments)"
178+
test_status=$?
154179
fi
155180

156-
kill -9 ${kubectl_fwd_pid}
181+
kill -9 ${kubectl_fwd_pids}
157182

158183
################################################################################################
159184
# Helm uninstall
160185
echo "Running Helm uninstall"
161-
helm uninstall "${application}" --wait --timeout=10m0s
186+
187+
customHelmUninstall=$(customHelmUninstall)
188+
if [ "0" = "${customHelmUninstall}" ]; then
189+
helm uninstall "${application}" --wait --timeout=10m0s
190+
else
191+
helmUninstall "${application}"
192+
fi
162193

163194
################################################################################################
164195
# Clean pre-requisites (cleanPrerequisites is fromm overridable-functions.sh)

0 commit comments

Comments
 (0)