Skip to content

E2E tests#5

Merged
marcopiraccini merged 3 commits into
mainfrom
e2e-tests
May 18, 2026
Merged

E2E tests#5
marcopiraccini merged 3 commits into
mainfrom
e2e-tests

Conversation

@marcopiraccini
Copy link
Copy Markdown
Contributor

@marcopiraccini marcopiraccini commented May 18, 2026

Summary

  • Add examples/storage-db/ — a multi-tenant Postgres KV proxy that demonstrates the coordinator pattern end-to-end (3 pods + 1 coordinator + Valkey + Postgres).
  • Add test:e2e script and a CI e2e job that spawns coordinator + pod processes against GitHub Actions' Valkey + Postgres services.
  • Rewrite the "Why Kubernetes" section of coordinator-pattern.md as "Platform requirements", with explicit subsections for Kubernetes, ECS / Fargate, and Nomad / VMs / Compose. The library has no K8s-specific code; the doc previously suggested otherwise.

What the e2e test covers

  • All 3 pods register in Valkey and show up in GET /pods.
  • POST /tenants/:id picks a pod via pickAndRegister and returns the chosen memberId.
  • PUT/GET round-trip routes stickily to the owning pod.
  • least-loaded strategy spreads new tenants across pods.
  • Orphan reassignment: SIGKILL the owning pod, wait > TTL, the next request reassigns the tenant to a live pod and serves it.

Notes

  • MEMBER_TTL env var added to the storage-db pod so the e2e can exercise orphan reassignment in ~4s instead of waiting on the 30s default.
  • The pod's PUT/GET/DELETE handlers lazily ensure the per-tenant Postgres pool on first hit, so an orphan-reassigned pod can serve a tenant it never saw a POST /tenants/:id for. This matches the "cold local share opens on first hit" behavior described in coordinator-pattern.md.
  • CI matrix is Node 22, 24, 26 for both the unit and e2e jobs.

Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
@marcopiraccini marcopiraccini changed the title e2e tests E2E tests May 18, 2026
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
@marcopiraccini marcopiraccini marked this pull request as ready for review May 18, 2026 14:03
@marcopiraccini marcopiraccini merged commit 01ff460 into main May 18, 2026
16 checks passed
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