Skip to content

test: poll for HNSW index readiness instead of fixed sleeps#9739

Merged
matthewmcneely merged 1 commit into
mainfrom
oss-vector-test-flakiness
Jun 19, 2026
Merged

test: poll for HNSW index readiness instead of fixed sleeps#9739
matthewmcneely merged 1 commit into
mainfrom
oss-vector-test-flakiness

Conversation

@matthewmcneely

Copy link
Copy Markdown
Contributor

What

TestVectorIndexRebuilding, TestVectorIndexDropPredicate, and TestVectorIndexWithoutSchema slept a fixed 5s after SetupSchema and then asserted on the vector index. Rebuilding the HNSW index over pre-existing data is asynchronous, so the fixed sleep was flaky on slower CI runners — the index often wasn't ready when the assertion ran.

Change

  • Replace the fixed time.Sleep calls with require.Eventually, polling a sample similar_to query until it returns the expected result count (30s budget, 500ms interval).
  • Move defer cleanup() after the Client() error check in three tests, so a cleanup from a failed Client() isn't deferred.

Test-only change; no production code touched.

TestVectorIndexRebuilding, TestVectorIndexDropPredicate, and TestVectorIndexWithoutSchema slept a fixed 5s after SetupSchema and assumed the HNSW index was ready. Rebuilding the index over pre-existing data is asynchronous, so the fixed sleep flaked on slower CI runners.

Replace the sleeps with require.Eventually polling a sample similar_to query until it returns the expected result count (30s budget, 500ms interval).

Also move `defer cleanup()` after the Client() error check in three tests so a cleanup from a failed Client() isn't deferred.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matthewmcneely matthewmcneely requested a review from a team as a code owner June 11, 2026 18:52
@github-actions github-actions Bot added area/testing Testing related issues go Pull requests that update Go code labels Jun 11, 2026
@matthewmcneely matthewmcneely changed the title systest/vector: poll for HNSW index readiness instead of fixed sleeps test: poll for HNSW index readiness instead of fixed sleeps Jun 19, 2026
@matthewmcneely matthewmcneely merged commit 2b22192 into main Jun 19, 2026
26 checks passed
@matthewmcneely matthewmcneely deleted the oss-vector-test-flakiness branch June 19, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Testing related issues go Pull requests that update Go code

Development

Successfully merging this pull request may close these issues.

2 participants