feat(k6): add bespoke load test ConfigMap
This commit is contained in:
22
overlays/deploy/k6-configmap.yaml
Normal file
22
overlays/deploy/k6-configmap.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: k6-test-vote
|
||||
namespace: demo-apps
|
||||
labels:
|
||||
app: vote
|
||||
app.kubernetes.io/managed-by: backstage
|
||||
app.kubernetes.io/component: load-testing
|
||||
data:
|
||||
load-test.js: "import http from 'k6/http';\nimport { check, sleep, group } from\
|
||||
\ 'k6';\n\nexport const options = {\n scenarios: {\n load_test: {\n executor:\
|
||||
\ 'ramping-vus',\n startVUs: 0,\n stages: [\n { duration: ''10s'',\
|
||||
\ target: 10 },\n { duration: ''30s'', target: 10 },\n { duration:\
|
||||
\ '5s', target: 0 },\n ],\n },\n },\n thresholds: {\n http_req_duration:\
|
||||
\ ['p(95)<500'],\n http_req_failed: ['rate<0.01'],\n },\n};\n\nconst BASE_URL\
|
||||
\ = 'http://vote.demo-apps.svc.cluster.local:80';\n\nexport default function ()\
|
||||
\ {\n group('Main Page', () => {\n const res = http.get(`${BASE_URL}/`);\n\
|
||||
\ check(res, {\n 'status is 200': (r) => r.status === 200,\n 'response\
|
||||
\ time < 500ms': (r) => r.timings.duration < 500,\n 'body contains HTML':\
|
||||
\ (r) => r.body.includes('<!DOCTYPE html>'),\n });\n });\n\n sleep(0.5);\n\
|
||||
}"
|
||||
Reference in New Issue
Block a user