Skip to content

Commit

Permalink
Remove unused components from old integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby committed Feb 2, 2023
1 parent 30b9416 commit e15f8fa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 78 deletions.
1 change: 0 additions & 1 deletion integration_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type IntegrationCLITestSuite struct {
pool dockertest.Pool
network dockertest.Network
headscale dockertest.Resource
env []string
}

func TestIntegrationCLITestSuite(t *testing.T) {
Expand Down
75 changes: 0 additions & 75 deletions integration_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"net/netip"
"os"
"strconv"
"strings"
"time"

v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
Expand Down Expand Up @@ -47,11 +46,6 @@ var (
}
)

type TestUser struct {
count int
tailscales map[string]dockertest.Resource
}

type ExecuteCommandConfig struct {
timeout time.Duration
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 == "" {
Expand Down
4 changes: 2 additions & 2 deletions integration_embedded_derp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit e15f8fa

Please sign in to comment.