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

Open Beginner friendly
#284 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
go, testing-qa
Domain
testing

Research direction

Start in internal/indexer/sync_shared_test.go and internal/indexer/pipeline_test.go to compare setSyncBeforeCommitHook with the generic setHook, then in internal/graphstore/shared_test.go for the three setShared*Hook helpers and blockFirstOpen. Also check internal/daemon/catchup_test.go (runHeld, startFakeRun) and testbudget_test.go. Done when the duplicate helpers are removed, the affected tests call the shared helpers, and go test ./... still passes.

Written by the indexing model from the issue text.

Description

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
Dominant language
Go
Stars
0
Forks
0
Avg merge
5h 16m
Merged PRs (30d)
107

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from seanb4t/codegraph-go

All issues in seanb4t/codegraph-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.