Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG]: Flaky test – TestMatchmakingService fails intermittently (users matched before pool assertion)

Aperta Adatta ai principianti
#760 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
92/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
testing

Direzione di ricerca

Inizia con backend/services/matchmaking_test.go e la configurazione di TestMatchmakingService, quindi esegui cd backend && go test ./services/ -run TestMatchmakingService -count=10 -v dalla directory backend. Rendi il test deterministico impedendo che gli utenti venga accoppiati prima dell’asserzione sul pool oppure verificando direttamente il risultato del matchmaking, senza modificare la logica di produzione. La modifica è completa quando il test passa ripetutamente con il comando di test ripetuto e non dipende più dal timing delle goroutine.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Bug Description

TestMatchmakingService in backend/services/matchmaking_test.go fails intermittently. This is a bug in the test, not in the matchmaking logic.

StartMatchmaking launches findMatch in a background goroutine. The test uses two users with Elo 1200 and 1250, which are within the ±200 match range, so the matcher can pair them and remove both from the pool before the test checks for 2 users. Whether the test passes depends on goroutine timing, so it fails on some machines and passes on others (including CI).

Proposed fix: make the test deterministic without changing the matchmaking logic, e.g. use Elo values outside the match range (1200 vs 2000), or assert on the match outcome instead of the pool size. I'd like to work on this.

Steps to Reproduce
  1. cd backend
  2. Run the test several times to hit the race:
    go test ./services/ -run TestMatchmakingService -count=10 -v
    
  3. Some runs fail with Expected 2 users in pool after both started matchmaking, got 0.
Logs and Screenshots
--- FAIL: TestMatchmakingService (0.00s)
    matchmaking_test.go:50: Expected 2 users in pool after both started matchmaking, got 0
    matchmaking_test.go:57: Expected 1 user in pool after removal, got 0
    matchmaking_test.go:64: Expected 1 user in pool after activity update, got 0
FAIL
FAIL    arguehub/services       2.238s
Image
Environment Details
  • OS: Windows 11 (Git Bash)
  • Go
  • Branch: latest main
  • Only the backend test suite is affected; the app and deployment are not.
Impact

Low - Minor inconvenience

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
Lingua principale
TypeScript
Stelle
104
Fork
244
Merge medio
1g 21h
PR unite (30g)
43

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AOSSIE-Org/DebateAI

Tutte le issue di AOSSIE-Org/DebateAI

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.