Skip to content

Commit d500447

Browse files
aksOpsclaude
andauthored
test(vectorindex): skip Recall10k under -race (#32)
TestHNSW_Recall10k is the CI bottleneck at ~410s under -race (68% of the integration job). The workload is fully sequential — build 10k vectors, then 20 query probes — so the race detector has nothing to catch and just adds ~10× overhead. Added a raceEnabled build-tagged constant (standard Go idiom) so the test skips only under -race. TestHNSW_ConcurrentAddSearch still runs under -race and covers the actual concurrent code path. Local timings: go test -run Recall10k 68s (recall=1.000) go test -race -run Recall10k 1s (skip) go test -race -run ConcurrentAdd 2s (unchanged) Integration CI projected: 600s → ~190s. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cd2cab7 commit d500447

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

internal/vectorindex/hnsw_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ func TestHNSW_Recall10k(t *testing.T) {
215215
if testing.Short() {
216216
t.Skip("skipping 10k benchmark in -short")
217217
}
218+
if raceEnabled {
219+
// Workload is fully sequential (no goroutines), so the race
220+
// detector has nothing to catch here — it just adds ~10× overhead
221+
// that dominates CI. Concurrency correctness is covered by
222+
// TestHNSW_ConcurrentAddSearch, which DOES run under -race.
223+
t.Skip("skipping 10k recall benchmark under -race (sequential workload)")
224+
}
218225
const (
219226
n = 10_000
220227
dim = 384

internal/vectorindex/race_off.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//go:build !race
2+
3+
package vectorindex
4+
5+
const raceEnabled = false

internal/vectorindex/race_on.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:build race
2+
3+
package vectorindex
4+
5+
// raceEnabled reports whether the package was compiled with -race.
6+
// Some long-running deterministic benchmarks (e.g. TestHNSW_Recall10k)
7+
// gain nothing from the race detector — they're sequential — and pay
8+
// ~10× overhead that dominates CI time. Those tests skip when this is
9+
// true, leaving the explicitly concurrent tests to exercise the detector.
10+
const raceEnabled = true

0 commit comments

Comments
 (0)