-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Improve the logging in pkg/git testing #4191
Conversation
Currently the "fetch" testing nicely captures logs (to examine output), but doesn't actually surface them on failures. This change adds a `defer`red function that stream the output to `t.Log` so that `git` failures can be debugged. For example, when I introduce a typo into the "commit" command, it now prints: ``` === RUN TestFetch/test-clone-with-sparse-checkout git_test.go:299: exit status 1 git_test.go:216: ["error" git]: Error running git [codmmit --allow-empty -m Hello Moto]: exit status 1 git: 'codmmit' is not a git command. See 'git --help'. The most similar command is commit ``` Previously, this would only print the exit status, which isn't particularly useful.
/lgtm Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester 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 |
I think this is a flake, but gubernator displays things oddly... Let's see /retest |
gonna have to close/reopen to kick the kind job |
Hmm that didn't do it, so I'll go for a walk and try again 😉 |
/retest |
/test check-pr-has-kind-label |
Currently the "fetch" testing nicely captures logs (to examine output), but doesn't actually surface them on failures.
This change adds a
defer
red function that stream the output tot.Log
so thatgit
failures can be debugged.For example, when I introduce a typo into the "commit" command, it now prints:
Previously, this would only print the exit status, which isn't particularly useful.
/kind cleanup
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes