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

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

k6 in continuous integration and on Kubernetes (k6-operator)

Automate performance tests: k6 in GitHub Actions and GitLab CI with blocking thresholds, distribu...

Performance testing best practices with k6

Checklist for useful load tests: objectives, realistic scenarios, environment, thresholds, observ...

End-to-end CI/CD (2/5): continuous integration, testing and quality

Succeed with continuous integration: the test pyramid, unit, integration, contract and end-to-end...

Thresholds, metrics and results of a k6 test

Read the summary of a k6 test, understand the built-in metrics (http_req_duration, http_req_faile...

Load testing with Grafana k6: why, and which types of tests

Why test performance before production, the types of tests (smoke, load, stress, spike, soak, bre...

Measuring DevOps performance: DORA metrics, SPACE and continuous improvement

Measure and improve delivery performance: the DORA metrics (deployment frequency, lead time, chan...

End-to-end CI/CD (1/5): principles and anatomy of a pipeline

Understand end-to-end CI/CD: continuous integration, continuous delivery and continuous deploymen...

Website monitoring: availability, HTTPS monitoring, certificates and performance

Set up website monitoring: availability and HTTPS checks, certificate expiry, response time, Core...

Git Sync in Grafana: version dashboards in GitHub

Sync Grafana dashboards and folders with a GitHub repository: prerequisites, token, setup in Admi...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!