test(channelserver): replace time.Sleep with polling loops

Blind sleeps accumulate serially (no t.Parallel anywhere) and inflate
under the race detector's scheduling overhead — contributing to the
~136s channelserver test run time.

Replace ~75 arbitrary sleeps (50ms–1s) across 7 test files with 2s
polling loops that exit as soon as the expected condition holds. Sleeps
that are genuinely intentional (race-condition stress tests, cache
expiry, temporal spacing in timestamp tests, backpressure pacing) are
left untouched.
This commit is contained in:
Houmgaor
2026-03-23 10:57:01 +01:00
parent 0c6dc39371
commit d0efc4e81a
8 changed files with 159 additions and 75 deletions

View File

@@ -3,7 +3,6 @@ package channelserver
import (
"bytes"
"testing"
"time"
"erupe-ce/common/mhfitem"
cfg "erupe-ce/config"
@@ -617,9 +616,6 @@ func TestPlateDataPersistenceDuringLogout(t *testing.T) {
t.Log("Triggering logout via logoutPlayer")
logoutPlayer(session)
// Give logout time to complete
time.Sleep(100 * time.Millisecond)
// ===== VERIFICATION: Check all plate data was saved =====
t.Log("--- Verifying plate data persisted ---")