-
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
Remove most direct access to the os
package, support NO_COLOR
and K6_NO_COLOR
#2410
Conversation
2c25149
to
c090d0c
Compare
Forgot that this PR has a minor breaking change. I renamed the Also, I noticed that in the docs, we advertise that the option can be configured through |
With the last commit I had to fix a minor issue where an error in the CLI flags (the parsing of which happens before |
cmd/
to get rid of most direct os
package accessos
package, support NO_COLOR
and K6_NO_COLOR
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 will wait for clarification on the no color options not working on my sides. Other than that, I've spotted a few places that could use documentation. Thumbs up otherwise, it's a nice change 🎉
PS: 👎🏻 on working on the weekend though ;)
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.
For now only just one suggestion.
and PRs that add more tests are going to be quite welcome
I can try to support here, which part did you see very fragile and you would get some tests?
It will probably be better to add any tests on top of #2412, it's much cleaner and easier to add them there. And it's not that I see the changes in these PRs as fragile, quite the opposite, they are much more robust than the previous code. The problem is that before #2412, it was just so flaky and unpractical to test logic in See this file for some simple tests I did in the other PR. |
I meant which part of the code we think it's more exposed to be broken in the future if we wouldn't add tests for it. I didn't mean that the current changes are fragile. Btw, I will add some on top of #2412, as you suggested, if I will identify something useful by reviewing and testing the PRs. |
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
I'm honestly not sure which part would benefit the most 😅 Maybe we can look at the code coverage by just running the existing |
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.
🎉 👍🏻
General comment, what is the idea behind |
It is scary, but the question is "is is scarier than everything directly touching the I have some ideas for further improvements here, but so far this seems to work out very well and unlock very nice integration testing, see #2412 for the follow-up 🤷♂️ |
My concern is that |
Lines 80 to 100 in f82b364
@olegbespalov, "many other things" seems like a bit of an exaggeration 😕 Out of these 16 things, 11 are |
@olegbespalov, any other comments or more specific suggestions? |
This makes everything much more easily testable!
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 as much as it can as that code is always hairy 😬.
I would've preferred more new tests for what previously wasn't testable.
This will ensure we have the same behavior as previous k6 version there's an error before setupLoggers() is executed, e.g. when parsing a wrong CLI flag. However, we will now also respect NO_COLOR and K6_NO_COLOR and disable it when they are specified.
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.
🎉 🍾 🍪
This wasn't quite part of the plan, but several hours of yak shaving produced some nice results 😅 Anyway,
cmd/
looks much nicer and it's now finally safe to test with basically full internal integration tests 🎉That said, there is a very high chance of bugs and errors, since we don't yet have full test coverage of
cmd/
... 😞 So a careful review and PRs that add more tests are going to be quite welcome 🙇 Ideally, we should try to merge this at the beginning of the v0.38.0 cycle, so we also have the maximum time to safely hit any bugs during our manual tests and work...And I think there were actually some (potential) bugs that were fixed by this refactor. For example, these loggers:
k6/cmd/root.go
Lines 163 to 175 in 1e28a3e
Did not actually use the wrapped
stdout
that is protected by a mutex:k6/cmd/root.go
Line 97 in 1e28a3e
With the last commit, this PR also closes #2091 🎉