mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Remove unused components from old integration tests
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
2b7bcb77a5
commit
9187e4287c
3 changed files with 2 additions and 78 deletions
|
@ -24,7 +24,6 @@ type IntegrationCLITestSuite struct {
|
||||||
pool dockertest.Pool
|
pool dockertest.Pool
|
||||||
network dockertest.Network
|
network dockertest.Network
|
||||||
headscale dockertest.Resource
|
headscale dockertest.Resource
|
||||||
env []string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIntegrationCLITestSuite(t *testing.T) {
|
func TestIntegrationCLITestSuite(t *testing.T) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
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 {
|
type ExecuteCommandConfig struct {
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
}
|
}
|
||||||
|
@ -201,38 +195,6 @@ func getDockerBuildOptions(version string) *dockertest.BuildOptions {
|
||||||
return tailscaleBuildOptions
|
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(
|
func getDNSNames(
|
||||||
headscale *dockertest.Resource,
|
headscale *dockertest.Resource,
|
||||||
) ([]string, error) {
|
) ([]string, error) {
|
||||||
|
@ -266,43 +228,6 @@ func getDNSNames(
|
||||||
return hostnames, nil
|
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) {
|
func GetEnvStr(key string) (string, error) {
|
||||||
v := os.Getenv(key)
|
v := os.Getenv(key)
|
||||||
if v == "" {
|
if v == "" {
|
||||||
|
|
|
@ -382,7 +382,7 @@ func (s *IntegrationDERPTestSuite) saveLog(
|
||||||
|
|
||||||
err = os.WriteFile(
|
err = os.WriteFile(
|
||||||
path.Join(basePath, resource.Container.Name+".stdout.log"),
|
path.Join(basePath, resource.Container.Name+".stdout.log"),
|
||||||
[]byte(stdout.String()),
|
stderr.Bytes(),
|
||||||
0o644,
|
0o644,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -391,7 +391,7 @@ func (s *IntegrationDERPTestSuite) saveLog(
|
||||||
|
|
||||||
err = os.WriteFile(
|
err = os.WriteFile(
|
||||||
path.Join(basePath, resource.Container.Name+".stderr.log"),
|
path.Join(basePath, resource.Container.Name+".stderr.log"),
|
||||||
[]byte(stdout.String()),
|
stderr.Bytes(),
|
||||||
0o644,
|
0o644,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue