diff --git a/overlays/deploy/k6-configmap.yaml b/overlays/deploy/k6-configmap.yaml new file mode 100644 index 0000000..8f1b4a4 --- /dev/null +++ b/overlays/deploy/k6-configmap.yaml @@ -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(''),\n });\n });\n\n sleep(0.5);\n\ + }"