From 0f3dc9de4e7408c18a9981558d102e2cacbda633 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Sun, 31 Jul 2022 10:37:49 +0200 Subject: [PATCH] Use BuildKit when building integration tests headscale containers --- integration_cli_test.go | 6 ++++++ integration_embedded_derp_test.go | 6 ++++++ integration_test.go | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/integration_cli_test.go b/integration_cli_test.go index 2f58e71d..f9da4868 100644 --- a/integration_cli_test.go +++ b/integration_cli_test.go @@ -9,6 +9,7 @@ import ( "log" "net/http" "os" + "runtime" "testing" "time" @@ -49,9 +50,13 @@ func (s *IntegrationCLITestSuite) SetupTest() { s.FailNow(fmt.Sprintf("Could not create network: %s", err), "") } + platform := fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH) + headscaleBuildOptions := &dockertest.BuildOptions{ Dockerfile: "Dockerfile", ContextDir: ".", + Platform: platform, + Version: "2", } currentPath, err := os.Getwd() @@ -66,6 +71,7 @@ func (s *IntegrationCLITestSuite) SetupTest() { }, Networks: []*dockertest.Network{&s.network}, Cmd: []string{"headscale", "serve"}, + Platform: platform, } err = s.pool.RemoveContainerByName(headscaleHostname) diff --git a/integration_embedded_derp_test.go b/integration_embedded_derp_test.go index ecca8ba5..d77a677e 100644 --- a/integration_embedded_derp_test.go +++ b/integration_embedded_derp_test.go @@ -13,6 +13,7 @@ import ( "net/http" "os" "path" + "runtime" "strings" "sync" "testing" @@ -103,9 +104,13 @@ func (s *IntegrationDERPTestSuite) SetupSuite() { } } + platform := fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH) + headscaleBuildOptions := &dockertest.BuildOptions{ Dockerfile: "Dockerfile", ContextDir: ".", + Platform: platform, + Version: "2", } currentPath, err := os.Getwd() @@ -127,6 +132,7 @@ func (s *IntegrationDERPTestSuite) SetupSuite() { "8443/tcp": {{HostPort: "8443"}}, "3478/udp": {{HostPort: "3478"}}, }, + Platform: platform, } err = s.pool.RemoveContainerByName(headscaleHostname) diff --git a/integration_test.go b/integration_test.go index 2214b893..0cdd3786 100644 --- a/integration_test.go +++ b/integration_test.go @@ -14,6 +14,7 @@ import ( "net/http" "os" "path" + "runtime" "strings" "sync" "testing" @@ -227,9 +228,13 @@ func (s *IntegrationTestSuite) SetupSuite() { s.FailNow(fmt.Sprintf("Could not create network: %s", err), "") } + platform := fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH) + headscaleBuildOptions := &dockertest.BuildOptions{ Dockerfile: "Dockerfile", ContextDir: ".", + Platform: platform, + Version: "2", } currentPath, err := os.Getwd() @@ -244,6 +249,7 @@ func (s *IntegrationTestSuite) SetupSuite() { }, Networks: []*dockertest.Network{&s.network}, Cmd: []string{"headscale", "serve"}, + Platform: platform, } err = s.pool.RemoveContainerByName(headscaleHostname)