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
fix: make jx prompt
fast again
#2414
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Sorry, I missed this until now. Will look at it tomorrow, but I know what the problem is. |
@pmuir ack. |
jx prompt
fast againjx prompt
fast again
jx prompt
fast againjx prompt
fast again
if cmd == nil { | ||
panic("nil root command") | ||
} | ||
templater := &templater{ | ||
RootCmd: cmd, |
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.
Tip: Diff settings » Hide whitespace changes
Trying to diagnose this test failure. |
…DoNotMatch & TestUninstallOptions_Run_ContextSpecifiedViaCli_PassWhenContextNamesMatch were not expecting a namespace name to be printed in green text.
/hold I think this is the right fix, but I'll build on top of it to apply the validation of CLI arguments during |
Just like in #2225 I noticed that
jx prompt
was taking much too long (a second or more, when it should generally take <100ms), apparently contacting the API server.git bisect
(starting from the last known fix—#2234) pinpointed #2283 as the first culprit, but #2104 seems to have compounded the issue. CC @pmuir who happened to write both of these.I am not exactly sure what a solution would look like—#2283 could perhaps be amended like in #2234, but #2104 looks like a more fundamental design problem—butthis PR at least shows how to reproduce the issue: build and runjx prompt
withany of the three suppressed code blocks restoredthe changes to, say,upgrade_apps.go
reverted and you will see the stack trace, like(It took some experimentation but AFAICT
createKubeConfig
is the lowest-level function whose presence indicates some code about to make a network call.)Ideally there would be a*_test.go
somewhere which actually tries to runjx prompt
and sets some global flag blockingcreateKubeConfig
from working. However I did not yet manage to replicate the Cobra code to run a command without usingos.Args
; maybe usingSetArgs
.Testing: other than existing automated tests and the new test case, I verified that some common commands and
jx help
andjx help subcommand subsubcommand
etc. work as expected. (jx help
does contact the API server, but that is OK.) I did not attempt to test functionality of either apps or plugins. From what I can tell, there is some existing test coverage for locally installed plugin commands, but not managed plugins, and none for the affected app subcommands. Maybe BDD tests fill in the gaps?