From 9187e4287ca30334662eabbbf096067d26fe438e Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 2 Feb 2023 10:36:07 +0100 Subject: [PATCH] Remove unused components from old integration tests Signed-off-by: Kristoffer Dalby --- integration_cli_test.go | 1 - integration_common_test.go | 75 ------------------------------- integration_embedded_derp_test.go | 4 +- 3 files changed, 2 insertions(+), 78 deletions(-) diff --git a/integration_cli_test.go b/integration_cli_test.go index d7dee90a..d6d32569 100644 --- a/integration_cli_test.go +++ b/integration_cli_test.go @@ -24,7 +24,6 @@ type IntegrationCLITestSuite struct { pool dockertest.Pool network dockertest.Network headscale dockertest.Resource - env []string } func TestIntegrationCLITestSuite(t *testing.T) { diff --git a/integration_common_test.go b/integration_common_test.go index 0abaae13..f23f6b2b 100644 --- a/integration_common_test.go +++ b/integration_common_test.go @@ -9,7 +9,6 @@ import ( "net/netip" "os" "strconv" - "strings" "time" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" @@ -47,11 +46,6 @@ var ( } ) -type TestUser struct { - count int - tailscales map[string]dockertest.Resource -} - type ExecuteCommandConfig struct { timeout time.Duration } @@ -201,38 +195,6 @@ func getDockerBuildOptions(version string) *dockertest.BuildOptions { return tailscaleBuildOptions } -func getIPs( - tailscales map[string]dockertest.Resource, -) (map[string][]netip.Addr, error) { - ips := make(map[string][]netip.Addr) - for hostname, tailscale := range tailscales { - command := []string{"tailscale", "ip"} - - result, _, err := ExecuteCommand( - &tailscale, - command, - []string{}, - ) - if err != nil { - return nil, err - } - - for _, address := range strings.Split(result, "\n") { - address = strings.TrimSuffix(address, "\n") - if len(address) < 1 { - continue - } - ip, err := netip.ParseAddr(address) - if err != nil { - return nil, err - } - ips[hostname] = append(ips[hostname], ip) - } - } - - return ips, nil -} - func getDNSNames( headscale *dockertest.Resource, ) ([]string, error) { @@ -266,43 +228,6 @@ func getDNSNames( return hostnames, nil } -func getMagicFQDN( - headscale *dockertest.Resource, -) ([]string, error) { - listAllResult, _, err := ExecuteCommand( - headscale, - []string{ - "headscale", - "nodes", - "list", - "--output", - "json", - }, - []string{}, - ) - if err != nil { - return nil, err - } - - var listAll []v1.Machine - err = json.Unmarshal([]byte(listAllResult), &listAll) - if err != nil { - return nil, err - } - - hostnames := make([]string, len(listAll)) - - for index := range listAll { - hostnames[index] = fmt.Sprintf( - "%s.%s.headscale.net", - listAll[index].GetGivenName(), - listAll[index].GetUser().GetName(), - ) - } - - return hostnames, nil -} - func GetEnvStr(key string) (string, error) { v := os.Getenv(key) if v == "" { diff --git a/integration_embedded_derp_test.go b/integration_embedded_derp_test.go index a099c098..57d6d810 100644 --- a/integration_embedded_derp_test.go +++ b/integration_embedded_derp_test.go @@ -382,7 +382,7 @@ func (s *IntegrationDERPTestSuite) saveLog( err = os.WriteFile( path.Join(basePath, resource.Container.Name+".stdout.log"), - []byte(stdout.String()), + stderr.Bytes(), 0o644, ) if err != nil { @@ -391,7 +391,7 @@ func (s *IntegrationDERPTestSuite) saveLog( err = os.WriteFile( path.Join(basePath, resource.Container.Name+".stderr.log"), - []byte(stdout.String()), + stderr.Bytes(), 0o644, ) if err != nil {