Reviewers: mp+186690_code.launchpad.net, Message: Please take a look. 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) Please review this at https://codereview.appspot.com/13799043/ Affected files (+33, -19 lines): A [revision details] M environs/sshstorage/storage_test.go Index: [revision details] === added file '[revision details]' --- [revision details] 2012-01-01 00:00:00 +0000 +++ [revision details] 2012-01-01 00:00:00 +0000 @@ -0,0 +1,2 @@ +Old revision: tarmac-20130919221201-urd9lbpjtto8a7pk +New revision: