fix(tunnel): race

This commit is contained in:
samosvalishe committed 2026-09-07 02:45:48 +03:00
1 parent daf8cece80
commit 02c696fa28
2 files changed
+10 -5

No files matched your search

+3 -2
View File
@@ -310,10 +310,11 @@ func TestDirectSnapshotErrorKeepsStreams(t *testing.T) {
// Скорость берётся из дельты между опросами хоста.
func TestFillRatesUsesDelta(t *testing.T) {
l := &live{prevTx: 1000, prevRx: 500, prevAt: time.Now().Add(-2 * time.Second)}
now := time.Now()
l := &live{prevTx: 1000, prevRx: 500, prevAt: now.Add(-2 * time.Second)}
s := &Snapshot{TxTotal: 3000, RxTotal: 1500}
l.fillRates(s)
l.fillRatesAt(s, now)
if s.TxRate != 1000 || s.RxRate != 500 {
t.Errorf("rates = %d/%d, want 1000/500", s.TxRate, s.RxRate)