appc: check events in TestUpdateDomainRouteRemoval

Change-Id: I013a9673b178e036816458882d589608d7739b18
This commit is contained in:
M. J. Fromberger 2025-09-18 15:59:58 -07:00
parent 896fa3eeb5
commit 6fee65ce26

View File

@ -524,6 +524,7 @@ func TestUpdateDomainRouteRemoval(t *testing.T) {
ctx := t.Context() ctx := t.Context()
bus := eventbustest.NewBus(t) bus := eventbustest.NewBus(t)
for _, shouldStore := range []bool{false, true} { for _, shouldStore := range []bool{false, true} {
w := eventbustest.NewWatcher(t, bus)
rc := &appctest.RouteCollector{} rc := &appctest.RouteCollector{}
assertRoutes := func(prefix string, routes, removedRoutes []netip.Prefix) { 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") wantRemovedRoutes = prefixes("1.2.3.3/32", "1.2.3.4/32")
} }
assertRoutes("removal", wantRoutes, wantRemovedRoutes) 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)
}
} }
} }