From b772c071b1c2f8a4f92d2727ecb69a5f724e6e59 Mon Sep 17 00:00:00 2001 From: Sonia Appasamy Date: Tue, 29 Aug 2023 21:50:45 -0400 Subject: [PATCH] client/web: fix data race in test Fixes #9150 Signed-off-by: Sonia Appasamy --- client/web/web_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/web/web_test.go b/client/web/web_test.go index fbfd8ad18..d8c25107e 100644 --- a/client/web/web_test.go +++ b/client/web/web_test.go @@ -76,14 +76,16 @@ func TestQnapAuthnURL(t *testing.T) { // 2. localapi proxy allowlist func TestServeAPI(t *testing.T) { lal := memnet.Listen("local-tailscaled.sock:80") - defer lal.Close() // Serve dummy localapi. Just returns "success". go func() { localapi := &http.Server{Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "success") })} + defer localapi.Close() + defer lal.Close() + if err := localapi.Serve(lal); err != nil { t.Error(err) }