Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run k6 against local Nuxt on PRs #4924

Merged
merged 7 commits into from
Sep 25, 2024
Merged

Run k6 against local Nuxt on PRs #4924

merged 7 commits into from
Sep 25, 2024

Conversation

sarayourfriend
Copy link
Collaborator

@sarayourfriend sarayourfriend commented Sep 13, 2024

Fixes

Part of https://github.com/WordPress/openverse-infrastructure/issues/1031 by @obulat
Depends on and is blocked by #4908.

Description

Run k6 against a locally running Nuxt in PRs. This acts as an integration test of the k6 tests themselves, as well as an informal performance test of the local Nuxt application (albeit, without constraints or anything to normalise the results).

I'm not comfortable yet failing this check if any of the k6 requests fail, because I don't know how reliable it will be to run these tests in the GitHub runner with its specific resources constraints. We can evaluate that in this PR and add it now or later if we like.

Testing Instructions

Check out the new CI step in this PR and see that it makes sense. It should leave a comment with the k6 text summary.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • [N/A] I tried running the project locally and verified that there are no visible errors.
  • [N/A] I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) 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
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend added 🟨 priority: medium Not blocking but should be addressed soon 🌟 goal: addition Addition of new feature 🤖 aspect: dx Concerns developers' experience with the codebase 🧱 stack: mgmt Related to repo management and automations labels Sep 13, 2024
@sarayourfriend sarayourfriend changed the title WIP: Run k6 in CI/CD Run k6 against local Nuxt on PRs Sep 17, 2024
Copy link

github-actions bot commented Sep 17, 2024

Latest k6 run output1

$     ✓ status was 200

     checks.........................: 100.00% ✓ 8000      ✗ 0   
     data_received..................: 1.8 GB  8.1 MB/s
     data_sent......................: 1.0 MB  4.7 kB/s
     http_req_blocked...............: avg=12.85µs  min=1.35µs  med=2.82µs   max=6.61ms  p(90)=3.86µs   p(95)=4.17µs  
     http_req_connecting............: avg=9.74µs   min=0s      med=0s       max=6.55ms  p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=583.89ms min=68.32ms med=521.82ms max=2.48s   p(90)=1.09s    p(95)=1.21s   
       { expected_response:true }...: avg=583.89ms min=68.32ms med=521.82ms max=2.48s   p(90)=1.09s    p(95)=1.21s   
   ✓ http_req_failed................: 0.00%   ✓ 0         ✗ 8000
     http_req_receiving.............: avg=167.31µs min=42.42µs med=120.28µs max=17.41ms p(90)=202.03µs p(95)=251.47µs
     http_req_sending...............: avg=23.47µs  min=7.65µs  med=20.99µs  max=2.48ms  p(90)=28.02µs  p(95)=34.85µs 
     http_req_tls_handshaking.......: avg=0s       min=0s      med=0s       max=0s      p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=583.7ms  min=68.17ms med=521.61ms max=2.48s   p(90)=1.09s    p(95)=1.21s   
     http_reqs......................: 8000    35.581607/s
     iteration_duration.............: avg=3.9s     min=1.08s   med=3.24s    max=11.39s  p(90)=8.28s    p(95)=8.94s   
     iterations.....................: 1200    5.337241/s
     vus............................: 10      min=10      max=30
     vus_max........................: 30      min=30      max=30

Footnotes

  1. This comment will automatically update with new output each time k6 runs for this PR

@sarayourfriend
Copy link
Collaborator Author

Okay, so that summary doesn't work, whoops 😅 I'll have to find another way to capture it.

@sarayourfriend sarayourfriend force-pushed the add/grafana-k6-cicd branch 3 times, most recently from 2f13a67 to 102c8c4 Compare September 19, 2024 03:25
@sarayourfriend sarayourfriend changed the base branch from main to add/staging-deploy-k6 September 19, 2024 03:25
@openverse-bot openverse-bot added the 🧱 stack: frontend Related to the Nuxt frontend label Sep 19, 2024
@sarayourfriend
Copy link
Collaborator Author

Okay, the tests are getting throttled when they make API calls. That makes sense. Because these are only local tests meant to test the frontend (and to ensure the tests themselves work), I think it's appropriate to incorporate talkback here. I'll generate new tapes, and have a commit soon to add that.

