The assignment description is available here:
- Go
- PostgreSQL
- JWT auth
This repository is configured to run against a local database via environment variables in .env.local.
- Start dependencies your preferred way (local DB or existing environment).
- Run API:
make runService endpoint by default:
http://localhost:8080
Run all tests:
make testRun coverage report:
make test-coverageBusiness scenarios are covered in unit tests for:
- handlers
- security
- auth service
- wallet service
- postgres repositories and transaction manager
Implemented scenarios:
- Purchase merch flow
test/integration/buy_integration_test.go
- Coin transfer flow with sender and receiver history assertions
test/integration/transfer_integration_test.go
- Remaining routes (
/health,/api/auth,/api/info)test/integration/auth_info_health_integration_test.go
Linter configuration is provided in:
.golangci.yaml
Load testing is prepared with k6 script:
test/load/k6.js
Run load test:
make load-testTunable parameters:
BASE_URL(defaulthttp://localhost:8080)RATE(default1000)DURATION(default30s)PRE_ALLOCATED_VUS(default200)MAX_VUS(default2000)
Example custom run:
BASE_URL=http://localhost:8080 RATE=800 DURATION=60s make load-testResults template:
test/load/RESULTS.md
UNFINISHED!!!
- JWT auth with auto-registration on first login: implemented
- Unit tests for business scenarios: implemented
- Coverage > 40%: implemented
- Integration test for purchase scenario: implemented
- Integration test for coin transfer scenario: implemented
- Integration/E2E tests for remaining scenarios (optional): implemented
- Linter config (optional): implemented
- Load testing with results (optional): script and report template added, run and fill results required