test: убрать гонки в проверках учёта трафика
This commit is contained in:
1 parent
7e5b2d4cde
commit
c116e427f7
2 files changed
+17
-9
No files matched your search
@@ -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))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user