Remove unused components from old integration tests

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2023-02-02 10:36:07 +01:00 committed by Kristoffer Dalby
parent 2b7bcb77a5
commit 9187e4287c
3 changed files with 2 additions and 78 deletions

View File

@ -24,7 +24,6 @@ type IntegrationCLITestSuite struct {
pool dockertest.Pool
network dockertest.Network
headscale dockertest.Resource
env []string
}
func TestIntegrationCLITestSuite(t *testing.T) {

View File

@ -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 == "" {

View File

@ -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 {