Skip to content

integration-cli: error logging improvements#37635

Merged
thaJeztah merged 2 commits intomoby:masterfrom
kolyshkin:test-logs
Aug 14, 2018
Merged

integration-cli: error logging improvements#37635
thaJeztah merged 2 commits intomoby:masterfrom
kolyshkin:test-logs

Conversation

@kolyshkin
Copy link
Contributor

  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).

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]>
Copy link
Contributor

@boaz0 boaz0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

@vdemeester vdemeester requested a review from thaJeztah August 14, 2018 10:43
@codecov
Copy link

codecov bot commented Aug 14, 2018

Codecov Report

Merging #37635 into master will decrease coverage by <.01%.
The diff coverage is n/a.

@@            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

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants