From 8c89e75c506e040ae9e1a50a30de1e3f08a794c0 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Thu, 18 Sep 2025 10:16:30 -0700 Subject: [PATCH] ipn/ipnlocal: fix racy tests (round 2) Change-Id: Idef2a891b37f9dc76e86eb425cc0fc8abec31a45 --- ipn/ipnlocal/local_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ipn/ipnlocal/local_test.go b/ipn/ipnlocal/local_test.go index e547f1e59..c290fb971 100644 --- a/ipn/ipnlocal/local_test.go +++ b/ipn/ipnlocal/local_test.go @@ -2367,19 +2367,20 @@ func TestObserveDNSResponse(t *testing.T) { } rc := &appctest.RouteCollector{} - b.appConnector = appc.NewAppConnector(appc.Config{ + a := appc.NewAppConnector(appc.Config{ Logf: t.Logf, EventBus: bus, RouteAdvertiser: rc, HasStoredRoutes: shouldStore, }) - b.appConnector.UpdateDomains([]string{"example.com"}) - b.appConnector.Wait(context.Background()) + a.UpdateDomains([]string{"example.com"}) + a.Wait(t.Context()) + b.appConnector = a if err := b.ObserveDNSResponse(dnsResponse("example.com.", "192.0.0.8")); err != nil { t.Errorf("ObserveDNSResponse: %v", err) } - b.appConnector.Wait(context.Background()) + a.Wait(t.Context()) wantRoutes := []netip.Prefix{netip.MustParsePrefix("192.0.0.8/32")} if !slices.Equal(rc.Routes(), wantRoutes) { t.Fatalf("got routes %v, want %v", rc.Routes(), wantRoutes)