client/web: fix data race in test

Fixes #9150

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy 2023-08-29 21:50:45 -04:00
parent 7538f38671
commit b772c071b1
No known key found for this signature in database

View File

@ -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)
}