Bucket VPN route switch reasons

This commit is contained in:
2026-05-16 13:19:33 +03:00
parent c97044cd34
commit 5c3b19cff7
3 changed files with 38 additions and 2 deletions
@@ -1532,7 +1532,7 @@ func TestFabricClientPacketIngressIsolatesRouteFailoverPerLogicalChannel(t *test
}
if statA.LastRecoveredFromRouteID != "route-primary" ||
statA.LastRecoveredNextHop != "relay-primary" ||
statA.LastRouteSwitchReason != "production_mesh_next_peer_is_unavailable" ||
statA.LastRouteSwitchReason != "peer_unavailable" ||
statA.RouteSwitchCount != 1 ||
statA.LastRouteFailureAt == "" ||
statA.LastRouteSwitchAt == "" ||
@@ -1541,7 +1541,7 @@ func TestFabricClientPacketIngressIsolatesRouteFailoverPerLogicalChannel(t *test
snapshot.FlowScheduler.RouteSwitchCount != 1 ||
snapshot.FlowScheduler.RouteRecoveryMaxMillis != statA.LastRouteRecoveryMillis ||
snapshot.FlowScheduler.RouteRecoveryAvgMillis != statA.LastRouteRecoveryMillis ||
snapshot.FlowScheduler.RouteSwitchReasonCounts["production_mesh_next_peer_is_unavailable"] != 1 {
snapshot.FlowScheduler.RouteSwitchReasonCounts["peer_unavailable"] != 1 {
t.Fatalf("route recovery telemetry = stat:%+v scheduler:%+v", statA, snapshot.FlowScheduler)
}
if statB.LastRouteID != "route-primary" || statB.LastFailedRouteID != "" || statB.ConsecutiveFailures != 0 {
@@ -1552,6 +1552,21 @@ func TestFabricClientPacketIngressIsolatesRouteFailoverPerLogicalChannel(t *test
}
}
func TestNormalizeFabricRouteSwitchReasonBucketsCommonFailures(t *testing.T) {
cases := map[string]string{
"context deadline exceeded while dialing 10.0.0.1:19124": "timeout",
"dial tcp 10.0.0.1:19124: connection refused": "connection_refused",
"production mesh next peer is unavailable": "peer_unavailable",
"quic fabric stream capacity limited": "capacity_limited",
"": "route_failure",
}
for input, want := range cases {
if got := normalizeFabricRouteSwitchReason(input); got != want {
t.Fatalf("normalizeFabricRouteSwitchReason(%q) = %q, want %q", input, got, want)
}
}
}
func TestFabricClientPacketIngressIsolatesRouteMemoryPerVPNConnection(t *testing.T) {
transport := &captureManyProductionTransport{}
scheduler := NewFabricFlowScheduler(8, 16)