chore(test): remove test helpers that repeat existing ones from PR #282

Aperta Adatta ai principianti
#284 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, testing-qa
Ambito
testing

Direzione di ricerca

Inizia da internal/indexer/sync_shared_test.go e internal/indexer/pipeline_test.go per confrontare setSyncBeforeCommitHook con il setHook generico, poi passa a internal/graphstore/shared_test.go per i tre helper setShared*Hook e blockFirstOpen. Controlla anche internal/daemon/catchup_test.go (runHeld, startFakeRun) e testbudget_test.go. Il lavoro è completo quando gli helper duplicati sono rimossi, i test interessati richiamano gli helper condivisi e go test ./... continua a passare.

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

Descrizione

area:indexer chore priority:low
What kind of chore?

Test infrastructure

What needs doing?

PR #282 added four test helpers that repeat helpers their packages already have. Each fix keeps behavior the same and changes only test files.

  • internal/indexer/sync_shared_test.go:16: setSyncBeforeCommitHook repeats the generic setHook in internal/indexer/pipeline_test.go. Widen the t parameter of setHook to an interface with Helper and Cleanup, so *rapid.T fits. Call setHook(t, &syncBeforeCommitHook, ...) instead.
  • internal/graphstore/shared_test.go: setSharedOpenHook, setSharedCloseHook and setSharedWaitHook differ only in the variable they set. Add one generic setHook[T any](t, hook *T, value T) to the graphstore tests. Call it for all three.
  • internal/daemon/catchup_test.go:145: runHeld in TestRunCatchUpSyncOnHeldStore repeats the awaitEpisode loop of TestDaemonFlushLockRequeueGivesUpPerEpisode. Hoist one helper beside startFakeRun, built on the receive helper in testbudget_test.go. Call it from both tests.
  • internal/graphstore/shared_test.go:349: TestOpenOfSecondPathDoesNotWait copies the body of the blockFirstOpen closure. That closure is local to TestSharedHandleWaitersShareOpen. Move blockFirstOpen to file level.

The line numbers come from the review at ecc22e07. Current lines can differ.

Why now?

The OpenSpec review of the shared-store-handle change flagged these copies under its fit lens. The copies came in with #282 (commit c6788f5d). A later edit to one copy will not reach the others, so the duplicates can drift apart and hide a test bug. Tidiness is the trigger here, so this is lower priority.

Does this touch anything load-bearing?
  • The release pipeline (release.yml, .goreleaser.yaml, signing)
  • The upgrade identity (internal/upgrade/verify.go)
  • The perf baseline (tools/bench/baseline.json)
  • The graph schema / meta-key layout
  • None of these
Before submitting
  • I searched existing issues and this is not a duplicate
Lingua principale
Go
Stelle
0
Fork
0
Merge medio
7h 42m
PR unite (30g)
111

Preparare l'ambiente

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 seanb4t/codegraph-go

Tutte le issue di seanb4t/codegraph-go

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.