mirror of
https://github.com/tailscale/tailscale.git
synced 2025-09-20 21:21:23 +02:00
appc: check events in TestObserveDNSResponse
Change-Id: I15707a7bcb96ef47b1dbc8febf5e2dca50feef3c
This commit is contained in:
parent
ae36f9f8b7
commit
b846167f0d
@ -200,6 +200,7 @@ func TestObserveDNSResponse(t *testing.T) {
|
||||
ctx := t.Context()
|
||||
bus := eventbustest.NewBus(t)
|
||||
for _, shouldStore := range []bool{false, true} {
|
||||
w := eventbustest.NewWatcher(t, bus)
|
||||
rc := &appctest.RouteCollector{}
|
||||
a := NewAppConnector(Config{
|
||||
Logf: t.Logf,
|
||||
@ -284,6 +285,22 @@ func TestObserveDNSResponse(t *testing.T) {
|
||||
if !slices.Contains(a.domains["example.com"], netip.MustParseAddr("192.0.2.1")) {
|
||||
t.Errorf("missing %v from %v", "192.0.2.1", a.domains["exmaple.com"])
|
||||
}
|
||||
|
||||
if err := eventbustest.ExpectExactly(w,
|
||||
eqUpdate(RouteUpdate{Advertise: prefixes("192.0.0.8/32")}), // from initial DNS response, via example.com
|
||||
eventbustest.Type[RouteInfo](),
|
||||
eqUpdate(RouteUpdate{Advertise: prefixes("192.0.0.9/32")}), // from CNAME response
|
||||
eventbustest.Type[RouteInfo](),
|
||||
eqUpdate(RouteUpdate{Advertise: prefixes("192.0.0.10/32")}), // from CNAME response, mid-chain
|
||||
eventbustest.Type[RouteInfo](),
|
||||
eqUpdate(RouteUpdate{Advertise: prefixes("2001:db8::1/128")}), // v6 DNS response
|
||||
eventbustest.Type[RouteInfo](),
|
||||
eqUpdate(RouteUpdate{Advertise: prefixes("192.0.2.0/24")}), // additional prefix
|
||||
eventbustest.Type[RouteInfo](),
|
||||
// N.B. no update for 192.0.2.1 as it is already covered
|
||||
); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user