Merge lp:~pedronis/ubuntu-push/kindpool-test-derace into lp:ubuntu-push/automatic

Proposed by Samuele Pedroni
Status: Merged
Approved by: Roberto Alsina
Approved revision: 314
Merged at revision: 314
Proposed branch: lp:~pedronis/ubuntu-push/kindpool-test-derace
Merge into: lp:ubuntu-push/automatic
Diff against target: 28 lines (+8/-2)
1 file modified
launch_helper/kindpool_test.go (+8/-2)
To merge this branch: bzr merge lp:~pedronis/ubuntu-push/kindpool-test-derace
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+231906@code.launchpad.net

Commit message

avoid rare race in kindpool_test.go

Description of the change

avoid rare race in test,

better to change globals once in SetUpSuite than again and again in SetUpTest

To post a comment you must log in.
314. By Samuele Pedroni

avoid rare race in test

Revision history for this message
Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launch_helper/kindpool_test.go'
2--- launch_helper/kindpool_test.go 2014-08-20 20:41:05 +0000
3+++ launch_helper/kindpool_test.go 2014-08-22 14:56:05 +0000
4@@ -102,16 +102,22 @@
5 return args
6 }
7
8+func (s *poolSuite) SetUpSuite(c *C) {
9+ xdgCacheHome = c.MkDir
10+}
11+
12+func (s *poolSuite) TearDownSuite(c *C) {
13+ xdgCacheHome = xdg.Cache.Home
14+}
15+
16 func (s *poolSuite) SetUpTest(c *C) {
17 s.log = helpers.NewTestLogger(c, "debug")
18 s.fakeLauncher = &fakeHelperLauncher{argCh: make(chan [5]string, 10)}
19 s.pool = NewHelperPool(map[string]HelperLauncher{"fake": s.fakeLauncher}, s.log)
20- xdgCacheHome = c.MkDir
21 }
22
23 func (s *poolSuite) TearDownTest(c *C) {
24 s.pool = nil
25- xdgCacheHome = xdg.Cache.Home
26 }
27
28 func (s *poolSuite) TestDefaultLaunchers(c *C) {

Subscribers

People subscribed via source and target branches