Add Grafana K6 performance test scripts for all 5 microservices#27
Add Grafana K6 performance test scripts for all 5 microservices#27devin-ai-integration[bot] wants to merge 2 commits into
Conversation
- Identity, Customer, Order, Product, Notification service tests - Shared config (config.js) with env vars, stages, thresholds - Shared utils (utils.js) with auth helpers and check functions - Test data JSON files for data-driven testing via SharedArray - Bearer token & Basic auth support with setup() function - Response validation via check() on status, timing, body - Logical grouping of requests via group() - Ramp-up/steady/spike/ramp-down load stages - Per-group threshold assertions for p95/p99 latency
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| const headers = token | ||
| ? { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: `Bearer ${token}` } | ||
| : { 'Content-Type': 'application/json', Accept: 'application/json' }; |
There was a problem hiding this comment.
🟡 Notification test setup() missing basic auth fallback, unlike default function
In notification-test.js, the setup() function constructs headers manually (lines 53-55) and sends the seed POST request without any Authorization header when fetchBearerToken() returns null. However, the default function (lines 82-84) correctly falls back to basicAuthHeaders() when no token is available. This inconsistency means the seed request goes out unauthenticated while all other requests use Basic auth. If the service (or API Gateway) requires authentication but the token endpoint is unavailable, the seed request will fail with 401, leaving seededId as null. This silently causes Groups 3 and 4 ("Get By ID" and "Preview") to be skipped entirely (line 158), so half the notification test coverage is lost without any test failure or warning.
| const headers = token | |
| ? { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: `Bearer ${token}` } | |
| : { 'Content-Type': 'application/json', Accept: 'application/json' }; | |
| const headers = token | |
| ? { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: `Bearer ${token}` } | |
| : basicAuthHeaders(); |
Was this helpful? React with 👍 or 👎 to provide feedback.
- all-services-test.js: 10 VUs (2 per service), 25 iterations each, 5 min duration - Per-VU scenarios using per-vu-iterations executor for precise control - Expanded data sets to 20 records per service for production-realistic traffic - Custom metrics (Counter + Trend) per service for granular monitoring - Pacing with jitter to emulate realistic production request patterns - Fix Notification.API.csproj Shared project reference paths (../../ -> ../../../)
Summary
Adds Grafana K6 performance test scripts for all 5 microservices (Identity, Customer, Order, Product, Notification) plus a combined all-services test that runs 10 VUs across all services simultaneously.
Files added (
k6-tests/)config.js__ENVmapping, default stages & thresholdsutils.jscheck()wrappers for GET/POSTdata/*.jsonSharedArrayidentity-test.js/api/identity, GET/api/identity/{id}customer-test.js/api/customer, GET/api/customer/{id}order-test.js/api/order, GET/api/order/{id}product-test.js/api/product, GET/api/product/{id}notification-test.js/events/order-placedall-services-test.jsCombined test results (actual run)
All 250 iterations completed, 1750/1750 checks passed (100%), all thresholds met:
Error rate: 0.16% (1/601) — within the 5% threshold.
Bug fix included
Fixed
Notification.API.csproj— Shared project reference paths were../../Shared/but needed../../../Shared/(three levels up fromServices/Notification/Notification.API/).Review & Testing Checklist for Human
docker compose up --buildand executek6 run k6-tests/all-services-test.jsto verify end-to-endconfig.js/all-services-test.jsfor your target SLAsNotes
per-vu-iterationsexecutor for precise control: exactly 2 VUs × 25 iterations = 50 requests per serviceLink to Devin session: https://partner-workshops.devinenterprise.com/sessions/c2a7605ddb284e07a746fbc9eabb5eac
Requested by: @vinodsvv