@sarayourfriend sarayourfriend force-pushed the add/grafana-k6-cicd branch 7 times, most recently from c8a0f27 to c41a5f5 Compare September 19, 2024 10:01
@sarayourfriend
Copy link
Collaborator Author

Finally! It works! Mostly! Yay! I'll push some last tidy-up changes and then undraft this, though it is still blocked on #4908. @obulat any chance you will have an opportunity to review these monorepo PRs, if not also the infrastructure one?

@sarayourfriend sarayourfriend marked this pull request as ready for review September 19, 2024 10:24
@sarayourfriend sarayourfriend requested review from a team as code owners September 19, 2024 10:24
@sarayourfriend sarayourfriend requested review from krysal, dhruvkb and obulat and removed request for a team September 19, 2024 10:24
Base automatically changed from add/staging-deploy-k6 to main September 20, 2024 00:59
@sarayourfriend sarayourfriend force-pushed the add/grafana-k6-cicd branch 2 times, most recently from 59a408a to a480cf9 Compare September 20, 2024 02:49
@obulat obulat mentioned this pull request Sep 25, 2024
8 tasks
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running these tests locally, and all of the fa locale tests have failed because the /fa url shows the "This content has disappeared" error page. Does it run fine for you?

I remember I added the fa locale for RTL instead of the ar locale to these tests, but don't remember the reason. Will have to look it up.

My main blocker to this PR is the number of lines changed. I know those are due to the added tapes, so I opened a PR to only save the first 200 peaks of the audio response.

@sarayourfriend
Copy link
Collaborator Author

I tried running these tests locally, and all of the fa locale tests have failed because the /fa url shows the "This content has disappeared" error page. Does it run fine for you?

Yes, but you need to install production translations (which the CI step does using setup-env with locales: "production"). This is a pre-existing issue with these test scripts. If you remember why and we can change it to use the ar so we can use the test locales (or we can import the current fa strings as a new testing locale?) works for me.

Thanks for the change to limit the peaks, that's perfect, I've merged that into this PR.

@sarayourfriend
Copy link
Collaborator Author

Another method of reducing the tape size, is we could minify parts of them, or perhaps the entire tape. It's nice for them to be inspectable when that's needed, but really we could probably leave them minified by default... It would certainly make the line counts less surprising when adding new tapes!

@obulat
Copy link
Contributor

obulat commented Sep 25, 2024

Another method of reducing the tape size, is we could minify parts of them, or perhaps the entire tape. It's nice for them to be inspectable when that's needed, but really we could probably leave them minified by default... It would certainly make the line counts less surprising when adding new tapes!

I do use the tape contents sometimes, e.g. when trying to find which id is being opened from the search page - to make sure that the tape exists, or to add exactly that tape.

Yes, but you need to install production translations (which the CI step does using setup-env with locales: "production"). This is a pre-existing issue with these test scripts. If you remember why and we can change it to use the ar so we can use the test locales (or we can import the current fa strings as a new testing locale?) works for me.

Oh, I didn't realize it was using the production locales :)
I think I might have wanted to change a locale that doesn't exist. Maybe we should try to change it back to ar and see if anything breaks? I don't think it would break anything, and I don't think we need to test non-existent locale.

Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, excited to have the tests running soon 🚀

@@ -668,6 +668,86 @@ jobs:
env:
DEPLOYMENT_ENV: production

nuxt-load-test:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the load testing could be split to a separate action?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially, and it's something I plan to look into when adding the job to run k6 against staging in the next PR after this one. The steps to run k6 on a local environment are so different than running it against a remote environment, I wanted to make sure I didn't abstract too early 🙂

@sarayourfriend
Copy link
Collaborator Author

I'll push a change to use ar instead of fa and then merge this provided things pass 🙂

We can also opt to make locales configurable if we want to run against more or different locales in live environments.

@sarayourfriend sarayourfriend merged commit d3553f2 into main Sep 25, 2024
52 checks passed
@sarayourfriend sarayourfriend deleted the add/grafana-k6-cicd branch September 25, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🌟 goal: addition Addition of new feature 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend 🧱 stack: mgmt Related to repo management and automations
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants