test: убрать гонки в проверках учёта трафика

This commit is contained in:
samosvalishe committed 2026-09-21 13:43:21 +03:00
1 parent 7e5b2d4cde
commit c116e427f7
2 files changed
+17 -9

No files matched your search

+7 -1
View File
@@ -288,7 +288,13 @@ func TestProxyConnCountsApplicationBytes(t *testing.T) {
t.Fatal(err)
}
tx, rx := traffic.Counters()
var tx, rx uint64
for deadline := time.Now().Add(5 * time.Second); ; {
if tx, rx = traffic.Counters(); tx == uint64(len(payload)) || time.Now().After(deadline) {
break
}
time.Sleep(time.Millisecond)
}
if tx != uint64(len(payload)) {
t.Errorf("tx = %d, want %d", tx, len(payload))
}