From f700246bfa6ebd59a483b7c037c47e34f47f2e02 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Tue, 21 Sep 2021 12:04:45 -0700 Subject: [PATCH] Allow focused integration tests to be run from the GoLand UI again This was broken recently by the improvements in #808. --- hack/integration-test-env-goland.sh | 2 ++ test/integration/main_test.go | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hack/integration-test-env-goland.sh b/hack/integration-test-env-goland.sh index 89885e2f..db2c0bc4 100755 --- a/hack/integration-test-env-goland.sh +++ b/hack/integration-test-env-goland.sh @@ -13,6 +13,8 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" source /tmp/integration-test-env +echo -n "PINNIPED_TEST_GOLAND_RUNNER=true;" + printenv | grep PINNIPED_TEST_ | sed 's/=.*//g' | grep -v CLUSTER_CAPABILITY_YAML | while read -r var ; do echo -n "${var}=" echo -n "${!var}" | tr -d '\n' diff --git a/test/integration/main_test.go b/test/integration/main_test.go index 6147da4c..6efc897b 100644 --- a/test/integration/main_test.go +++ b/test/integration/main_test.go @@ -14,7 +14,14 @@ import ( ) func TestMain(m *testing.M) { - splitIntegrationTestsIntoBuckets(m) + if os.Getenv("PINNIPED_TEST_GOLAND_RUNNER") != "true" { + // When running integration tests from inside GoLand, do not modify them. + // If the test gets nested under TestIntegrationSerial or the other groups, + // then you cannot run/debug a focused integration test in GoLand because the + // name of the test changes in a way that GoLand does not expect due to + // the nesting. + splitIntegrationTestsIntoBuckets(m) + } os.Exit(m.Run()) }