Add k6 Performance Test Project & CI Pipeline#3
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new k6-based performance test suite for the Restful Booker API and wires it into GitHub Actions, while also reorganizing/renaming the existing functional test project and workflow to align with the new structure.
Changes:
- Introduced
Restful.Booker.Api.PerformanceTests(k6 scripts, shared env/threshold config, auth helper) to run ping/auth/booking lifecycle load tests. - Reorganized solution/project layout and updated the root
.slnxto point at the renamed functional test project. - Added a dedicated GitHub Actions workflow for performance tests and renamed the functional workflow for consistency.
Reviewed changes
Copilot reviewed 14 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Restful.Booker.Api/Restful.Booker.Api.slnx | Removes old solution location under Restful.Booker.Api/. |
| Restful.Booker.Api.slnx | Adds new root solution referencing the functional test project. |
| Restful.Booker.Api.PerformanceTests/config/environments.js | Centralizes k6 environment configuration (base URL + credentials). |
| Restful.Booker.Api.PerformanceTests/config/thresholds.js | Defines shared k6 thresholds for error rate, latency, and checks. |
| Restful.Booker.Api.PerformanceTests/helpers/auth-helper.js | Adds shared helper to obtain an auth token for k6 tests. |
| Restful.Booker.Api.PerformanceTests/tests/ping-performance-tests.js | Adds k6 load test for GET /ping with tagged threshold. |
| Restful.Booker.Api.PerformanceTests/tests/auth-performance-tests.js | Adds k6 load test for POST /auth with tagged threshold. |
| Restful.Booker.Api.PerformanceTests/tests/booking-performance-tests.js | Adds k6 CRUD lifecycle load test for bookings with per-endpoint thresholds. |
| Restful.Booker.Api.PerformanceTests/package.json | Adds convenience npm scripts to run individual/all k6 suites locally. |
| Restful.Booker.Api.FunctionalTests/Restful.Booker.Api.FunctionalTests.csproj | Introduces the renamed functional test project configuration and dependencies. |
| Restful.Booker.Api.FunctionalTests/xunit.runner.json | Adds xUnit runner configuration for the functional test project. |
| Restful.Booker.Api.FunctionalTests/Config/ApiSettings.cs | Adds typed configuration binding for API settings and credentials. |
| Restful.Booker.Api.FunctionalTests/Config/TestConfiguration.cs | Adds configuration loading/binding for functional tests. |
| Restful.Booker.Api.FunctionalTests/Config/appsettings.json | Adds default API settings for functional tests. |
| Restful.Booker.Api.FunctionalTests/Fixtures/TestFixture.cs | Adds shared fixture with HttpClient + token acquisition for functional tests. |
| Restful.Booker.Api.FunctionalTests/Models/*.cs | Adds DTOs for auth/booking payloads used in functional tests. |
| Restful.Booker.Api.FunctionalTests/Controllers/*_FunctionalTests.cs | Renames/aligns controller test classes to “FunctionalTests”. |
| .github/workflows/run-functional-tests.yaml | Renames workflow and adjusts permissions (but needs fixes). |
| .github/workflows/run-performance-tests.yaml | Adds new CI workflow to run k6 performance test suites. |
Comments suppressed due to low confidence (2)
.github/workflows/run-functional-tests.yaml:13
permissions.contentsis set toreads, but valid values areread,write, ornone. As written, the workflow will fail to validate/apply permissions; change it toread.
.github/workflows/run-functional-tests.yaml:4- This workflow still restores/builds/tests
Restful.Booker.Api/Restful.Booker.Api.slnx, but the repo now has the solution at the root (Restful.Booker.Api.slnx) and noRestful.Booker.Api/directory. Update thedotnet restore/build/testcommands to use the new solution path so CI doesn't fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new k6 performance test project targeting the Restful Booker API and integrates it into a dedicated GitHub Actions pipeline.
Changes
Repository structure
CI pipeline
run-performance-tests.yaml— triggers on push/PR tomainandworkflow_dispatch; uses the officialgrafana/setup-k6-actionandgrafana/run-k6-actionactions; passesBASE_URL,API_USERNAME, andAPI_PASSWORDvia repository secrets with in-script defaults as fallbackk6 performance test project (
Restful.Booker.Api.PerformanceTests)http_req_failed < 1%,p(95) < 3s,checks > 95%)POST /authGET /pingPOST /authGET,POST,GET /{id},PUT /{id},DELETE /{id}) with per-endpoint tagged thresholdsTesting
All three test suites pass locally against
https://restful-booker.herokuapp.com: