Test magic dns with the correct urls

This commit is contained in:
Kristoffer Dalby 2022-05-18 21:18:03 +02:00
parent 4a9d3bedf9
commit 77ceeaf5fd
2 changed files with 42 additions and 6 deletions

View file

@ -248,3 +248,37 @@ 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].GetNamespace().GetName())
}
return hostnames, nil
}