-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 ReadableStream support to k6 #3696
Conversation
Co-authored-by: oleiade <theo@crevon.me>
Co-authored-by: oleiade <theo@crevon.me>
Co-authored-by: oleiade <theo@crevon.me>
Co-authored-by: oleiade <theo@crevon.me>
Co-authored-by: oleiade <theo@crevon.me>
b434c6e
to
3e5ddc9
Compare
3e5ddc9
to
347a26d
Compare
js/modules/k6/experimental/streams/tests/readable-streams/bad-strategies.js
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3696 +/- ##
==========================================
- Coverage 73.29% 70.79% -2.51%
==========================================
Files 278 287 +9
Lines 20456 21159 +703
==========================================
- Hits 14994 14979 -15
- Misses 4505 5217 +712
- Partials 957 963 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
aeb0b07
to
c691261
Compare
I have pushed a few more commits with some changes that go in the line of what has been discussed here. Note that the approach is specific for streams, thus not extensible, but I guess we can postpone the task of finding a way to make the WPTs setup available for other suites as a separate work. I also took the opportunity to remove the support for Please, let know what do you think about the new approach. Thanks! 🙇🏻 |
+ // We don't want to rely on the DOM and other browser-based | ||
+ // mechanisms for reporting test failures. Instead, we just | ||
+ // throw the error and make it fail fast, to be aware of it. | ||
+ // | ||
+ // In the future, we might want to add a way to report these | ||
+ // that doesn't rely on a browser, but let all test end before | ||
+ // actually reporting failures. | ||
+ // But, as a first iteration, this approach should suffice. | ||
+ throw `${this.name} failed - ${e}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess here set_status
above should be the thing that marks tests as failed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but that status isn't directly reflected in any way through how we do run the tests, just kept in-memory stored as information associated with the test.
That's why I suggested there to explore a mechanism to do so, like "building" our own test environment, but I'd prefer to leave that for the next iteration as for now it's more than enough (it reports the failures) and the major drawback is that it fail fast and doesn't run all the tests when there's an error, which shouldn't be that bad for an initial release, as long as the behavior is correct.
(cc/ @oleiade as you'll most likely take over 🙇🏻)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general.
I have left some more nits.
I am still not certain about a bunch of the stuff around the running of the tests.
Also if locked
is supposed to be read only - the test definitely do not test for this as having as an exported field on a struct let it be set from goja.
So maybe we should have more test than just hte ones in the test suite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Just please squash on merge 😬 |
👍🏻 😄 🦖 |
What?
It adds support for ReadableStream from Streams API through experimental
k6/experimental/streams
module.Why?
This is a prerequisite to unlock the development of other features in k6. It is also a nice-to-have feature for k6 users in general, that may want to use
ReadableStream
on their own.Note for the reviewer
You can find the rationale behind some technical decisions (around goja, promises, etc) present on this changeset, in this
Google Doc that I used to write some personal notes, as takeaways during the development process.
On top of that, @oleiade and I decided to keep the code comments for each step of those operations defined in the spec because it makes it easier to:
So, although I know these could be arguable for some people, I'd personally push to keep them as long as I need to maintain and take care of this code.
Checklist
make lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
Closes #3659
Contributes to #2978