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

Đang mở Phù hợp với người mới
#284 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, testing-qa
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu từ internal/indexer/sync_shared_test.go và internal/indexer/pipeline_test.go để so sánh setSyncBeforeCommitHook với setHook tổng quát, sau đó xem internal/graphstore/shared_test.go cho ba helper setShared*Hook và blockFirstOpen. Cũng kiểm tra internal/daemon/catchup_test.go (runHeld, startFakeRun) và testbudget_test.go. Hoàn thành khi các helper trùng lặp được xóa, các test liên quan gọi các helper dùng chung và go test ./... vẫn chạy thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Go
Star
0
Fork
0
Merge trung bình
7 giờ 42 phút
Pull request đã merge (30 ngày)
111

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của seanb4t/codegraph-go

Tất cả issue của seanb4t/codegraph-go

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.