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

Issue 13799043: Fix race condition in SSHStorage test

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 7 months ago by thumper
Modified:
10 years, 7 months ago
Reviewers:
mp+186690, axw1
Visibility:
Public.

Description

Fix race condition in SSHStorage test I found an intermittent failure in the synchronization test for the SSHStorage. It only happened once, and not again, but I felt it was worth fixing anyway. The race was in the flock subprocess actually starting before the following lines in the test. The lines following expected the flock to be taken, but since the flock was managed by an executed command, there is a race where it may not have started. I broke the synchronisation test into three as it was really testing three distinct things. The flock helper method now waits for the flock to be taken by incrementally reading from stdout waiting for the initial echo to be written out prior to the sleep. The flock cleanup is also now handled by a cleanup method. By breaking the test up, we no longer need to manually kill the process as part of the test. https://code.launchpad.net/~thumper/juju-core/fix-intermittent-failure/+merge/186690 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -19 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M environs/sshstorage/storage_test.go View 3 chunks +31 lines, -19 lines 1 comment Download

Messages

Total messages: 2
thumper
Please take a look.
10 years, 7 months ago (2013-09-19 23:35:34 UTC) #1
axw1
10 years, 7 months ago (2013-09-20 01:13:49 UTC) #2
LGTM, thanks for fixing my crap.

https://codereview.appspot.com/13799043/diff/1/environs/sshstorage/storage_te...
File environs/sshstorage/storage_test.go (right):

https://codereview.appspot.com/13799043/diff/1/environs/sshstorage/storage_te...
environs/sshstorage/storage_test.go:258: for count := len("started"); count > 0;
{
I'd probably just use
err = io.ReadFull(stdout, make([]byte, len("started")))
c.Assert(err, gc.IsNil)
Sign in to reply to this message.

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