Skip to content

Add integration tests for control plane (workerd runtime)#73

Merged
ColeMurray merged 3 commits intomainfrom
feat/integration-tests
Feb 7, 2026
Merged

Add integration tests for control plane (workerd runtime)#73
ColeMurray merged 3 commits intomainfrom
feat/integration-tests

Conversation

@ColeMurray
Copy link
Copy Markdown
Owner

Summary

  • Adds 14 integration tests that run inside the real workerd runtime via @cloudflare/vitest-pool-workers
  • Tests validate Worker boot, routing, HMAC auth, D1 database operations, and Durable Objects with SQLite storage
  • Everything runs offline — miniflare provides local D1 (SQLite), KV, and DO implementations
  • Existing 279 unit tests remain unchanged and still pass

Test coverage

File Tests What it proves
worker-fetch.test.ts 4 Worker boots, routes 404, CORS preflight, correlation headers
auth.test.ts 4 HMAC rejection (missing/invalid/expired), valid token acceptance
d1-session-index.test.ts 3 D1 migrations applied, SessionIndexStore CRUD with filters
durable-object.test.ts 3 DO boots with SQLite, init + state round-trip, schema tables exist

Notable decisions

  • isolatedStorage: false: Required because SQLite-backed DOs create .sqlite-shm/.sqlite-wal files that break the framework's storage snapshot assertions (workers-sdk#11031, still open, we're on the latest version 0.12.10). D1 isolation is achieved via beforeEach cleanup instead.
  • singleWorker: true: Simpler for Phase 1, sufficient for 14 tests running in ~800ms.
  • warmSandbox() throws in tests: handleInit fires ctx.waitUntil(warmSandbox()) which fails without MODAL_API_SECRET/MODAL_WORKSPACE. This is expected — it's fire-and-forget via waitUntil and doesn't affect the 200 response.

Files

New (10 files):

  • wrangler.jsonc — test-only wrangler config (DO bindings, D1, KV)
  • vitest.integration.config.ts — workerd pool config with D1 migrations
  • test/integration/ — setup, types, tsconfig, 4 test files
  • Dockerfile.test — optional container for CI-matching local runs

Modified (3 files):

  • package.jsontest:integration script, @cloudflare/vitest-pool-workers devDep
  • ci.ymllibc++1 install + integration test step
  • package-lock.json — lockfile

Test plan

  • npm test -w @open-inspect/control-plane — 279 unit tests pass
  • npm run test:integration -w @open-inspect/control-plane — 14 integration tests pass
  • CI passes on this branch

)

Adds 14 integration tests that run inside the real workerd runtime via
@cloudflare/vitest-pool-workers, validating Worker boot, routing, HMAC
auth, D1 database operations, and Durable Objects with SQLite storage.

Tests run offline with no cloud credentials — miniflare provides local
D1 (SQLite), KV, and DO implementations.

isolatedStorage is disabled due to workers-sdk#11031 (SQLite WAL files
break the storage snapshot assertions). D1 isolation is achieved via
beforeEach cleanup instead.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 7, 2026

Terraform Validation Results

Step Status
Format ⚠️
Init
Validate

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @ColeMurray, Action: pull_request

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 7, 2026

Greptile Overview

Greptile Summary

  • Adds a vitest.integration.config.ts that runs test/integration/**/*.test.ts inside the real workerd runtime via @cloudflare/vitest-pool-workers, wiring up Miniflare bindings and D1 migrations.
  • Introduces a test-only wrangler.jsonc to define local DO/D1/KV bindings used by the integration suite.
  • Adds 4 integration test files covering fetch routing/headers, HMAC auth behavior, D1-backed session index CRUD, and Durable Object SQLite state.
  • Updates CI to install libc++1 and run the new test:integration script for @open-inspect/control-plane.
  • Adds an optional Dockerfile.test for running the integration tests in a CI-like container.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread packages/control-plane/test/integration/durable-object.test.ts
Comment thread packages/control-plane/test/integration/auth.test.ts Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 7, 2026

Terraform Validation Results

Step Status
Format ⚠️
Init
Validate

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @ColeMurray, Action: pull_request

Cleans all D1 tables (sessions, repo_metadata, repo_secrets) in
beforeEach instead of just sessions, preventing potential cross-test
state leaks as the test suite grows.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 7, 2026

Terraform Validation Results

Step Status
Format ⚠️
Init
Validate

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @ColeMurray, Action: pull_request

@ColeMurray ColeMurray merged commit cb4beb2 into main Feb 7, 2026
10 checks passed
@ColeMurray ColeMurray deleted the feat/integration-tests branch February 7, 2026 07:37
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.

1 participant