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

Add tc39/test262 tests in k6 #1747

Merged
merged 26 commits into from
Dec 14, 2020
Merged

Add tc39/test262 tests in k6 #1747

merged 26 commits into from
Dec 14, 2020

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Nov 30, 2020

https://github.com/tc39/test262/blob/main/INTERPRETING.md Should probably be used as reference ... about what the test metadata (and not only) means

@mstoykov mstoykov requested review from imiric and na-- November 30, 2020 14:48
@codecov-io
Copy link

codecov-io commented Nov 30, 2020

Codecov Report

Merging #1747 (98c189f) into master (40979fd) will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1747      +/-   ##
==========================================
+ Coverage   71.40%   71.47%   +0.06%     
==========================================
  Files         178      178              
  Lines       13751    13777      +26     
==========================================
+ Hits         9819     9847      +28     
+ Misses       3320     3317       -3     
- Partials      612      613       +1     
Flag Coverage Δ
ubuntu 71.42% <ø> (+0.06%) ⬆️
windows 70.02% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
ui/form.go 58.33% <0.00%> (-5.31%) ⬇️
js/runner.go 80.45% <0.00%> (-0.66%) ⬇️
js/modules/k6/http/request.go 80.00% <0.00%> (-0.65%) ⬇️
js/modules/k6/grpc/client.go 78.82% <0.00%> (-0.36%) ⬇️
cmd/common.go 36.36% <0.00%> (ø)
js/modules/k6/ws/ws.go 81.56% <0.00%> (ø)
js/modules/k6/html/html.go 81.95% <0.00%> (ø)
cmd/config.go 84.92% <0.00%> (+1.58%) ⬆️
lib/executor/vu_handle.go 95.23% <0.00%> (+1.90%) ⬆️
lib/types/types.go 89.55% <0.00%> (+3.98%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 40979fd...0e0e97e. Read the comment docs.

@@ -83,6 +83,28 @@ jobs:
fi
go test "${args[@]}" -timeout 800s ./...

tc39:
runs-on: ubuntu-latest
steps:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to run this on every commit? We might be OK with just running them on each release (version tag), especially if they're flaky, and we should probably exclude it from the requirements for a successful build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. there are currently no requirements (I think)
  2. they aren't really flaky ... just they sometimes take too much time - predomenantly when I increase them or decide to try to enable parallel execution ... OR maybe they take too much memory 🤷‍♂️
  3. In the end we might move them to not being run on eveyr commit :D, but currently they are in development :P

Copy link
Member

Choose a reason for hiding this comment

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

We can move this to its own job, and have it run only when files in js were changed with https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths

That said, if it takes less than 10 minutes, this is probably good enough...

na--
na-- previously approved these changes Dec 9, 2020
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

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

I don't have time to dive into the nitty-gritty details (e.g. tc39TestCtx.runTC39Test() and how exactly the TC39 test suite is structured), but overall I quite like how you've structured the tests on the k6 side ❤️

@mstoykov, what do you think about exporting the ctx.errors to another JSON file, and saving it as a build artifact in github actions, not just printing it to stdout? That way it'd be easier to diff the changes when there are issues, and it shouldn't be too difficult to do.

cd TestTC39/test262
git init
git remote add origin https://github.com/tc39/test262.git
git fetch origin --depth=1 72154b17fc99a26e79b2586960f059360d4ce43d
Copy link
Member

Choose a reason for hiding this comment

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

What is so special about this commit? And if you don't want to use master because of potential future flakyness, can we have this commit ID as an environment variable, so it'd be a bit more visible and easier to update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the latest commit at the time I started :D

@@ -83,6 +83,28 @@ jobs:
fi
go test "${args[@]}" -timeout 800s ./...

tc39:
runs-on: ubuntu-latest
steps:
Copy link
Member

Choose a reason for hiding this comment

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

We can move this to its own job, and have it run only when files in js were changed with https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths

That said, if it takes less than 10 minutes, this is probably good enough...

js/tc39/README.md Outdated Show resolved Hide resolved
}

func TestTC39(t *testing.T) {
if testing.Short() {
Copy link
Member

Choose a reason for hiding this comment

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

I had no idea this existed... And I'm not sure I even like it, given the existence of build flags. but oh well... 🤷‍♂️ On the other hand, I ❤️ the skip message below, and how we can optionally include the tc39 tests in our normal golang tests, or not!

@mstoykov
Copy link
Contributor Author

@mstoykov, what do you think about exporting the ctx.errors to another JSON file, and saving it as a build artifact in github actions, not just printing it to stdout? That way it'd be easier to diff the changes when there are issues, and it shouldn't be too difficult to do.

My current way of doing it is to echo {} > breaking_test_errors.json and then get the json out of the output ... I would like to dump what the breaking_test_errors.json should be so the test pass ... but this will require some more monkeying with the ctx.errors as it currently only records what isn't in ctx.expectedErrors ... and I will need some way to merge them together - probably not hard, but I really prefer not to have to run the test 2-10 times again to check out that I did right.

I also do intend on coming back to enable/disable more tests and hopefully reorganize it so we can have proper concurrent execution ... and probably some memory usage reduction, so this will just be ... one more thing to fix ... next year :P

Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

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

Fantastic work @mstoykov!!! 👏

I saw some commented out code in places, but there's probably a good reason you left it there, so it's fine.

I would echo Ned's suggestion to only run this if files in js change, or even on master commits and version tags only. We don't really need it for every PR, even if it takes less than 10 minutes.

@mstoykov mstoykov changed the title PoC tc39/test262 tests in k6 Add tc39/test262 tests in k6 Dec 10, 2020
@mstoykov
Copy link
Contributor Author

The workflows change seems to work #1764
It will run on every master push and tags and on PRs that changes anything in the js directory

@mstoykov mstoykov requested review from imiric and na-- December 10, 2020 15:56
Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

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

Just squash/rebase.

@mstoykov mstoykov merged commit 15e15e5 into master Dec 14, 2020
@mstoykov mstoykov deleted the addTestTc39Test262 branch December 14, 2020 09:00
@mstoykov mstoykov added this to the v0.30.0 milestone Jan 8, 2021
salem84 pushed a commit to salem84/k6 that referenced this pull request Feb 3, 2021
@na-- na-- mentioned this pull request Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants