Skip to content

Test isolation + fixed-delay indexing waits make the suite order/load-dependent #5

Description

@Coriou

Surfaced by the 2026-06-29 maintenance audit (PR #2). Doesn't bite CI today (fresh server+Redis per run), but makes local re-runs and any future shared-runner setup flaky.

Problem A — registry persistence breaks the rename test on dirty state

reset intentionally preserves namespace registry entries (commit d5ea6d7). As a result, tests/integration/namespaces.test.ts > "rename namespace moves vectors and registry entry" asserts expect(listed).not.toContain("old-ns"), which fails when the server/Redis carries leftover namespaces from a prior run. From a clean Redis the integration suite passes 56/56; against a reused server it fails this one test.

Note: also avoid redis-cli FLUSHALL against a long-running up-vector — its in-memory caches (dimensionMap, knownIndexes) go stale vs the emptied Redis; restart the server after flushing.

Problem B — fixed 500ms indexing waits

A single hardcoded awaitIndexed(500ms) / setTimeout(500) stands in for "RediSearch has finished indexing" across ~20 sites (both setup.ts helpers plus inline in basic.test.ts and several integration files). Under CI load HNSW indexing can exceed 500ms (flaky failure) and wastes time when it's faster.

Suggested direction

  • Replace the fixed delay with condition-based polling: awaitIndexed(predicate, {timeoutMs, intervalMs}) that re-issues the query/info() (or checks FT.INFO num_docs) until the expected id/count appears, failing only on real timeout. Centralize in both setup.ts helpers; delete the inline sleeps.
  • Make the rename test robust to pre-existing registry entries (assert on the specific moved/old entry rather than its absence from a shared list), or have it reset+verify a unique namespace.

Acceptance criteria

  • The integration suite passes regardless of prior server/Redis state.
  • No fixed-duration setTimeout/awaitIndexed sleeps remain as the indexing barrier.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: mediumWorth doing; not urgent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions