Assert VPN pressure action report

This commit is contained in:
2026-05-16 13:36:03 +03:00
parent ca923a4445
commit 0715d98c44
@@ -1260,6 +1260,34 @@ func TestVPNFabricFlowPressureActionPrioritizesAutomation(t *testing.T) {
}
}
func TestVPNFabricFlowPressureReportIncludesRecommendedAction(t *testing.T) {
report := vpnFabricFlowPressureReport(vpnruntime.FabricFlowSchedulerSnapshot{
PressureLevel: "warning",
PressureScore: 35,
PressureReasons: []string{"bulk_pressure", "backpressure"},
BackpressureActive: true,
BulkPressureActive: true,
BulkPressureChannelCount: 16,
InteractiveOrControlCount: 1,
RouteSwitchReasonCounts: map[string]int{"peer_unavailable": 2},
RecommendedParallelWindows: map[string]int{vpnruntime.FabricTrafficClassBulk: 1},
AdaptiveBackpressureActive: true,
AdaptiveBackpressureReason: "bulk_window_reduced_to_protect_interactive",
AdaptivePolicyFingerprint: "policy-fp",
QualityWindowFailureCount: 0,
QualityWindowDropCount: 0,
QualityWindowSlowCount: 0,
RouteRecoveredChannelCount: 0,
RouteRecoveryMaxMillis: 0,
RouteRecoveryAvgMillis: 0,
})
if report["recommended_action"] != "throttle_bulk" ||
report["pressure_score"] != 35 ||
report["bulk_pressure_channel_count"] != 16 {
t.Fatalf("unexpected flow pressure report: %+v", report)
}
}
func TestMergedEndpointCandidateObservationsKeepsNewest(t *testing.T) {
now := time.Now().UTC()
merged := mergedEndpointCandidateObservations(