worker/machiner: ensure api errors set before worker starts. #6397

Merged
merged 1 commit into from Oct 7, 2016

Conversation

Projects
None yet
3 participants
Owner

howbazaar commented Oct 6, 2016

It seems blindingly obvious once it is pointed out, the error returns from the mock API need to be set before the worker that uses that API is started.

There is a race between the worker starting the goroutine that calls the setup and handler methods of the machiner, and the test setting the API error return values. In almost all circumstances, the test wins the race, but sometimes the worker goroutine calls an API before the error returns are set. The default behaviour of the mock NextErr() method is to return nil if none have been set. This means that the final error that is set by the test is never returned.

Fixes http://pad.lv/1612744

Owner

howbazaar commented Oct 6, 2016

QA

Unit tests pass in worker/machiner

Owner

howbazaar commented Oct 6, 2016

$$merge$$

Contributor

jujubot commented Oct 6, 2016

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

@jujubot jujubot merged commit 678647b into juju:master Oct 7, 2016

@howbazaar howbazaar deleted the howbazaar:fix-machiner-race branch Oct 7, 2016

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