Merge remote-tracking branch 'origin/main' into fix-bug-in-excludecorrectlytaggednodes
This commit is contained in:
commit
110b01befa
27 changed files with 544 additions and 472 deletions
|
@ -1,4 +1,4 @@
|
|||
//go:build integration
|
||||
//go:build integration_derp
|
||||
|
||||
package headscale
|
||||
|
||||
|
@ -8,7 +8,6 @@ import (
|
|||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -28,9 +27,8 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
headscaleHostname = "headscale-derp"
|
||||
namespaceName = "derpnamespace"
|
||||
totalContainers = 3
|
||||
namespaceName = "derpnamespace"
|
||||
totalContainers = 3
|
||||
)
|
||||
|
||||
type IntegrationDERPTestSuite struct {
|
||||
|
@ -140,15 +138,15 @@ func (s *IntegrationDERPTestSuite) SetupSuite() {
|
|||
)
|
||||
}
|
||||
|
||||
log.Println("Creating headscale container")
|
||||
log.Println("Creating headscale container for DERP integration tests")
|
||||
if pheadscale, err := s.pool.BuildAndRunWithBuildOptions(headscaleBuildOptions, headscaleOptions, DockerRestartPolicy); err == nil {
|
||||
s.headscale = *pheadscale
|
||||
} else {
|
||||
s.FailNow(fmt.Sprintf("Could not start headscale container: %s", err), "")
|
||||
}
|
||||
log.Println("Created headscale container to test DERP")
|
||||
log.Println("Created headscale container for embedded DERP tests")
|
||||
|
||||
log.Println("Creating tailscale containers")
|
||||
log.Println("Creating tailscale containers for embedded DERP tests")
|
||||
|
||||
for i := 0; i < totalContainers; i++ {
|
||||
version := tailscaleVersions[i%len(tailscaleVersions)]
|
||||
|
@ -160,7 +158,7 @@ func (s *IntegrationDERPTestSuite) SetupSuite() {
|
|||
s.tailscales[hostname] = *container
|
||||
}
|
||||
|
||||
log.Println("Waiting for headscale to be ready")
|
||||
log.Println("Waiting for headscale to be ready for embedded DERP tests")
|
||||
hostEndpoint := fmt.Sprintf("localhost:%s", s.headscale.GetPort("8443/tcp"))
|
||||
|
||||
if err := s.pool.Retry(func() error {
|
||||
|
@ -170,6 +168,7 @@ func (s *IntegrationDERPTestSuite) SetupSuite() {
|
|||
client := &http.Client{Transport: insecureTransport}
|
||||
resp, err := client.Get(url)
|
||||
if err != nil {
|
||||
fmt.Printf("headscale for embedded DERP tests is not ready: %s\n", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -185,7 +184,7 @@ func (s *IntegrationDERPTestSuite) SetupSuite() {
|
|||
// https://github.com/stretchr/testify/issues/849
|
||||
return // fmt.Errorf("Could not connect to headscale: %s", err)
|
||||
}
|
||||
log.Println("headscale container is ready")
|
||||
log.Println("headscale container is ready for embedded DERP tests")
|
||||
|
||||
log.Printf("Creating headscale namespace: %s\n", namespaceName)
|
||||
result, err := ExecuteCommand(
|
||||
|
@ -368,7 +367,7 @@ func (s *IntegrationDERPTestSuite) saveLog(
|
|||
|
||||
log.Printf("Saving logs for %s to %s\n", resource.Container.Name, basePath)
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
path.Join(basePath, resource.Container.Name+".stdout.log"),
|
||||
[]byte(stdout.String()),
|
||||
0o644,
|
||||
|
@ -377,7 +376,7 @@ func (s *IntegrationDERPTestSuite) saveLog(
|
|||
return err
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
path.Join(basePath, resource.Container.Name+".stderr.log"),
|
||||
[]byte(stdout.String()),
|
||||
0o644,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue