Fix variable for container name

This commit is contained in:
Kristoffer Dalby 2022-08-03 11:12:39 +02:00
parent c0846978ed
commit a2d1b88b80
3 changed files with 31 additions and 11 deletions

View file

@ -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")

View file

@ -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")

View file

@ -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), "")
}