Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(13615)

Issue 10234047: cmd/juju: Make a test deterministic

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 10 months ago by jameinel
Modified:
10 years, 10 months ago
Reviewers:
gz, mp+169155, fwereade
Visibility:
Public.

Description

cmd/juju: Make a test deterministic TestGatherDescriptionsInParallel was timing dependent, and occasionally failed on my system. Rather than just increasing the timeout arbitrarily, I changed the code to be more 'event' based. Each plugin requires another plugin to have started before that plugin will return. Thus, if we don't start the plugins in parallel, the plugin will deadlock. Because the failure mode is 'deadlock', I wrapped the call in a select timeout. This means that if it *does* fail, we have a garbage goroutine and process lying around (but it should never fail). On the plus side, this makes it actually run faster, since each subprocess doesn't waste time sleeping just so we can measure it. (from 350ms down to normally around 15ms.) This is the only test that was failing (based on occasional timing hiccups) for me, which allows us to have this in tarmac. https://code.launchpad.net/~jameinel/juju-core/timing-test/+merge/169155 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+46 lines, -20 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/plugin_test.go View 4 chunks +44 lines, -20 lines 3 comments Download

Messages

Total messages: 4
jameinel
Please take a look.
10 years, 10 months ago (2013-06-13 10:37:34 UTC) #1
fwereade
LGTM
10 years, 10 months ago (2013-06-13 10:39:27 UTC) #2
gz
LGTM https://codereview.appspot.com/10234047/diff/1/cmd/juju/plugin_test.go File cmd/juju/plugin_test.go (left): https://codereview.appspot.com/10234047/diff/1/cmd/juju/plugin_test.go#oldcode99 cmd/juju/plugin_test.go:99: suite.makeFullPlugin(PluginParams{Name: "slow", Sleep: 200 * time.Millisecond}) Yeay for ...
10 years, 10 months ago (2013-06-13 10:53:48 UTC) #3
jameinel
10 years, 10 months ago (2013-06-13 14:17:40 UTC) #4
https://codereview.appspot.com/10234047/diff/1/cmd/juju/plugin_test.go
File cmd/juju/plugin_test.go (right):

https://codereview.appspot.com/10234047/diff/1/cmd/juju/plugin_test.go#newcode96
cmd/juju/plugin_test.go:96: // Thus if we don't start them in parallel, we would
deadlock
On 2013/06/13 10:53:48, gz wrote:
> I didn't understand this comment till I went back and read the mp description
> properly. But now it seems obvious, so can't think of clarifications.
> 
> Maybe:
> 
> // Make plugins with dependencies that will deadlock unless started in
parallel

Updated.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b