LEFT | RIGHT |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package local | 4 package local |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 "io/ioutil" | 8 "io/ioutil" |
9 "os" | 9 "os" |
10 "path/filepath" | 10 "path/filepath" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // found. | 37 // found. |
38 lxclsPath = "/bin/true" | 38 lxclsPath = "/bin/true" |
39 } | 39 } |
40 | 40 |
41 func (s *prereqsSuite) SetUpTest(c *gc.C) { | 41 func (s *prereqsSuite) SetUpTest(c *gc.C) { |
42 s.LoggingSuite.SetUpTest(c) | 42 s.LoggingSuite.SetUpTest(c) |
43 s.tmpdir = c.MkDir() | 43 s.tmpdir = c.MkDir() |
44 s.testMongodPath = filepath.Join(s.tmpdir, "mongod") | 44 s.testMongodPath = filepath.Join(s.tmpdir, "mongod") |
45 lxclsPath = filepath.Join(s.tmpdir, "lxc-ls") | 45 lxclsPath = filepath.Join(s.tmpdir, "lxc-ls") |
46 s.PatchEnvironment("PATH", s.tmpdir) | 46 s.PatchEnvironment("PATH", s.tmpdir) |
47 | 47 » s.PatchValue(&mongo.JujuMongodPath, c.MkDir()) |
48 » mongo.JujuMongodPath = "/somewhere/that/doesnt/exist" | |
49 | 48 |
50 os.Setenv("JUJUTEST_LSB_RELEASE_ID", "Ubuntu") | 49 os.Setenv("JUJUTEST_LSB_RELEASE_ID", "Ubuntu") |
51 err := ioutil.WriteFile(filepath.Join(s.tmpdir, "lsb_release"), []byte(l
sbrelease), 0777) | 50 err := ioutil.WriteFile(filepath.Join(s.tmpdir, "lsb_release"), []byte(l
sbrelease), 0777) |
52 c.Assert(err, gc.IsNil) | 51 c.Assert(err, gc.IsNil) |
53 } | 52 } |
54 | 53 |
55 func (s *prereqsSuite) TearDownTest(c *gc.C) { | 54 func (s *prereqsSuite) TearDownTest(c *gc.C) { |
56 s.testMongodPath = "" | 55 s.testMongodPath = "" |
57 lxclsPath = "/bin/true" | 56 lxclsPath = "/bin/true" |
58 s.LoggingSuite.TearDownTest(c) | 57 s.LoggingSuite.TearDownTest(c) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 os.Setenv("JUJUTEST_LSB_RELEASE_ID", "NotUbuntu") | 161 os.Setenv("JUJUTEST_LSB_RELEASE_ID", "NotUbuntu") |
163 err = VerifyPrerequisites(instance.LXC) | 162 err = VerifyPrerequisites(instance.LXC) |
164 c.Assert(err, gc.ErrorMatches, "(.|\n)*Linux Containers \\(LXC\\) usersp
ace tools must be installed(.|\n)*") | 163 c.Assert(err, gc.ErrorMatches, "(.|\n)*Linux Containers \\(LXC\\) usersp
ace tools must be installed(.|\n)*") |
165 c.Assert(err, gc.Not(gc.ErrorMatches), "(.|\n)*apt-get install(.|\n)*") | 164 c.Assert(err, gc.Not(gc.ErrorMatches), "(.|\n)*apt-get install(.|\n)*") |
166 | 165 |
167 err = ioutil.WriteFile(lxclsPath, nil, 0777) | 166 err = ioutil.WriteFile(lxclsPath, nil, 0777) |
168 c.Assert(err, gc.IsNil) | 167 c.Assert(err, gc.IsNil) |
169 err = VerifyPrerequisites(instance.LXC) | 168 err = VerifyPrerequisites(instance.LXC) |
170 c.Assert(err, gc.IsNil) | 169 c.Assert(err, gc.IsNil) |
171 } | 170 } |
LEFT | RIGHT |