Use live QUIC pressure for endpoint ranking

This commit is contained in:
2026-05-16 12:54:51 +03:00
parent 8feb6d58fe
commit c64531d70c
5 changed files with 177 additions and 0 deletions
@@ -195,6 +195,13 @@ func TestQUICFabricTransportReusesConnectionForPeerEndpoint(t *testing.T) {
if snapshot.ActiveCount != 1 || snapshot.Stats.Opens != 1 || snapshot.Stats.Reuses != 1 {
t.Fatalf("unexpected quic transport snapshot: %+v", snapshot)
}
if len(snapshot.Connections) != 1 ||
snapshot.Connections[0].PeerID != "node-b" ||
snapshot.Connections[0].Endpoint != server.Addr().String() ||
snapshot.Connections[0].ActiveStreams != 2 ||
snapshot.Connections[0].MaxStreams != defaultQUICFabricMaxStreamsPerConn {
t.Fatalf("unexpected quic connection snapshot: %+v", snapshot.Connections)
}
}
func TestQUICFabricTransportPrunesIdleConnections(t *testing.T) {
@@ -319,6 +326,11 @@ func TestQUICFabricTransportLimitsStreamsPerConnection(t *testing.T) {
snapshot.Stats.StreamLimitRejects != 1 {
t.Fatalf("unexpected stream limit snapshot: %+v", snapshot)
}
if len(snapshot.Connections) != 1 ||
!snapshot.Connections[0].Saturated ||
snapshot.Connections[0].CapacityPressurePercent != 100 {
t.Fatalf("unexpected saturated connection snapshot: %+v", snapshot.Connections)
}
if err := first.Close(); err != nil {
t.Fatalf("close first stream: %v", err)
}