docker: make sure to cleanup containers before force exit
Observed containers were being left over on the host machine when
docker tests were terminated mid way. Due to this, host machine was not
able to run anymore containers after a certain threshold of running
containers and eventually runs out of available memory. Fix this issue
by always cleaning the containers when exiting from the tests.
diff --git a/test/docker/run.sh b/test/docker/run.sh
index ef6f771..5b1894d 100755
@@ -85,8 +85,7 @@
usage "$MISSING, did you forget --events-plugin-jar?"
[ -n "$GERRIT_WAR" ] && cp -f -- "$GERRIT_WAR" "$ARTIFACTS/gerrit.war"
-progress "Building docker images" build_images
-run_events_plugin_tests ; RESULT=$?
+( trap cleanup EXIT SIGTERM
+ progress "Building docker images" build_images