Track VPN pressure history
This commit is contained in:
@@ -805,6 +805,39 @@ func TestFabricFlowSchedulerSnapshotReportsNominalAction(t *testing.T) {
|
||||
snapshot.RecommendedAction != "observe" {
|
||||
t.Fatalf("nominal pressure snapshot = %+v", snapshot)
|
||||
}
|
||||
if len(snapshot.PressureHistory) != 1 ||
|
||||
snapshot.PressureHistory[0].PressureLevel != "nominal" ||
|
||||
snapshot.PressureHistory[0].RecommendedAction != "observe" {
|
||||
t.Fatalf("nominal pressure history = %+v", snapshot.PressureHistory)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFabricFlowSchedulerRecordsPressureHistoryTransitions(t *testing.T) {
|
||||
scheduler := NewFabricFlowScheduler(1, 1)
|
||||
nominal := scheduler.Snapshot()
|
||||
if len(nominal.PressureHistory) != 1 || nominal.PressureHistory[0].RecommendedAction != "observe" {
|
||||
t.Fatalf("nominal pressure history = %+v", nominal.PressureHistory)
|
||||
}
|
||||
|
||||
packetA := testIPv4TCPPacket([4]byte{10, 77, 0, 2}, [4]byte{192, 168, 200, 95}, 51000, 3389)
|
||||
packetB := testIPv4TCPPacket([4]byte{10, 77, 0, 2}, [4]byte{192, 168, 200, 95}, 51000, 3389)
|
||||
scheduler.scheduleClientPackets("", "", [][]byte{packetA, packetB})
|
||||
|
||||
pressure := scheduler.Snapshot()
|
||||
if len(pressure.PressureHistory) != 2 {
|
||||
t.Fatalf("pressure history = %+v, want nominal plus critical transition", pressure.PressureHistory)
|
||||
}
|
||||
last := pressure.PressureHistory[len(pressure.PressureHistory)-1]
|
||||
if last.PressureLevel != "critical" ||
|
||||
last.RecommendedAction != "shed_or_reroute" ||
|
||||
!containsString(last.PressureReasons, "drops") {
|
||||
t.Fatalf("last pressure history sample = %+v", last)
|
||||
}
|
||||
|
||||
unchanged := scheduler.Snapshot()
|
||||
if len(unchanged.PressureHistory) != 2 {
|
||||
t.Fatalf("unchanged pressure history duplicated: %+v", unchanged.PressureHistory)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFabricFlowSchedulerRoundsSubMillisecondSendDuration(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user