mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-12 20:26:37 +08:00
fix: bound and configure tunnel quality probes (#533)
Closes #528 and #532.
This commit is contained in:
@@ -148,6 +148,25 @@ func TestNewWebSocketReporterUsesReducedMetricInterval(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWebSocketReporterLimitsConcurrentTCPPings(t *testing.T) {
|
||||
reporter := &WebSocketReporter{tcpPingSem: make(chan struct{}, maxConcurrentTCPPings)}
|
||||
for i := 0; i < maxConcurrentTCPPings; i++ {
|
||||
if !reporter.tryAcquireTCPPingSlot() {
|
||||
t.Fatalf("expected TCP ping slot %d to be available", i)
|
||||
}
|
||||
}
|
||||
if reporter.tryAcquireTCPPingSlot() {
|
||||
t.Fatalf("expected TCP ping concurrency limit at %d", maxConcurrentTCPPings)
|
||||
}
|
||||
for i := 0; i < maxConcurrentTCPPings; i++ {
|
||||
reporter.releaseTCPPingSlot()
|
||||
}
|
||||
if !reporter.tryAcquireTCPPingSlot() {
|
||||
t.Fatalf("expected released TCP ping slot to be reusable")
|
||||
}
|
||||
reporter.releaseTCPPingSlot()
|
||||
}
|
||||
|
||||
func TestFormatWebSocketDialErrorIncludesHTTPStatus(t *testing.T) {
|
||||
err := errors.New("websocket: bad handshake")
|
||||
resp := &http.Response{
|
||||
|
||||
Reference in New Issue
Block a user