chore: fail server startup on invalid DERP map (#10536)

This commit is contained in:
Dean Sheather
2023-11-06 23:04:07 +10:00
committed by GitHub
parent 5b9e26a13f
commit 95e5419626
3 changed files with 70 additions and 2 deletions

View File

@ -1755,3 +1755,22 @@ func TestConnectToPostgres(t *testing.T) {
})
require.NoError(t, sqlDB.PingContext(ctx))
}
func TestServer_InvalidDERP(t *testing.T) {
t.Parallel()
// Try to start a server with the built-in DERP server disabled and no
// external DERP map.
inv, _ := clitest.New(t,
"server",
"--in-memory",
"--http-address", ":0",
"--access-url", "http://example.com",
"--derp-server-enable=false",
"--derp-server-stun-addresses", "disable",
"--block-direct-connections",
)
err := inv.Run()
require.Error(t, err)
require.ErrorContains(t, err, "A valid DERP map is required for networking to work")
}