From 7c9ecc689e2200d6b4c9d25b6c067e303a592ec5 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Tue, 8 Aug 2023 00:26:17 +0000 Subject: [PATCH] chore: fix `TestTailnet/ForcesWebSockets` flake --- coderd/batchstats/batcher.go | 1 - tailnet/conn_test.go | 2 +- tailnet/tailnettest/tailnettest.go | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coderd/batchstats/batcher.go b/coderd/batchstats/batcher.go index fc177fd143d6a..e7c734862e8bc 100644 --- a/coderd/batchstats/batcher.go +++ b/coderd/batchstats/batcher.go @@ -13,7 +13,6 @@ import ( "cdr.dev/slog" "cdr.dev/slog/sloggers/sloghuman" - "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/dbauthz" "github.com/coder/coder/codersdk/agentsdk" diff --git a/tailnet/conn_test.go b/tailnet/conn_test.go index 99a88fabb2263..db526bfd3da02 100644 --- a/tailnet/conn_test.go +++ b/tailnet/conn_test.go @@ -99,7 +99,7 @@ func TestTailnet(t *testing.T) { t.Run("ForcesWebSockets", func(t *testing.T) { t.Parallel() - ctx := testutil.Context(t, testutil.WaitLong) + ctx := testutil.Context(t, testutil.WaitMedium) w1IP := tailnet.IP() derpMap := tailnettest.RunDERPOnlyWebSockets(t) diff --git a/tailnet/tailnettest/tailnettest.go b/tailnet/tailnettest/tailnettest.go index 655568a341ccb..16fc92591cbd3 100644 --- a/tailnet/tailnettest/tailnettest.go +++ b/tailnet/tailnettest/tailnettest.go @@ -77,7 +77,8 @@ func RunDERPOnlyWebSockets(t *testing.T) *tailcfg.DERPMap { handler, closeFunc = tailnet.WithWebsocketSupport(d, handler) server := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/derp" { - handler.ServeHTTP(w, r) + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte("hello")) return } if r.Header.Get("Upgrade") != "websocket" {