1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-12-20 19:09:07 +01:00

Switch from hacking buildtags to selecting tests

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2022-10-18 14:41:48 +02:00
parent 32c21a05f8
commit c6f82c3646
No known key found for this signature in database
6 changed files with 8 additions and 18 deletions

View File

@ -34,7 +34,7 @@ test_integration_cli:
-v ~/.cache/hs-integration-go:/go \ -v ~/.cache/hs-integration-go:/go \
-v $$PWD:$$PWD -w $$PWD \ -v $$PWD:$$PWD -w $$PWD \
-v /var/run/docker.sock:/var/run/docker.sock golang:1 \ -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: test_integration_derp:
docker network rm $$(docker network ls --filter name=headscale --quiet) || true 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 ~/.cache/hs-integration-go:/go \
-v $$PWD:$$PWD -w $$PWD \ -v $$PWD:$$PWD -w $$PWD \
-v /var/run/docker.sock:/var/run/docker.sock golang:1 \ -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: test_integration_general:
docker network rm $$(docker network ls --filter name=headscale --quiet) || true 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 ~/.cache/hs-integration-go:/go \
-v $$PWD:$$PWD -w $$PWD \ -v $$PWD:$$PWD -w $$PWD \
-v /var/run/docker.sock:/var/run/docker.sock golang:1 \ -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: test_integration_oidc:
docker network rm $$(docker network ls --filter name=headscale --quiet) || true 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 ~/.cache/hs-integration-go:/go \
-v $$PWD:$$PWD -w $$PWD \ -v $$PWD:$$PWD -w $$PWD \
-v /var/run/docker.sock:/var/run/docker.sock golang:1 \ -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: coverprofile_func:
go tool cover -func=coverage.out go tool cover -func=coverage.out

View File

@ -1,5 +1,3 @@
//go:build integration_cli
package headscale package headscale
import ( import (
@ -28,7 +26,7 @@ type IntegrationCLITestSuite struct {
env []string env []string
} }
func TestCLIIntegrationTestSuite(t *testing.T) { func TestIntegrationCLITestSuite(t *testing.T) {
s := new(IntegrationCLITestSuite) s := new(IntegrationCLITestSuite)
suite.Run(t, s) suite.Run(t, s)

View File

@ -1,5 +1,3 @@
//go:build integration
package headscale package headscale
import ( import (

View File

@ -1,5 +1,3 @@
//go:build integration_derp
package headscale package headscale
import ( import (
@ -46,7 +44,7 @@ type IntegrationDERPTestSuite struct {
joinWaitGroup sync.WaitGroup joinWaitGroup sync.WaitGroup
} }
func TestDERPIntegrationTestSuite(t *testing.T) { func TestIntegrationDERPTestSuite(t *testing.T) {
saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG") saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG")
if err != nil { if err != nil {
saveLogs = false saveLogs = false

View File

@ -1,5 +1,3 @@
//go:build integration_general
package headscale package headscale
import ( import (
@ -41,7 +39,7 @@ type IntegrationTestSuite struct {
joinWaitGroup sync.WaitGroup joinWaitGroup sync.WaitGroup
} }
func TestIntegrationTestSuite(t *testing.T) { func TestIntegrationGeneralTestSuite(t *testing.T) {
saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG") saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG")
if err != nil { if err != nil {
saveLogs = false saveLogs = false

View File

@ -1,5 +1,3 @@
//go:build integration_oidc
package headscale package headscale
import ( import (
@ -45,7 +43,7 @@ type IntegrationOIDCTestSuite struct {
joinWaitGroup sync.WaitGroup joinWaitGroup sync.WaitGroup
} }
func TestOIDCIntegrationTestSuite(t *testing.T) { func TestIntegrationOIDCTestSuite(t *testing.T) {
saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG") saveLogs, err := GetEnvBool("HEADSCALE_INTEGRATION_SAVE_LOG")
if err != nil { if err != nil {
saveLogs = false saveLogs = false