Fix test race, and remove JujuConnSuite dependency. #7742

Merged
merged 1 commit into from Aug 15, 2017

Conversation

Projects
None yet
3 participants
Owner

howbazaar commented Aug 15, 2017

This branch fixes a test race that was introduced in the recent PR #7709.

As a drive by I removed the JujuConnSuite and introduced an interface for the API calls.

Yay, no more jujuconnsuite

worker/logger/logger_test.go
s.waitLoggingInfo(c, expected)
+ worker.Stop(loggingWorker)
@wallyworld

wallyworld Aug 15, 2017

Owner

let's check that err is nil here
why remove the defer?

@howbazaar

howbazaar Aug 15, 2017

Owner

That was the race. The worker may update the value in another goroutine. Stop the worker before confirming the expected callback.

worker/logger/logger_test.go
+ return m.config, nil
+}
+func (m *mockAPI) WatchLoggingConfig(agentTag names.Tag) (watcher.NotifyWatcher, error) {
+ return m.watcher, nil
@wallyworld

wallyworld Aug 15, 2017

Owner

we should set up the mock api with the expected agent and then assert here that the agent matches to make sure we are passing in the expected value, or just assert that it equals 42 as that's what was set up earlier

@howbazaar

howbazaar Aug 15, 2017

Owner

We can record the agent tag passed in and confirm in the test, but the gc.C that we have in the setup doesn't work properly within the normal tests.

Owner

howbazaar commented Aug 15, 2017

$$merge$$

Contributor

jujubot commented Aug 15, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 6a2a4b3 into juju:2.2 Aug 15, 2017

1 check passed

continuous-integration/jenkins/pr-merge This commit looks good
Details

@howbazaar howbazaar deleted the howbazaar:2.2-logger-worker-race branch Aug 15, 2017

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