Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint:ci": "biome ci",
"test": "vitest --silent passed-only",
"test:integration": "vitest --config vitest.integration.config.ts --silent passed-only",
"test:integration:ci": "pnpm -F @ensnode/integration-test-env start",
"test:integration:ci": "pnpm -F @ensnode/integration-test-env start:ci",
"audit:osv": "osv-scanner scan source --lockfile pnpm-lock.yaml",
"typecheck": "pnpm -r --parallel --aggregate-output typecheck",
"changeset": "changeset",
Expand Down
39 changes: 31 additions & 8 deletions packages/integration-test-env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,47 @@ via the `docker/docker-compose.orchestrator.yml` file.

## How It Works

The orchestrator runs a 6-phase pipeline:
The lifecycle runs a 6-phase bring-up:

1. **Postgres + Devnet** — started in parallel via testcontainers
2. **ENSRainbow database** — downloads pre-built LevelDB, extracts, starts ENSRainbow from source
3. **ENSIndexer** — starts from source, waits for health
4. **Indexing** — polls until omnichain status reaches "Following" or "Completed"
5. **ENSApi** — starts from source, waits for health
6. **Integration tests** — runs `pnpm test:integration`
2. **Seed devnet** — primary names and resolver records
3. **ENSRainbow database** — downloads pre-built LevelDB, extracts, starts ENSRainbow from source
4. **ENSIndexer** — starts from source, waits for health
5. **Indexing** — polls until omnichain status reaches "Following" or "Completed"
6. **ENSApi** — starts from source, waits for health

Two entrypoints share that bring-up:

- `pnpm start` — bring up the stack and wait for Ctrl+C. Use this when you want to point `pnpm test:integration` (or anything else) at a long-lived stack.
- `pnpm start:ci` — bring up the stack, run `pnpm test:integration` at the monorepo root, then tear everything down (CI flow).

## Usage

### Automated
### Bring up the stack (manual)

```sh
pnpm start
```

Works both in CI and locally — just make sure the required ports are available (8545, 8000, 3223, 42069, 4334).
Brings up the full stack and blocks until Ctrl+C. The required ports must be available (8545, 5433, 3223, 42069, 4334). Once it's up, run integration tests from another terminal (`test:integration` is a monorepo-root script):

```sh
pnpm test:integration
```
Comment thread
shrugs marked this conversation as resolved.
Comment thread
shrugs marked this conversation as resolved.

To bring up only a subset of services, pass `--only` with a comma-separated list (valid: `devnet`, `ensrainbow`, `ensindexer`, `ensapi`). Omitted services aren't started, so their ports aren't required:

```sh
pnpm start --only devnet,ensrainbow
```

### Full CI pipeline (bring up + tests + tear down)

```sh
pnpm start:ci
```

Works both in CI and locally — just make sure the required ports are available.

### Manual (local development)

Expand Down
3 changes: 2 additions & 1 deletion packages/integration-test-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"type": "module",
"description": "Integration test environment orchestration for ENSNode",
"scripts": {
"start": "CI=1 tsx src/orchestrator.ts",
"start": "tsx src/start.ts",
"start:ci": "CI=1 tsx src/ci.ts",
Comment thread
shrugs marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"typecheck": "tsc --noEmit"
},
Comment thread
shrugs marked this conversation as resolved.
"dependencies": {
Expand Down
34 changes: 34 additions & 0 deletions packages/integration-test-env/src/ci.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* `pnpm -F @ensnode/integration-test-env start:ci`
*
* Integration Test Environment CI flow.
*
* Brings up the full stack, runs monorepo-level integration tests, then tears everything down.
* For the manual flow that brings up the stack and waits for Ctrl+C without running tests, use
* `pnpm start` (start.ts).
*
* Phases (lifecycle.bringUp + test run):
* 1. ENSDb (postgres) + devnet via docker-compose (testcontainers DockerComposeEnvironment)
* 2. Seed devnet (primary names and resolver records)
* 3. Start ENSRainbow via `pnpm entrypoint` (downloads + extracts the prebuilt LevelDB in the background)
* 4. Start ENSIndexer
* 5. Wait for omnichain-following / omnichain-completed (indexing complete)
* 6. Start ENSApi
* 7. Run `pnpm test:integration` at the monorepo root
*/

import { bringUp, cleanup, runIntegrationTests } from "./lifecycle";

async function main() {
await bringUp();
runIntegrationTests();
Comment thread
coderabbitai[bot] marked this conversation as resolved.

await cleanup();
process.exit(0);
}

main().catch(async (e: unknown) => {
console.error(`[ci] ERROR: ${String(e)}`);
await cleanup();
process.exit(1);
});
Loading
Loading