Skip to content

Add unit test logging hook#3417

Merged
crosbymichael merged 2 commits intocontainerd:masterfrom
dmcgowan:testing-log-hook
Jul 16, 2019
Merged

Add unit test logging hook#3417
crosbymichael merged 2 commits intocontainerd:masterfrom
dmcgowan:testing-log-hook

Conversation

@dmcgowan
Copy link
Copy Markdown
Member

Adds a function for configuring a context with logger which outputs to the test logs with debug level enabled. This allows for cleaner and more verbose test output with clearer ordering of logs along with failure conditions and time correlation for the daemon logs in integration tests.

Disables verbose logging by default in CI since this will cause more test log output by default. Verbose logging has little value as this output will always get shown now when the corresponding test fails.

@dmcgowan
Copy link
Copy Markdown
Member Author

Looks like there is a race in golang 1.12 that I don't see in 1.11 around a logDepth function call (this doesn't seem to exist in 1.11). I'll have to investigate to see if this can be fixed.

@containerd containerd deleted a comment from theopenlab-ci bot Jul 15, 2019
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jul 15, 2019

Build succeeded.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can this be just logrus.AllLevels ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think string(bytes.Trim(s, "\n")) would be more readable.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 16, 2019

Codecov Report

Merging #3417 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3417   +/-   ##
=======================================
  Coverage   45.05%   45.05%           
=======================================
  Files         113      113           
  Lines       12563    12563           
=======================================
  Hits         5660     5660           
  Misses       6049     6049           
  Partials      854      854
Flag Coverage Δ
#linux 48.98% <ø> (ø) ⬆️
#windows 40.27% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6be45e...63ceaf8. Read the comment docs.

dmcgowan added 2 commits July 16, 2019 10:31
Allows log output to sent along with test output
for cleaner output and clearer ordering.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Enables showing debug logs in testing output.
For integration tests the client log output will show
in addition to daemon output, with timestamps for better
correlation.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Copy link
Copy Markdown
Member

@mxpv mxpv left a comment

Choose a reason for hiding this comment

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

LGTM

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jul 16, 2019

Build succeeded.

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit e4bfab7 into containerd:master Jul 16, 2019
@dmcgowan dmcgowan deleted the testing-log-hook branch September 10, 2019 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants