@@ -205,27 +205,33 @@ jobs:
205205 # Run operator in DEV mode
206206 cd samples/joke
207207 # Need to override application.properties setting to avoid using dev services instead of set up cluster
208- nohup mvn quarkus:dev -Dquarkus.kubernetes-client.devservices.override-kubeconfig=false> app.log 2>&1 &
208+ mvn quarkus:dev -Dquarkus.kubernetes-client.devservices.override-kubeconfig=false > app.log 2>&1 &
209209 PID=$(echo $!)
210210 cd $CURRENT_PWD
211211
212+ ERROR=0
212213 # Wait until the app installed the jokerequest custom resource definition
213214 if ! $SCRIPTS/waitFor.sh crd $K8S_NAMESPACE jokerequests.samples.javaoperatorsdk.io; then
214- exit 1;
215+ echo "CRD not installed"
216+ ERROR=1
215217 fi
216218
217219 # test joke sample
218220 if ! $SCRIPTS/testJokeSample.sh $K8S_NAMESPACE; then
219- exit 1;
220- fi;
221-
222- echo "PID: $PID"
221+ echo "Failed to interact with operator"
222+ ERROR=1
223+ fi
223224
224- # Kill running process
225- kill -9 $PID
225+ # Kill all running java processes
226+ killall -9 java
226227
227228 # Delete namespace
228229 kubectl delete namespace $K8S_NAMESPACE
230+
231+ if [ ERROR = 1 ]; then
232+ echo "Tests failed"
233+ exit 1
234+ fi
229235
230236 - name : Archive Dev Mode application logs
231237 uses : actions/upload-artifact@v1
@@ -243,34 +249,40 @@ jobs:
243249 SCRIPTS=$(pwd)/.github/scripts
244250 K8S_NAMESPACE=native
245251 CURRENT_PWD=$(pwd)
246-
247- ps -aux | grep java
248252
249253 # Create and set namespace
250254 kubectl create namespace $K8S_NAMESPACE
251255 kubectl config set-context --current --namespace=$K8S_NAMESPACE
252256
253257 # Run operator in native mode
254258 cd samples/joke
255- nohup find . -type f -name '*-runner' -exec {} \; >native.log 2>&1 &
259+ find . -type f -name '*-runner' -exec {} \; >native.log 2>&1 &
256260 PID=$(echo $!)
257261 cd $CURRENT_PWD
258262
263+ ERROR=0
259264 # Wait until the app installed the jokerequest custom resource definition
260265 if ! $SCRIPTS/waitFor.sh crd $K8S_NAMESPACE jokerequests.samples.javaoperatorsdk.io; then
261- exit 1;
266+ echo "CRD not installed"
267+ ERROR=1
262268 fi
263269
264270 # test joke sample
265- if ! $SCRIPTS/testJokeSample.sh $K8S_NAMESPACE; then
266- exit 1;
267- fi;
268-
271+ if [ ERROR = 0 ] && ! $SCRIPTS/testJokeSample.sh $K8S_NAMESPACE; then
272+ echo "Failed to interact with operator"
273+ ERROR=1
274+ fi
275+
269276 # Kill running process
270277 kill -9 $PID
271278
272279 # Delete namespace
273280 kubectl delete namespace $K8S_NAMESPACE
281+
282+ if [ ERROR = 1 ]; then
283+ echo "Tests failed"
284+ exit 1
285+ fi
274286
275287 - name : Archive native application logs
276288 uses : actions/upload-artifact@v1
@@ -285,11 +297,13 @@ jobs:
285297
286298 # Install Joke operator
287299 if ! $SCRIPTS/installOperatorUsingOlm.sh joke $(pwd)/samples/joke $KIND_REGISTRY; then
300+ echo "Failed to install operator"
288301 exit 1;
289302 fi
290303
291304 # test joke sample
292305 if ! $SCRIPTS/testJokeSample.sh operators; then
306+ echo "Failed to interact with operator"
293307 exit 1;
294308 fi;
295309
@@ -299,11 +313,13 @@ jobs:
299313
300314 # Install Ping Pong operator
301315 if ! $SCRIPTS/installOperatorUsingOlm.sh pingpong $(pwd)/samples/pingpong $KIND_REGISTRY; then
316+ echo "Failed to install operator"
302317 exit 1;
303318 fi
304319
305320 # test joke sample
306321 if ! $SCRIPTS/testPingPongSample.sh operators; then
322+ echo "Failed to interact with operator"
307323 exit 1;
308324 fi
309325
0 commit comments