appc: check events in TestUpdateWildcardRouteRemoval

Change-Id: I844663f129a91c0fb03aaac9595362553482da4d
This commit is contained in:
M. J. Fromberger 2025-09-18 17:21:00 -07:00
parent 6fee65ce26
commit fde7e17263

View File

@ -596,8 +596,8 @@ func TestUpdateDomainRouteRemoval(t *testing.T) {
func TestUpdateWildcardRouteRemoval(t *testing.T) { func TestUpdateWildcardRouteRemoval(t *testing.T) {
ctx := t.Context() ctx := t.Context()
bus := eventbustest.NewBus(t) bus := eventbustest.NewBus(t)
eventbustest.LogAllEvents(t, bus)
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) {
@ -649,6 +649,20 @@ func TestUpdateWildcardRouteRemoval(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)
}
} }
} }