-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
js/data: ModuleV2 migration #2243
Conversation
a815e60
to
d7cc535
Compare
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 apart from a minor nitpick
d7cc535
to
b55d77d
Compare
if !ok { | ||
return rt, fmt.Errorf("not a Data module instance") | ||
} |
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.
Perhaps, not even a request change, but a curiosity question: @codebien, why didn't you use require.True(t, ok)
here?
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.
assert|require with concurrency could generate a race so I tend to avoid it for helper functions if it's possible (if the func return error). Otherwise, I would prefer a classic require.True
as you suggested.
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 think what you are talking about @codebien is that t.FailNow
and co. are supposed to be called only from the goroutine that is running the test, not by anyone that is spawned by it.
We do ... not do that quite a lot it just so happens that in most cases the failure never happens 😄
I think it's perfectly fine to leave the error
instead of using require.True
and co., but also in this case I would expect it's perfectly fine to use it as well
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.
that in most cases the failure never happens
Sure, but in case of changes for refactoring, you could get the race.
but also in this case I would expect it's perfectly fine to use it as well
Yep, but I don't know how the helper could be used in the next test we will write. For this reason, I think it makes sense just for helpers shared across multiple tests. Ofc, in a single test I would prefer to use directly the assert function.
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.
All seems fine 🙂 There is just 1 "nitpick" question.
Migrated the js/data API to the new modules.Module interface (aka ModuleV2).
b55d77d
to
00f42b0
Compare
Migrated
k6/data
to themodules.Module
(akamodules.ModuleV2
) interface.