Use BuildKit when building integration tests headscale containers

This commit is contained in:
Juan Font Alonso 2022-07-31 10:37:49 +02:00
parent f9c4d577e2
commit 0f3dc9de4e
3 changed files with 18 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"log" "log"
"net/http" "net/http"
"os" "os"
"runtime"
"testing" "testing"
"time" "time"
@ -49,9 +50,13 @@ func (s *IntegrationCLITestSuite) SetupTest() {
s.FailNow(fmt.Sprintf("Could not create network: %s", err), "") s.FailNow(fmt.Sprintf("Could not create network: %s", err), "")
} }
platform := fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)
headscaleBuildOptions := &dockertest.BuildOptions{ headscaleBuildOptions := &dockertest.BuildOptions{
Dockerfile: "Dockerfile", Dockerfile: "Dockerfile",
ContextDir: ".", ContextDir: ".",
Platform: platform,
Version: "2",
} }
currentPath, err := os.Getwd() currentPath, err := os.Getwd()
@ -66,6 +71,7 @@ func (s *IntegrationCLITestSuite) SetupTest() {
}, },
Networks: []*dockertest.Network{&s.network}, Networks: []*dockertest.Network{&s.network},
Cmd: []string{"headscale", "serve"}, Cmd: []string{"headscale", "serve"},
Platform: platform,
} }
err = s.pool.RemoveContainerByName(headscaleHostname) err = s.pool.RemoveContainerByName(headscaleHostname)

View File

@ -13,6 +13,7 @@ import (
"net/http" "net/http"
"os" "os"
"path" "path"
"runtime"
"strings" "strings"
"sync" "sync"
"testing" "testing"
@ -103,9 +104,13 @@ func (s *IntegrationDERPTestSuite) SetupSuite() {
} }
} }
platform := fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)
headscaleBuildOptions := &dockertest.BuildOptions{ headscaleBuildOptions := &dockertest.BuildOptions{
Dockerfile: "Dockerfile", Dockerfile: "Dockerfile",
ContextDir: ".", ContextDir: ".",
Platform: platform,
Version: "2",
} }
currentPath, err := os.Getwd() currentPath, err := os.Getwd()
@ -127,6 +132,7 @@ func (s *IntegrationDERPTestSuite) SetupSuite() {
"8443/tcp": {{HostPort: "8443"}}, "8443/tcp": {{HostPort: "8443"}},
"3478/udp": {{HostPort: "3478"}}, "3478/udp": {{HostPort: "3478"}},
}, },
Platform: platform,
} }
err = s.pool.RemoveContainerByName(headscaleHostname) err = s.pool.RemoveContainerByName(headscaleHostname)

View File

@ -14,6 +14,7 @@ import (
"net/http" "net/http"
"os" "os"
"path" "path"
"runtime"
"strings" "strings"
"sync" "sync"
"testing" "testing"
@ -227,9 +228,13 @@ func (s *IntegrationTestSuite) SetupSuite() {
s.FailNow(fmt.Sprintf("Could not create network: %s", err), "") s.FailNow(fmt.Sprintf("Could not create network: %s", err), "")
} }
platform := fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)
headscaleBuildOptions := &dockertest.BuildOptions{ headscaleBuildOptions := &dockertest.BuildOptions{
Dockerfile: "Dockerfile", Dockerfile: "Dockerfile",
ContextDir: ".", ContextDir: ".",
Platform: platform,
Version: "2",
} }
currentPath, err := os.Getwd() currentPath, err := os.Getwd()
@ -244,6 +249,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
}, },
Networks: []*dockertest.Network{&s.network}, Networks: []*dockertest.Network{&s.network},
Cmd: []string{"headscale", "serve"}, Cmd: []string{"headscale", "serve"},
Platform: platform,
} }
err = s.pool.RemoveContainerByName(headscaleHostname) err = s.pool.RemoveContainerByName(headscaleHostname)