Try to reduce flakiness. (#88)
This PR also does the following:
- Only print log when tests fails, otherwise the log cannot fully show
in Buildkite UI.
- Still print deleting image error.
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index 4e6f09c..fc4c73e 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -19,7 +19,7 @@
- "//container/ubuntu16_04/builders/bazel:bazel-test"
- "//container/ubuntu16_04/builders/bazel:bazel_docker-test"
test_flags:
- - "--test_output=all"
+ - "--test_output=errors"
ubuntu1604:
test_targets:
- "//test/configs:debian-jessie-autoconfig_test"
@@ -39,4 +39,4 @@
- "//container/ubuntu16_04/builders/bazel:bazel-test"
- "//container/ubuntu16_04/builders/bazel:bazel_docker-test"
test_flags:
- - "--test_output=all"
+ - "--test_output=errors"
diff --git a/test/configs/autoconfig_test.sh b/test/configs/autoconfig_test.sh
index d0412eb..0d6fd21 100755
--- a/test/configs/autoconfig_test.sh
+++ b/test/configs/autoconfig_test.sh
@@ -41,15 +41,16 @@
do
echo "Attempting to delete ${image}..."
# Only delete the image if it is not used by any running container.
+ # Do not return error code if unable to delete.
if [[ -z $(docker ps -q -f ancestor=${image}) ]]; then
- docker rmi -f ${image} 2>/dev/null
+ docker rmi -f ${image} | true
echo "${image} deleted..."
else
echo "${image} is used by another container, not deleted..."
fi
done
echo "Deleting all dangling images..."
- docker images -f "dangling=true" -q | xargs -r docker rmi -f 2>/dev/null
+ docker images -f "dangling=true" -q | xargs -r docker rmi -f | true
}
trap cleanup_on_finish EXIT # always delete the containers
diff --git a/test/configs/debian8_clang_autoconfig_test.sh b/test/configs/debian8_clang_autoconfig_test.sh
index b3241f3..f01904c 100755
--- a/test/configs/debian8_clang_autoconfig_test.sh
+++ b/test/configs/debian8_clang_autoconfig_test.sh
@@ -38,15 +38,16 @@
do
echo "Attempting to delete ${image}..."
# Only delete the image if it is not used by any running container.
+ # Do not return error code if unable to delete.
if [[ -z $(docker ps -q -f ancestor=${image}) ]]; then
- docker rmi -f ${image} 2>/dev/null
+ docker rmi -f ${image} | true
echo "${image} deleted..."
else
echo "${image} is used by another container, not deleted..."
fi
done
echo "Deleting all dangling images..."
- docker images -f "dangling=true" -q | xargs -r docker rmi -f 2>/dev/null
+ docker images -f "dangling=true" -q | xargs -r docker rmi -f | true
}
trap cleanup_on_finish EXIT # always delete the containers