grafana / k6-operator

An operator for running distributed k6 tests.
Apache License 2.0
578 stars 158 forks source link

Extend support for browser tests #403

Open chan4lk opened 4 months ago

chan4lk commented 4 months ago

Brief summary

When the total number of virtual users are more than 100 the runner image is not spawning new jobs.

k6-operator version or image

grafana/k6:0.50.0-with-browser

Helm chart version (if applicable)

No response

TestRun / PrivateLoadZone YAML

apiVersion: k6.io/v1alpha1 kind: TestRun metadata: name: run-k6-from-configmap-ui spec: parallelism: 4 separate: true runner: image: grafana/k6:master-with-browser script: configMap: name: scenarios-test file: LOAD-test.js arguments: --out cloud

Other environment details (if applicable)

AKS

Steps to reproduce the problem

import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.1/index.js'; import { browser } from 'k6/experimental/browser'; import { sleep, check } from 'k6';

export function handleSummary(data) { return { stdout: textSummary(data, { indent: ' ', enableColors: true }), }; }

export const options = { "discardResponseBodies": true, "thresholds": { "checks": [ "rate==1.0" ], "browser_web_vital_lcp": [ "p(95)<3000", "max<5000" ], "iteration_duration": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:root}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:root}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:news}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:news}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:solar}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:solar}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:statistics}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:statistics}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:contact}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:contact}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:tariff}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:tariff}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:publications}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:publications}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:resources}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:resources}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:powergrids}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:powergrids}": [ "max<31000", "p(95)<26000" ], "browser_web_vital_lcp{page:licensees}": [ "max>0", "max<5000", "p(95)<3000" ], "iteration_duration{scenario:licensees}": [ "max<31000", "p(95)<26000" ] }, "cloud": { "name": "http://example.net LOAD Tests", "projectID": ***** }, "scenarios": { "root": { "exec": "root", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "root" }, "options": { "browser": { "type": "chromium" } } }, "news": { "exec": "news", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "news" }, "options": { "browser": { "type": "chromium" } } }, "solar": { "exec": "solar", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "solar" }, "options": { "browser": { "type": "chromium" } } }, "statistics": { "exec": "statistics", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "statistics" }, "options": { "browser": { "type": "chromium" } } }, "contact": { "exec": "contact", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "contact" }, "options": { "browser": { "type": "chromium" } } }, "tariff": { "exec": "tariff", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "tariff" }, "options": { "browser": { "type": "chromium" } } }, "publications": { "exec": "publications", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "publications" }, "options": { "browser": { "type": "chromium" } } }, "resources": { "exec": "resources", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "resources" }, "options": { "browser": { "type": "chromium" } } }, "powergrids": { "exec": "powergrids", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "powergrids" }, "options": { "browser": { "type": "chromium" } } }, "licensees": { "exec": "licensees", "executor": "ramping-vus", "startVUs": 0, "stages": [ { "duration": "12s", "target": 20 }, { "duration": "96s", "target": 20 }, { "duration": "12s", "target": 0 } ], "gracefulRampDown": "0s", "tags": { "page": "licensees" }, "options": { "browser": { "type": "chromium" } } } } };

export async function navigate(url){ const page = browser.newPage();

  try {
    await page.goto('http://example.net' + url);
    page.waitForSelector('.cmp-pre-loader', { state: 'hidden'});
    check(page, {
      'root visible': p => p.locator('.root') && p.locator('.root').isVisible() 
    })
    sleep(1);
  } finally {
    page.close();
  }

}

export async function root () { await navigate('/'); }

Expected behaviour

K6 operator should spin runner jobs.

Actual behaviour

No runner jobs are started.

yorugac commented 4 months ago

Hi @chan4lk, thanks for opening the issue. As of now, browser tests are not considered fully working with k6-operator. We've been tracking that in this PR so far:

289

I'm renaming this issue to be more specific about the problem.