tests: fix TestDERPVerifyEndpoint

This commit is contained in:
ArcticLampyrid 2024-11-17 01:47:30 +08:00
parent dfebd176df
commit b39925f576
No known key found for this signature in database
GPG key ID: DC72A2519E77D6CF
2 changed files with 4 additions and 3 deletions

View file

@ -33,10 +33,10 @@ func TestDERPVerifyEndpoint(t *testing.T) {
scenario, err := NewScenario(dockertestMaxWait()) scenario, err := NewScenario(dockertestMaxWait())
assertNoErr(t, err) assertNoErr(t, err)
defer scenario.Shutdown() defer scenario.ShutdownAssertNoPanics(t)
spec := map[string]int{ spec := map[string]int{
"user1": 10, "user1": len(MustTestVersions),
} }
derper, err := scenario.CreateDERPServer("head", derper, err := scenario.CreateDERPServer("head",

View file

@ -25,6 +25,7 @@ import (
"github.com/juanfont/headscale/integration/integrationutil" "github.com/juanfont/headscale/integration/integrationutil"
"github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker" "github.com/ory/dockertest/v3/docker"
"gopkg.in/yaml.v3"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
) )
@ -221,7 +222,7 @@ func WithEmbeddedDERPServerOnly() Option {
// DERP server only. // DERP server only.
func WithDERPConfig(derpMap tailcfg.DERPMap) Option { func WithDERPConfig(derpMap tailcfg.DERPMap) Option {
return func(hsic *HeadscaleInContainer) { return func(hsic *HeadscaleInContainer) {
contents, err := json.Marshal(derpMap) contents, err := yaml.Marshal(derpMap)
if err != nil { if err != nil {
log.Fatalf("failed to marshal DERP map: %s", err) log.Fatalf("failed to marshal DERP map: %s", err)