Skip to content

[tests] Cleanup and better logging#2222

Merged
aaronlehmann merged 1 commit intomoby:masterfrom
cyli:cleanup-tests
Jun 8, 2017
Merged

[tests] Cleanup and better logging#2222
aaronlehmann merged 1 commit intomoby:masterfrom
cyli:cleanup-tests

Conversation

@cyli
Copy link
Copy Markdown
Contributor

@cyli cyli commented Jun 7, 2017

This PR includes some test cleanups discovered while debugging #2221:

  1. The goroutine that updates to the RootCA of the testing CA server never actually terminates after a test, because the context is never canceled. This makes sure that goroutine is cleaned up.

  2. One of the fake CA servers is never stopped after a test - added a defer stop.

  3. Similar to how the integration tests log the test names, do the same for the testing CA so we can tell which logs belong to which test.

cc @aaronlehmann @ijc25 This does not actually fix the stated issue above, but would be helpful for debugging and may reduce some resource consumption for running the tests.

@cyli cyli force-pushed the cleanup-tests branch from 4b684a6 to 54adc4d Compare June 7, 2017 20:37
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 7, 2017

Codecov Report

Merging #2222 into master will increase coverage by 0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2222      +/-   ##
==========================================
+ Coverage   60.27%   60.29%   +0.01%     
==========================================
  Files         124      124              
  Lines       20149    20149              
==========================================
+ Hits        12145    12149       +4     
+ Misses       6639     6633       -6     
- Partials     1365     1367       +2

@cyli cyli changed the title [tests] Cleanup and better logging WIP: [tests] Cleanup and better logging Jun 7, 2017
@cyli cyli force-pushed the cleanup-tests branch from 54adc4d to 2bd7d46 Compare June 7, 2017 23:46
…CA tests,

similar to how we log the test names in the integration tests.

Signed-off-by: Ying Li <ying.li@docker.com>
@cyli cyli force-pushed the cleanup-tests branch from 2bd7d46 to 412532a Compare June 7, 2017 23:51
@cyli cyli changed the title WIP: [tests] Cleanup and better logging [tests] Cleanup and better logging Jun 8, 2017
rootCA, err := ca.NewRootCA(testutils.ECDSACertChain[2], nil, nil, ca.DefaultNodeCertExpiration, nil)
require.NoError(t, err)

ctx := log.WithLogger(context.Background(), log.L.WithFields(logrus.Fields{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be t.Context? I only ask because elsewhere this PR changes a lot of context.Background() into t.Context. Maybe it doesn't matter much for the logger?

Copy link
Copy Markdown
Contributor Author

@cyli cyli Jun 8, 2017

Choose a reason for hiding this comment

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

On all the other ones it was tc.Context - tc being cautil.go's TestCA object. This particular test doesn't create one of those, hence creating the context manually.

@ijc
Copy link
Copy Markdown
Contributor

ijc commented Jun 8, 2017

FWIW this LGTM, at least so far as I am able to judge (I'm not terribly familiar with this code).

@aaronlehmann
Copy link
Copy Markdown
Collaborator

LGTM

@aaronlehmann aaronlehmann merged commit ed6010c into moby:master Jun 8, 2017
@cyli cyli deleted the cleanup-tests branch June 8, 2017 21:40
@aaronlehmann
Copy link
Copy Markdown
Collaborator

CI failed after the merge to master:

--- FAIL: TestNodeRejoins (68.06s)
        Error Trace:    integration_test.go:774
        Error:          "node did not ready in time" does not contain "certificate signed by unknown authority"

Related?

@cyli
Copy link
Copy Markdown
Contributor Author

cyli commented Jun 8, 2017

I've seen that a couple times on master prior to this. I haven't been able to replicate it locally reliably.

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.

3 participants