From 6fee65ce26f1da482471c6d448022b3777c5e96d Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Thu, 18 Sep 2025 15:59:58 -0700 Subject: [PATCH] appc: check events in TestUpdateDomainRouteRemoval Change-Id: I013a9673b178e036816458882d589608d7739b18 --- appc/appconnector_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/appc/appconnector_test.go b/appc/appconnector_test.go index 4f1ffb15c..c43a9e835 100644 --- a/appc/appconnector_test.go +++ b/appc/appconnector_test.go @@ -524,6 +524,7 @@ func TestUpdateDomainRouteRemoval(t *testing.T) { ctx := t.Context() bus := eventbustest.NewBus(t) for _, shouldStore := range []bool{false, true} { + w := eventbustest.NewWatcher(t, bus) rc := &appctest.RouteCollector{} assertRoutes := func(prefix string, routes, removedRoutes []netip.Prefix) { @@ -575,6 +576,20 @@ func TestUpdateDomainRouteRemoval(t *testing.T) { wantRemovedRoutes = prefixes("1.2.3.3/32", "1.2.3.4/32") } assertRoutes("removal", wantRoutes, wantRemovedRoutes) + + wantEvents := []any{ + // Each DNS record observed triggers an update. + eqUpdate(RouteUpdate{Advertise: prefixes("1.2.3.1/32")}), + eqUpdate(RouteUpdate{Advertise: prefixes("1.2.3.2/32")}), + eqUpdate(RouteUpdate{Advertise: prefixes("1.2.3.3/32")}), + eqUpdate(RouteUpdate{Advertise: prefixes("1.2.3.4/32")}), + } + if shouldStore { + wantEvents = append(wantEvents, eqUpdate(RouteUpdate{Unadvertise: prefixes("1.2.3.3/32", "1.2.3.4/32")})) + } + if err := eventbustest.Expect(w, wantEvents...); err != nil { + t.Error(err) + } } }