Merge lp:~mvo/snappy/snappy-lp1468831-race into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Vogt
Status: Rejected
Rejected by: Michael Vogt
Proposed branch: lp:~mvo/snappy/snappy-lp1468831-race
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 26 lines (+9/-0)
1 file modified
helpers/helpers_test.go (+9/-0)
To merge this branch: bzr merge lp:~mvo/snappy/snappy-lp1468831-race
Reviewer Review Type Date Requested Status
Federico Gimenez continuous-integration Pending
Snappy Developers Pending
Review via email: mp+269155@code.launchpad.net

Description of the change

Tiny branch that avoids race in tests

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thinking about this, running the entire testsuite with faketime might also be a alternative. Not sure if its a better one though.

Revision history for this message
Leo Arias (elopio) wrote :

A little late, but yes, if we can fake the sleeps and times for unit tests, that will make things faster and we will be able to test more complex things.

Thanks mvo.

Unmerged revisions

641. By Michael Vogt

helpers/helpers_test.go: avoid race in fs-compare code by waiting a tiny bit if the time is too close to a minute change

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'helpers/helpers_test.go'
2--- helpers/helpers_test.go 2015-08-21 12:14:16 +0000
3+++ helpers/helpers_test.go 2015-08-26 06:48:12 +0000
4@@ -28,6 +28,7 @@
5 "os/exec"
6 "path/filepath"
7 "testing"
8+ "time"
9
10 . "gopkg.in/check.v1"
11 )
12@@ -383,6 +384,14 @@
13
14 func (ts *HTestSuite) TestSyncDirs(c *C) {
15
16+ // ensure the test does not run too close before the time wraps
17+ // to avoid time-stamp minute mismatches, see LP: #1468831
18+ now := time.Now()
19+ if now.Second() > 55 {
20+ wait := 61 - now.Second()
21+ time.Sleep(time.Duration(wait) * time.Second)
22+ }
23+
24 for _, l := range [][2]string{
25 [2]string{"src-short", "dst-loooooooooooong"},
26 [2]string{"src-loooooooooooong", "dst-short"},

Subscribers

People subscribed via source and target branches