feat: add load test image build and push steps to CI/CD workflow#12
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 📝 WalkthroughWalkthroughThe workflow now builds and publishes two distinct container images: the existing build job is relabeled as "production," and a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Title:
feat: load testing infrastructure and CI/CD pipelineDescription:
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