Skip to content

test(it): add integration test harness on the compose cluster - #58

Open
JasMehta08 wants to merge 1 commit into
mainfrom
infra/32-integration-harness
Open

JasMehta08 wants to merge 1 commit into
mainfrom
infra/32-integration-harness

Conversation

@JasMehta08

Copy link
Copy Markdown
Collaborator

What

Adds the integration test harness from the test strategy (#31): a satchel-it crate whose tests drive the running Compose cluster over HTTP, a script that runs them locally, and a CI job that runs them on every PR.

Closes #32

Why

Week 3 build issues need somewhere to put tests that cross services, and a PR that breaks a service should fail CI. This mirrors Magic Pocket, where releases go through integration tests with failure injection before they move on [B3].

  • Where: crates/satchel-it. The config helper is in src/lib.rs, the tests are in tests/cluster.rs.
  • Kept out of cargo test --workspace: the tests are #[ignore]d and run with cargo test -p satchel-it -- --ignored. If the cluster isn't there they fail with "connection refused" for each service, they never pass silently.
  • HTTP client: ureq with default features off (plain HTTP, no TLS, no OpenSSL). It's a dev-dependency, so the Docker image build doesn't compile it. Pinned to 3.4.2 in the lock file.
  • Which services: every Satchel service in docker-compose.yml, read from docker compose config, so nothing needs changing when docs(design): finalize the exercise plan with RS(6,3) on 9 nodes #56's 9-node cluster lands. A declared service that's down fails the tests instead of being skipped.
  • Config: each URL defaults to the service's Compose host port, and SATCHEL_IT_<SERVICE>_URL overrides it (for example SATCHEL_IT_NODE_Z1_URL), so the same suite can point at the AWS cluster later. Readiness polls /health for up to 60 s (SATCHEL_IT_READY_TIMEOUT_SECS), with no fixed sleeps.
  • First tests: ts_svc_1_all_services_healthy and ts_node_4_nodes_report_their_zone. A failure lists every broken service with its URL and what it returned.
  • Compose race from Set up local dev environment and verify the repo builds #1: the script and the CI job build satchel:dev once, then run docker compose up -d --wait without --build. docker-compose.yml itself is unchanged.

How to check it

cargo test --workspace            # the two integration tests show as ignored
scripts/integration-test.sh       # builds, starts the cluster, runs them, tears down
  • The new Integration tests (Compose) job should pass on this PR.
  • To see it fail: change "satchel-api" to anything else in crates/satchel-api/src/main.rs and run the script. It fails with:
    api at http://localhost:8080/health: expected service "satchel-api" with status "ok", got {"service":"satchel-broken",...}

Once the job has passed on main a few times, I'll ask @frectrium to make it a required check.

Checklist

  • cargo fmt, cargo clippy and cargo test pass locally (code PRs)
  • Tests added or updated for the change (code PRs)
  • New sources are added to docs/sources/README.md (research PRs)
  • Design decisions are recorded in the Design Decision Log
  • Docs and README are updated if behaviour or setup changed

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.

[Infra] Integration test harness on the local cluster, run in CI

1 participant