From 065929ffd0d19745a57dc19ee7a5927f1c72e904 Mon Sep 17 00:00:00 2001 From: Sharif Elgamal Date: Tue, 29 Jun 2021 09:22:42 -0700 Subject: [PATCH 1/3] try less parallelization for macOS tests --- hack/jenkins/osx_integration_tests_docker.sh | 9 +-------- hack/jenkins/osx_integration_tests_hyperkit.sh | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/hack/jenkins/osx_integration_tests_docker.sh b/hack/jenkins/osx_integration_tests_docker.sh index da32f9d446..db96d54c41 100755 --- a/hack/jenkins/osx_integration_tests_docker.sh +++ b/hack/jenkins/osx_integration_tests_docker.sh @@ -30,17 +30,10 @@ ARCH="amd64" OS="darwin" DRIVER="docker" JOB_NAME="Docker_macOS" -EXTRA_TEST_ARGS="" +EXTRA_TEST_ARGS="-test.parallel=2" EXPECTED_DEFAULT_DRIVER="docker" EXTERNAL="yes" -# fix mac os as a service on mac os -# https://github.com/docker/for-mac/issues/882#issuecomment-506372814 -#osascript -e 'quit app "Docker"' -#/Applications/Docker.app/Contents/MacOS/Docker --quit-after-install --unattended || true -#osascript -e 'quit app "Docker"' -#/Applications/Docker.app/Contents/MacOS/Docker --unattended & - begin=$(date +%s) while [ -z "$(docker info 2> /dev/null )" ]; do diff --git a/hack/jenkins/osx_integration_tests_hyperkit.sh b/hack/jenkins/osx_integration_tests_hyperkit.sh index f1acffbdef..33b561909f 100755 --- a/hack/jenkins/osx_integration_tests_hyperkit.sh +++ b/hack/jenkins/osx_integration_tests_hyperkit.sh @@ -30,7 +30,7 @@ ARCH="amd64" OS="darwin" DRIVER="hyperkit" JOB_NAME="Hyperkit_macOS" -EXTRA_TEST_ARGS="" +EXTRA_TEST_ARGS="-test.parallel=2" EXPECTED_DEFAULT_DRIVER="hyperkit" EXTERNAL="yes" From 73e42a9a8c52916c2d336a7744687e02913baad0 Mon Sep 17 00:00:00 2001 From: Sharif Elgamal Date: Tue, 29 Jun 2021 11:46:38 -0700 Subject: [PATCH 2/3] change parallelization in code --- hack/jenkins/osx_integration_tests_docker.sh | 2 +- hack/jenkins/osx_integration_tests_hyperkit.sh | 2 +- test/integration/main_test.go | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hack/jenkins/osx_integration_tests_docker.sh b/hack/jenkins/osx_integration_tests_docker.sh index db96d54c41..3635553cb5 100755 --- a/hack/jenkins/osx_integration_tests_docker.sh +++ b/hack/jenkins/osx_integration_tests_docker.sh @@ -30,7 +30,7 @@ ARCH="amd64" OS="darwin" DRIVER="docker" JOB_NAME="Docker_macOS" -EXTRA_TEST_ARGS="-test.parallel=2" +EXTRA_TEST_ARGS="" EXPECTED_DEFAULT_DRIVER="docker" EXTERNAL="yes" diff --git a/hack/jenkins/osx_integration_tests_hyperkit.sh b/hack/jenkins/osx_integration_tests_hyperkit.sh index 33b561909f..f1acffbdef 100755 --- a/hack/jenkins/osx_integration_tests_hyperkit.sh +++ b/hack/jenkins/osx_integration_tests_hyperkit.sh @@ -30,7 +30,7 @@ ARCH="amd64" OS="darwin" DRIVER="hyperkit" JOB_NAME="Hyperkit_macOS" -EXTRA_TEST_ARGS="-test.parallel=2" +EXTRA_TEST_ARGS="" EXPECTED_DEFAULT_DRIVER="hyperkit" EXTERNAL="yes" diff --git a/test/integration/main_test.go b/test/integration/main_test.go index 3e1003df0b..d105754a58 100644 --- a/test/integration/main_test.go +++ b/test/integration/main_test.go @@ -97,6 +97,11 @@ func setMaxParallelism() { // Each "minikube start" consumes up to 2 cores, though the average usage is somewhat lower limit := int(math.Floor(float64(maxp) / 1.75)) + // cut the number of parallel tests in half for macOS + if runtime.GOOS == "darwin" && limit > 2 { + limit /= 2 + } + fmt.Fprintf(os.Stderr, "Found %d cores, limiting parallelism with --test.parallel=%d\n", maxp, limit) if err := flag.Set("test.parallel", strconv.Itoa(limit)); err != nil { fmt.Fprintf(os.Stderr, "Unable to set test.parallel: %v\n", err) From 045411ea5723542f0df081fc2615e46a5ccd90f6 Mon Sep 17 00:00:00 2001 From: Sharif Elgamal Date: Tue, 29 Jun 2021 16:39:41 -0700 Subject: [PATCH 3/3] hardcode to 2 --- test/integration/main_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/integration/main_test.go b/test/integration/main_test.go index 50e4355f01..c259933bef 100644 --- a/test/integration/main_test.go +++ b/test/integration/main_test.go @@ -98,10 +98,15 @@ func setMaxParallelism() { limit := int(math.Floor(float64(maxp) / 1.75)) // Windows and MacOS tests were failing from timeouts due to too much parallelism - if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { + if runtime.GOOS == "windows" { limit /= 2 } + // Hardcode limit to 2 for macOS + if runtime.GOOS == "darwin" { + limit = 2 + } + fmt.Fprintf(os.Stderr, "Found %d cores, limiting parallelism with --test.parallel=%d\n", maxp, limit) if err := flag.Set("test.parallel", strconv.Itoa(limit)); err != nil { fmt.Fprintf(os.Stderr, "Unable to set test.parallel: %v\n", err)