From a2d1b88b8083f2828446eabfad181ea6f89fa3fe Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Wed, 3 Aug 2022 11:12:39 +0200 Subject: [PATCH] Fix variable for container name --- integration_cli_test.go | 16 +++++++++++++--- integration_embedded_derp_test.go | 18 ++++++++++++------ integration_test.go | 8 ++++++-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/integration_cli_test.go b/integration_cli_test.go index f9da4868..4d1192d5 100644 --- a/integration_cli_test.go +++ b/integration_cli_test.go @@ -19,6 +19,10 @@ import ( "github.com/stretchr/testify/suite" ) +const ( + headscaleCLIContainerName = "headscale-cli" +) + type IntegrationCLITestSuite struct { suite.Suite stats *suite.SuiteInformation @@ -65,7 +69,7 @@ func (s *IntegrationCLITestSuite) SetupTest() { } headscaleOptions := &dockertest.RunOptions{ - Name: "headscale-cli", + Name: headscaleCLIContainerName, Mounts: []string{ fmt.Sprintf("%s/integration_test/etc:/etc/headscale", currentPath), }, @@ -74,9 +78,15 @@ func (s *IntegrationCLITestSuite) SetupTest() { Platform: platform, } - err = s.pool.RemoveContainerByName(headscaleHostname) + err = s.pool.RemoveContainerByName(headscaleCLIContainerName) if err != nil { - s.FailNow(fmt.Sprintf("Could not remove existing container before building test: %s", err), "") + s.FailNow( + fmt.Sprintf( + "Could not remove existing container before building test: %s", + err, + ), + "", + ) } fmt.Println("Creating headscale container") diff --git a/integration_embedded_derp_test.go b/integration_embedded_derp_test.go index d77a677e..e207ea1c 100644 --- a/integration_embedded_derp_test.go +++ b/integration_embedded_derp_test.go @@ -29,9 +29,9 @@ import ( ) const ( - headscaleHostname = "headscale-derp" - namespaceName = "derpnamespace" - totalContainers = 3 + headscaleDerpContainerName = "headscale-derp" + namespaceName = "derpnamespace" + totalContainers = 3 ) type IntegrationDERPTestSuite struct { @@ -119,7 +119,7 @@ func (s *IntegrationDERPTestSuite) SetupSuite() { } headscaleOptions := &dockertest.RunOptions{ - Name: headscaleHostname, + Name: headscaleDerpContainerName, Mounts: []string{ fmt.Sprintf( "%s/integration_test/etc_embedded_derp:/etc/headscale", @@ -135,9 +135,15 @@ func (s *IntegrationDERPTestSuite) SetupSuite() { Platform: platform, } - err = s.pool.RemoveContainerByName(headscaleHostname) + err = s.pool.RemoveContainerByName(headscaleDerpContainerName) if err != nil { - s.FailNow(fmt.Sprintf("Could not remove existing container before building test: %s", err), "") + s.FailNow( + fmt.Sprintf( + "Could not remove existing container before building test: %s", + err, + ), + "", + ) } log.Println("Creating headscale container") diff --git a/integration_test.go b/integration_test.go index 0cdd3786..8d272b8d 100644 --- a/integration_test.go +++ b/integration_test.go @@ -1,4 +1,4 @@ -//go:build integration +s/go:build integration // +build integration package headscale @@ -30,6 +30,10 @@ import ( "tailscale.com/ipn/ipnstate" ) +const ( + headscaleContainerName = "headscale" +) + type IntegrationTestSuite struct { suite.Suite stats *suite.SuiteInformation @@ -252,7 +256,7 @@ func (s *IntegrationTestSuite) SetupSuite() { Platform: platform, } - err = s.pool.RemoveContainerByName(headscaleHostname) + err = s.pool.RemoveContainerByName(headscaleContainerName) if err != nil { s.FailNow(fmt.Sprintf("Could not remove existing container before building test: %s", err), "") }