From dcb1afc219e4c99f21c37fb1ec22ed9ffe443317 Mon Sep 17 00:00:00 2001 From: Luan Santos Date: Tue, 21 Nov 2017 14:16:22 -0800 Subject: [PATCH] skip psnotify tests when running in container [#152736258](https://www.pivotaltracker.com/story/show/152736258) --- bin/test-unit | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/test-unit b/bin/test-unit index 99f6b9bc2..a61fbf95c 100755 --- a/bin/test-unit +++ b/bin/test-unit @@ -1,11 +1,27 @@ #!/bin/bash +running_in_container() { + # look for a non-root cgroup + grep --quiet --invert-match ':/$' /proc/self/cgroup +} + main() { set -eu -o pipefail -x go install github.com/cloudfoundry/gosigar/vendor/github.com/onsi/ginkgo/ginkgo - ginkgo -p -r -randomizeAllSpecs -randomizeSuites -keepGoing -race -skipPackage=windows + skip_packages="" + + if running_in_container; then + set +x + skip_packages="$skip_packages,psnotify" + echo -e "\e[33mDetected running in container." + echo -e "Cannot run \e[1mpsnotify\e[21m suite because of socket syscall limitations." + echo -e "Skipping...\e[0m" + set -x + fi + + ginkgo -p -r -randomizeAllSpecs -randomizeSuites -keepGoing -race -skipPackage=$skip_packages } main "$@"