-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cli/command/container: TestSplitCpArg: cleaner skip #5230
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5230 +/- ##
=======================================
Coverage 61.48% 61.48%
=======================================
Files 298 298
Lines 20813 20813
=======================================
Hits 12797 12797
Misses 7104 7104
Partials 912 912 |
|
Let me know if you like this better, @vvoland (happy to update) |
cli/command/container/cp_test.go
Outdated
| tc := tc | ||
| t.Run(tc.doc, func(t *testing.T) { | ||
| skip.If(t, tc.os == "windows" && runtime.GOOS != "windows" || tc.os == "linux" && runtime.GOOS == "windows") | ||
| nonMatchingPlatform := tc.os == "windows" && runtime.GOOS != "windows" || tc.os == "unix" && runtime.GOOS == "windows" |
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 was mostly concerned about splitting the OR'd parts into a separate variables to be honest 😅
a := tc.os == "windows" && runtime.GOOS != "windows"
b := tc.os == "unix" && runtime.GOOS == "windows"
skip.If(t, a || b)Mostly because it's easier to wrap your head about the end-result by looking at each of them separately, instead of trying to parse the whole 4 product expression.
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.
Split it over 2 checks (I tried to avoid the skip.If(t, a || b) because the output looks weird in the logs 😂
But again; happy to change if you prefer it differently ❤️
Trying to make the logic slightly clearer, and adding a custom
message for the skip,
Before this:
=== RUN TestSplitCpArg/absolute_path_with_drive
cp_test.go:184: tc.os == "windows" && runtime.GOOS != "windows" || tc.os == "linux" && runtime.GOOS == "windows"
After this:
=== RUN TestSplitCpArg/absolute_path_with_drive
cp_test.go:184: skipping windows test on non-windows platform
Signed-off-by: Sebastiaan van Stijn <[email protected]>
vvoland
left a comment
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 ❤️
Trying to make the logic slightly clearer, and adding a custom message for the skip,
Before this:
After this: