Skip to content

"Smart" browser test runs #631

@yorugac

Description

@yorugac

Feature Description

As described in this comment, k6-operator supports browser test runs with the help of grafana/k6:latest-with-browser Docker image. You have to set it as a .spec.runner.image in TestRun CRD.

This image is released together with the k6 release, and it contains browser inside:
https://github.com/grafana/k6/blob/d3035846839d7825b9f4578b76361a5a59f99985/Dockerfile#L20-L37

Similarly to the k6 local browser test, when one runs a browser test with this image, internally, k6 is starting a browser process. This makes such tests quite heavy resource-wise: each k6 pod comes with the browser process attached.

However, k6 is flexible enough to allow more complex executions: browser can be started remotely, and k6 can be confgiured to connect to it instead. This can be done with K6_BROWSER_WS_URL env var.

Consequently, it makes sense to have an M:N relation between k6 processes and browser processes: start M k6 and N browsers. In k6-operator context, it most likely means creating a new type of runner, browser-runner, and starting it before normal, k6 runners.

Suggested Solution (optional)

M should be the same as .spec.parallelism, to keep the backwards-compatibility. We might need to introduce another option in TestRun to allow user to control the N of browsers.

Browser resources can at first be hard-coded, but long-term they will likely need to be configured on a TestRun level (unless there is a way to make browser resource definition a derivative of k6 resources). Also, see this k6 issue.

Already existing or connected issues / PRs (optional)

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions