RousselTMLEARNING

TP · Grafana k6: load and performance testing

Final Lab: Blocking performance test in continuous integration

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. 1. Prepare the repository

    Why? The test lives next to the code it protects.

    In a repository, create docker-compose.yml (httpbin on port 8080) and tests/perf/smoke.js (10 VUs, 30 s, thresholds p95 < 300 ms and failures < 1%) targeting http://localhost:8080/get.
  2. 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. 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. 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

  • ⏱ Estimated time : ≈ 40 min

Sign in to track your progress and take notes. Sign in

✉️ Ask a question

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...