From c6f82c36463e5e66e9ced6190ad7875bc924b6de Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Tue, 18 Oct 2022 14:41:48 +0200 Subject: [PATCH] Switch from hacking buildtags to selecting tests Signed-off-by: Kristoffer Dalby --- Makefile | 8 ++++---- integration_cli_test.go | 4 +--- integration_common_test.go | 2 -- integration_embedded_derp_test.go | 4 +--- integration_general_test.go | 4 +--- integration_oidc_test.go | 4 +--- 6 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 12c42360..90ee5107 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ test_integration_cli: -v ~/.cache/hs-integration-go:/go \ -v $$PWD:$$PWD -w $$PWD \ -v /var/run/docker.sock:/var/run/docker.sock golang:1 \ - go test -failfast -tags integration_cli,integration -timeout 30m -count=1 ./... + go test -failfast -timeout 30m -count=1 -run IntegrationCLI ./... test_integration_derp: docker network rm $$(docker network ls --filter name=headscale --quiet) || true @@ -44,7 +44,7 @@ test_integration_derp: -v ~/.cache/hs-integration-go:/go \ -v $$PWD:$$PWD -w $$PWD \ -v /var/run/docker.sock:/var/run/docker.sock golang:1 \ - go test -failfast -tags integration_derp,integration -timeout 30m -count=1 ./... + go test -failfast -timeout 30m -count=1 -run IntegrationDERP ./... test_integration_general: docker network rm $$(docker network ls --filter name=headscale --quiet) || true @@ -54,7 +54,7 @@ test_integration_general: -v ~/.cache/hs-integration-go:/go \ -v $$PWD:$$PWD -w $$PWD \ -v /var/run/docker.sock:/var/run/docker.sock golang:1 \ - go test -failfast -tags integration_general,integration -timeout 30m -count=1 ./... + go test -failfast -timeout 30m -count=1 -run IntegrationGeneral ./... test_integration_oidc: docker network rm $$(docker network ls --filter name=headscale --quiet) || true @@ -64,7 +64,7 @@ test_integration_oidc: -v ~/.cache/hs-integration-go:/go \ -v $$PWD:$$PWD -w $$PWD \ -v /var/run/docker.sock:/var/run/docker.sock golang:1 \ - go test -failfast -tags integration_oidc,integration -timeout 30m -count=1 ./... + go test -failfast -timeout 30m -count=1 -run IntegrationOIDC ./... coverprofile_func: go tool cover -func=coverage.out diff --git a/integration_cli_test.go b/integration_cli_test.go index 0f5d69ad..dc854034 100644 --- a/integration_cli_test.go +++ b/integration_cli_test.go @@ -1,5 +1,3 @@ -//go:build integration_cli - package headscale import ( @@ -28,7 +26,7 @@ type IntegrationCLITestSuite struct { env []string } -func TestCLIIntegrationTestSuite(t *testing.T) { +func TestIntegrationCLITestSuite(t *testing.T) { s := new(IntegrationCLITestSuite) suite.Run(t, s) diff --git a/integration_common_test.go b/integration_common_test.go index 9fe435d6..4b931840 100644 --- a/integration_common_test.go +++ b/integration_common_test.go @@ -1,5 +1,3 @@ -//go:build integration - package headscale import ( diff --git a/integration_embedded_derp_test.go b/integration_embedded_derp_test.go index c83f6106..343a04ad 100644 --- a/integration_embedded_derp_test.go +++ b/integration_embedded_derp_test.go @@ -1,5 +1,3 @@ -//go:build integration_derp - package headscale import ( @@ -46,7 +44,7 @@ type IntegrationDERPTestSuite struct { joinWaitGroup sync.WaitGroup } -func TestDERPIntegrationTestSuite(t *testing.T) { +func TestIntegrationDERPTestSuite(t *testing.T) { saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG") if err != nil { saveLogs = false diff --git a/integration_general_test.go b/integration_general_test.go index 5b5abf07..8f318d32 100644 --- a/integration_general_test.go +++ b/integration_general_test.go @@ -1,5 +1,3 @@ -//go:build integration_general - package headscale import ( @@ -41,7 +39,7 @@ type IntegrationTestSuite struct { joinWaitGroup sync.WaitGroup } -func TestIntegrationTestSuite(t *testing.T) { +func TestIntegrationGeneralTestSuite(t *testing.T) { saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG") if err != nil { saveLogs = false diff --git a/integration_oidc_test.go b/integration_oidc_test.go index ba0b00f6..8e5f7910 100644 --- a/integration_oidc_test.go +++ b/integration_oidc_test.go @@ -1,5 +1,3 @@ -//go:build integration_oidc - package headscale import ( @@ -45,7 +43,7 @@ type IntegrationOIDCTestSuite struct { joinWaitGroup sync.WaitGroup } -func TestOIDCIntegrationTestSuite(t *testing.T) { +func TestIntegrationOIDCTestSuite(t *testing.T) { saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG") if err != nil { saveLogs = false