feat(k6): add load test script (#5)
Some checks failed
CI Pipeline / Build and Test (push) Successful in 4s
Security Scanning / Gitleaks — Secret Scan (push) Failing after 5s
Security Scanning / Trivy — Filesystem & Dependency Scan (push) Failing after 6s
Security Scanning / Security Summary (push) Failing after 3s
Build and Publish TechDocs / build-and-publish (push) Successful in 1m8s
Some checks failed
CI Pipeline / Build and Test (push) Successful in 4s
Security Scanning / Gitleaks — Secret Scan (push) Failing after 5s
Security Scanning / Trivy — Filesystem & Dependency Scan (push) Failing after 6s
Security Scanning / Security Summary (push) Failing after 3s
Build and Publish TechDocs / build-and-publish (push) Successful in 1m8s
This commit was merged in pull request #5.
This commit is contained in:
36
k6/load-test.js
Normal file
36
k6/load-test.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// FALLBACK k6 load-test script.
|
||||
// This static skeleton is only used when The Watcher agent fails to generate
|
||||
// a bespoke k6 script tailored to the application's detected HTTP endpoints.
|
||||
// When generation succeeds, the agent produces a custom script that replaces
|
||||
// this file in the scaffolded output repository.
|
||||
import http from 'k6/http';
|
||||
import { check, sleep } from 'k6';
|
||||
|
||||
export const options = {
|
||||
scenarios: {
|
||||
load_test: {
|
||||
executor: 'ramping-vus',
|
||||
startVUs: 0,
|
||||
stages: [
|
||||
{ duration: '10s', target: 10 },
|
||||
{ duration: '30s', target: 10 },
|
||||
{ duration: '5s', target: 0 },
|
||||
],
|
||||
},
|
||||
},
|
||||
thresholds: {
|
||||
http_req_duration: ['p(95)<500'],
|
||||
http_req_failed: ['rate<0.01'],
|
||||
},
|
||||
};
|
||||
|
||||
const BASE_URL = `http://online-boutique.demo-apps.svc.cluster.local:80`;
|
||||
|
||||
export default function () {
|
||||
const res = http.get(`${BASE_URL}/`);
|
||||
check(res, {
|
||||
'status is 200': (r) => r.status === 200,
|
||||
'response time < 500ms': (r) => r.timings.duration < 500,
|
||||
});
|
||||
sleep(0.5);
|
||||
}
|
||||
Reference in New Issue
Block a user