Skip to content

Reenable integration testing by matching the test files#138

Merged
kriszyp merged 2 commits into
mainfrom
re-enable-integration-testing
May 13, 2026
Merged

Reenable integration testing by matching the test files#138
kriszyp merged 2 commits into
mainfrom
re-enable-integration-testing

Conversation

@kriszyp
Copy link
Copy Markdown
Member

@kriszyp kriszyp commented May 12, 2026

Summary

This PR re-enables integration tests that were silently skipped because the glob pattern *.test.*s only matched .ts files, excluding all .mjs test files. With the glob now correct, 8 previously-untouched tests ran for the first time and exposed three categories of failures:

  • ERR_MODULE_NOT_FOUND for core/integrationTests/utils/targz.ts (fullyConnectedReplication, replicationLoad) — the file no longer exists; targz is now exported from @harperfast/integration-testing. Updated both imports to match how issue135-resource-search-after-restart.test.mjs already does it.

  • CpuWork endpoint not reachable (analytics.test.mjs) — Harper's wrapped spawn (see core/security/jsLoader.ts:887) requires a name option so it can deduplicate long-lived processes. The fixture called bare spawn() which threw, returning ≥400 and causing the endpoint probe to fail. Added a unique name: cpu-work-child-${runId}-${i} per child.

  • AssertionError: connected (cloneNode — "should clone three more nodes") — waitForAvailableStatus only means a node is reachable and bootstrapped, not that the full N×(N-1) replication mesh has finished establishing every socket. The fix adds a poll loop (same pattern as replicationTopology.test.mjs:100–140) that retries up to 20× with backoff before asserting socket.connected.

Where to look

  • Low confidence / needs attention: The cloneNode socket-connected polling is the highest-risk change. If the cluster genuinely fails to mesh (rather than just being slow), the retry will exhaust and throw a detailed JSON dump — but it's worth checking that the 20×backoff window (≈5 min total) is sufficient given CI runner load. The existing replicationTopology test uses only 10 retries with smaller backoff; the clone test starts 3 additional nodes sequentially so needs more runway.

  • Straightforward: The targz import changes are mechanical renames. The spawn name fix is self-contained to the analytics fixture.

Related

Addresses failures introduced when #137 fixed the glob to match .mjs files.


Generated by Claude Sonnet 4.6 (1M context)

@kriszyp kriszyp requested a review from a team as a code owner May 12, 2026 22:01
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 12, 2026

Reviewed; no blockers found.

Comment thread package.json
"lint:required": "oxlint --quiet .",
"test:integration": "HARPER_INTEGRATION_TEST_INSTALL_SCRIPT=dist/bin/harper.js harper-integration-test-run",
"test:integration:all": "npm run test:integration -- integrationTests/**/*.test.ts",
"test:integration:all": "npm run test:integration -- integrationTests/**/*.test.*s",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you like verbosity 😄

Suggested change
"test:integration:all": "npm run test:integration -- integrationTests/**/*.test.*s",
"test:integration:all": "npm run test:integration -- integrationTests/**/*.test.{ts,js,mts,mjs}",

Three distinct failures in tests that were never running because the
glob only matched *.ts files:

- cluster/fullyConnectedReplication, cluster/replicationLoad: imported
  targz from a relative path (../../core/integrationTests/utils/targz.ts)
  that no longer exists; moved to @harperfast/integration-testing which
  already exports it (matches how issue135 test does it)

- analytics fixture: spawn() calls lacked the required name option
  (Harper's wrapped spawn enforces this to deduplicate long-lived
  processes); added unique name per child using Date.now() + index

- cloneNode "three more nodes": waitForAvailableStatus only means the
  node is up, not that the full replication mesh has established; added
  a poll loop (same pattern as replicationTopology.test.mjs) that retries
  up to 20× with backoff before asserting all sockets are connected

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@kriszyp kriszyp merged commit 01ffe6c into main May 13, 2026
21 of 23 checks passed
@kriszyp kriszyp deleted the re-enable-integration-testing branch May 13, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants