fix: tailscale is required for Docker Desktop users

This commit is contained in:
Michael 2024-01-19 15:44:05 +01:00 committed by GitHub
parent a6d462f6e8
commit 8da38ec0a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,6 +37,8 @@ import (
var showLog = flag.Bool("tlog", false, "always show Traefik logs") var showLog = flag.Bool("tlog", false, "always show Traefik logs")
const tailscaleSecretFilePath = "tailscale.secret"
type composeConfig struct { type composeConfig struct {
Services map[string]composeService `yaml:"services"` Services map[string]composeService `yaml:"services"`
} }
@ -99,6 +101,11 @@ func (s *BaseSuite) displayTraefikLogFile(path string) {
} }
func (s *BaseSuite) SetupSuite() { func (s *BaseSuite) SetupSuite() {
if isDockerDesktop(context.Background(), s.T()) {
_, err := os.Stat(tailscaleSecretFilePath)
require.NoError(s.T(), err, "Tailscale need to be configured when running integration tests with Docker Desktop: (https://doc.traefik.io/traefik/v2.11/contributing/building-testing/#testing)")
}
// configure default standard log. // configure default standard log.
stdlog.SetFlags(stdlog.Lshortfile | stdlog.LstdFlags) stdlog.SetFlags(stdlog.Lshortfile | stdlog.LstdFlags)
// TODO // TODO
@ -124,7 +131,7 @@ func (s *BaseSuite) SetupSuite() {
s.hostIP = "172.31.42.1" s.hostIP = "172.31.42.1"
if isDockerDesktop(ctx, s.T()) { if isDockerDesktop(ctx, s.T()) {
s.hostIP = getDockerDesktopHostIP(ctx, s.T()) s.hostIP = getDockerDesktopHostIP(ctx, s.T())
s.setupVPN("tailscale.secret") s.setupVPN(tailscaleSecretFilePath)
} }
} }