What you will learn in this TP
- Write a smoke test for CI
- Create the workflow
- Observe a blocked pull request
Introduction #
What you will learn in this section
- Write a smoke test for CI
- Create the workflow
- Observe a blocked pull request
Context. A performance regression reached production last month. From now on, no pull request may degrade latency beyond the SLO.
Prerequisites: GitHub account, test repository · Estimated time: 40 min
Performance tested on every change.Hands-on #
Guided steps, with their solutions.
1. Prepare the repository
Why? The test lives next to the code it protects.
In a repository, createdocker-compose.yml(httpbin on port 8080) andtests/perf/smoke.js(10 VUs, 30 s, thresholds p95 < 300 ms and failures < 1%) targetinghttp://localhost:8080/get.2. Write the workflow
Why? The official actions install k6 and run the script; an unmet threshold fails the job.
Create.github/workflows/perf.yml, triggered on pull requests.3. Open a healthy pull request
Why? To check the nominal path.
Push to a branch and open a pull request: the job should succeed.4. Simulate a regression
Why? Proof that the safeguard works.
Change the tested route to/delay/1(simulating slower code), push and observe the result.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
k6 en intégration continue et sur Kubernetes (k6-operator)
Automatiser les tests de performance : k6 dans GitHub Actions et GitLab CI avec seuils bloquants,...
Bonnes pratiques des tests de performance avec k6
Check-list pour des tests de charge utiles : objectifs, scénarios réalistes, environnement, seuil...