-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Only parse global args once #1802
Conversation
This checks for actual emptiness, while `""` means "don't care". Signed-off-by: Ian Campbell <[email protected]>
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.
It looks like the args filtering was already done and just missed to be plugged in.
Nice!
Yep. I'll investigate the CI failures after lunch, looks like I regressed something... |
Adding I'll sort it shortly. |
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 once CI is fixed 😅
This was omitted when these tests were added. Adding this means that the tests now see the `$DOCKER_HOST` configured (via `$TEST_DOCKER_HOST`) where they didn't before. In some cases (specifically the `test-e2e-connhelper-ssh` case) this results in additional output on stderr when `-D` (debug) is used: time="2019-04-03T11:10:27Z" level=debug msg="commandconn: starting ssh with [-l penguin 172.20.0.2 -- docker system dial-stdio]" Address this by switching the affected test cases to use `-l info` instead of `-D`, they all just require some option not specifically `-D`. Note that `info` is the default log level so this is effectively a nop (which is good). Signed-off-by: Ian Campbell <[email protected]>
These currently fail. Signed-off-by: Ian Campbell <[email protected]>
Before calling `cmd.Execute` we need to reset the arguments to be used to not include the global arguments which we have already parsed. This is precisely the `args` which we have in our hand at this point. This fixes `TestGlobalArgsOnlyParsedOnce/builtin` in the cli-plugins e2e tests. `TestGlobalArgsOnlyParsedOnce/plugin` is still broken will be fixed next. Signed-off-by: Ian Campbell <[email protected]>
This fixes `TestGlobalArgsOnlyParsedOnce/plugin` in the cli-plugins e2e tests. Signed-off-by: Ian Campbell <[email protected]>
c2453a6
to
1425aeb
Compare
Codecov Report
@@ Coverage Diff @@
## master #1802 +/- ##
=========================================
Coverage ? 56.28%
=========================================
Files ? 308
Lines ? 21300
Branches ? 0
=========================================
Hits ? 11988
Misses ? 8437
Partials ? 875 |
I pushed an update to fix the CI. The change was in |
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, thanks!
- What I did
Fixed #1801 by ensuring the monolithic CLI and plugins themselves only parse their global arguments once. Along the way I noticed that the cli-plugins e2e tests lacked a
TestMain
(and thus a call toenvironment.Setup
) and fixed that as well as tightening the checks on a couple of existing tests.Fixes #1801.
- How I did it
After parsing the global args (which we do manually due to #1722) reset the cmd's args to only the remaining ones.
- How to verify it
New e2e tests
TestGlobalArgsOnlyParsedOnce/*
validate this, existing tests should cover the rest.- Description for the changelog
N/A (haven't released the bug yet)