From 0715d98c44653e4c543b0400f0b4732538d0ab4e Mon Sep 17 00:00:00 2001 From: Mikhail Date: Sat, 16 May 2026 13:36:03 +0300 Subject: [PATCH] Assert VPN pressure action report --- .../cmd/rap-node-agent/main_test.go | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/agents/rap-node-agent/cmd/rap-node-agent/main_test.go b/agents/rap-node-agent/cmd/rap-node-agent/main_test.go index 3a98ea2..e3511c3 100644 --- a/agents/rap-node-agent/cmd/rap-node-agent/main_test.go +++ b/agents/rap-node-agent/cmd/rap-node-agent/main_test.go @@ -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(