integration-cli: error logging improvements#37635
Merged
thaJeztah merged 2 commits intomoby:masterfrom Aug 14, 2018
Merged
Conversation
It is wrong to pass an arbitrary string to a function expecting
%-style formatting. One solution would be to replace any % with %%,
but it's easier to just do what this patch does.
Generated with:
for f in $(git grep -l 'check.Commentf(out)'); do \
sed -i -e 's/check\.Commentf(out)/check.Commentf("%s", out)/g' $f; \
done
Signed-off-by: Kir Kolyshkin <[email protected]>
1. After running d.Cmd(), in case an error is returned, it makes sense to print command output, as its stderr may contain a clue about what went wrong. This is by no means complete, just as far as I could go. 2. In case the comment in c.Assert is a constant string, it's better to provide it as a comment which will be printed. 3. An arbitrary string should not be passed on to a function expecting %-style formatting. Use %s to fix this. 4. Print the output string before transformation, not after. 5. Unify the output format (drop "out:" prefix"). Signed-off-by: Kir Kolyshkin <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #37635 +/- ##
==========================================
- Coverage 35.62% 35.61% -0.01%
==========================================
Files 611 611
Lines 44962 44962
==========================================
- Hits 16017 16015 -2
+ Misses 26736 26734 -2
- Partials 2209 2213 +4 |
Merged
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After running
d.Cmd(), in case an error is returned, it makes senseto print command output, as its stderr may contain a clue about what
went wrong. This is by no means complete, just as far as I could go.
In case the comment in c.Assert is a constant string, it's better
to provide it as a comment which will be printed.
An arbitrary string should not be passed on to a function expecting
%-style formatting. Use%sto fix this.Print the output string before transformation, not after.
Unify the output format (drop
out:prefix).