Skip to content

Commit f07ad29

Browse files
committed
Fix cleanup function after all tests. Clear images between test runs.
Cleanup function wasn't properly cleaning all the folders after test run. This resulted in unstaged changes after running tests. One of the cleaning parts were not in the for each loop by mistake. Adds clearing code for container images that normally would stay between test runs and would result in the possibility of tests reusing the image from previous test. Fixes: sclorg#557
1 parent 9ef88c8 commit f07ad29

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/run

+14-3
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,22 @@ function test_from_dockerfile_s2i() {
159159
}
160160

161161
app_cleanup() {
162+
info "Cleaning up the test app folders"
162163
for server in ${WEB_SERVERS[*]}; do
163-
if [ ! -z "${server}" ]; then
164+
if [[ "${server}" == "db" ]]; then
165+
echo "Removing ${test_dir}/db-test-app"
166+
rm -rf ${test_dir}/db-test-app
167+
elif [ ! -z "${server}" ]; then
168+
echo "Removing ${test_dir}/${server}-test-app/.git"
164169
rm -rf ${test_dir}/${server}-test-app/.git
165170
fi
166171
done
167-
if [[ "${server}" == "db" ]]; then
168-
rm -rf ${test_dir}/db-test-app
172+
}
173+
174+
function cleanup() {
175+
info "Cleaning up the test application image ${IMAGE_NAME}-testapp"
176+
if image_exists ${IMAGE_NAME}-testapp; then
177+
docker rmi -f ${IMAGE_NAME}-testapp
169178
fi
170179
}
171180

@@ -223,6 +232,8 @@ for server in ${WEB_SERVERS[@]}; do
223232
evaluate_build_result $? "$server" || continue
224233

225234
TEST_SET=${TESTS:-$TEST_LIST} ct_run_tests_from_testset "$server"
235+
236+
cleanup
226237
done
227238

228239
TEST_LIST="test_from_dockerfile test_from_dockerfile_s2i"

0 commit comments

Comments
 (0)