feat: load testing infrastructure and CI/CD pipeline#11
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds a complete end-to-end load testing infrastructure including a dedicated Go entrypoint that reuses production wiring, Docker containerization, GitHub Actions workflow for orchestration, mock payment gateway, and three k6 load test scripts for different scenarios (thundering herd, sustained load, correctness validation). Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What this does
Adds the complete deployment pipeline and load testing infrastructure for FairQueue.
CI/CD Pipeline (
.github/workflows/deploy.yml)Runs on every push to
master. Three jobs in sequence:golangci-lintandgo test ./...including integration tests via testcontainersfairqueue:latest) and load test image (fairqueue-loadtest:latest) to GitHub Container Registry in parallelLoad Test Infrastructure
Mock gateway (
internal/gateway/mock/gateway.go) — implementsgateway.PaymentGatewaywith instant success responses, isolating FairQueue's performance from Paystack's rate limits.Load test server (
cmd/loadtest/main.go) — identical to the production server but wires the mock gateway and exposes three test-only endpoints:POST /loadtest/seed— creates a known organizer for k6setup()GET /loadtest/otp— reads OTP from Redis so k6 can authenticate without emailGET /loadtest/stats— returns claim counts vs inventory for correctness assertionsThree k6 scenarios (
loadtest/scripts/):01_thundering_herd.js— 50,000 VUs ramping over 60s, stress testing queue join against Redis and Postgres02_sustained_load.js— 1,000 VUs running the full flow for 30 minutes, catching memory and goroutine leaks03_correctness_check.js— single iteration assertingclaimed_count <= total_inventoryafter a test runLoad Test Workflow (
.github/workflows/loadtest.yml)Manually triggered via
workflow_dispatchwith a scenario dropdown. Three jobs:if: always()) so the VPS is never left in a dirty stateDeployment
Dockerfile.loadtest— buildscmd/loadtestbinarydocker-compose.loadtest.yml— isolated Postgres and Redis for load testing, no shared state with productionRequired secrets
Summary by CodeRabbit
New Features
Chores