Refactor k6 development environment to prepare for regular runs in CD #4903
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Part of https://github.com/WordPress/openverse-infrastructure/issues/1031
Description
This PR refactors the k6 development environment in preparation for running the k6 frontend suite after staging deployments.
This refactor (hopefully) does the following:
ov
instead of using a Docker wrapper. This also includes simpler and more reusable just recipes.k6 login
, as we would need to sort out volumes for k6 to store credentials or otherwise map credentials in.utilities
directory is not linted by ESLint!).run
API, and simplifies scenario selection (makes it more static).There are probably lots of further improvements to be made that get this closer in line with typical k6 examples. Scenarios seem powerful, but also potentially get in the way of configurability, as they do not support cli options for configuration (see link in code explaining this). k6's docs also have information about grouping tests and such, which we aren't really following. See this section of their docs:
https://grafana.com/docs/k6/latest/using-k6/tags-and-groups/#discouraged-one-group-per-request
We might be able to simplify things a lot further by reading k6 docs and understanding its best practices better, before adding many more scenarios (like for the API). This PR gets us in a better place to do that, because it enhances the developer experience and lays some groundwork for improving the code organisation. In other words, this PR is not the end-all-be-all of k6 improvement, and is just a start!
Testing Instructions
Checkout the repository and run
ov init
to get the new k6 and words dependency.Now run
ov just k6 frontend static-en -e scenario_vus=1 -e scenario_iterations=1
and confirm it runs! You might get blocked by Cloudflare, but you should see at least the HTML output of the Cloudflare managed challenge page 😁Checklist
Update index.md
).main
) or a parent feature branch.ov just catalog/generate-docs
for catalogPRs) or the media properties generator (
ov just catalog/generate-docs media-props
for the catalog or
ov just api/generate-docs
for the API) where applicable.Developer Certificate of Origin
Developer Certificate of Origin