Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 package mongo | 1 package mongo |
2 | 2 |
3 import ( | 3 import ( |
4 "io/ioutil" | 4 "io/ioutil" |
5 "os" | 5 "os" |
6 "path" | 6 "path" |
7 "path/filepath" | 7 "path/filepath" |
8 "testing" | 8 "testing" |
9 | 9 |
10 gc "launchpad.net/gocheck" | 10 gc "launchpad.net/gocheck" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 | 32 |
33 s.PatchValue(&upstart.InitDir, c.MkDir()) | 33 s.PatchValue(&upstart.InitDir, c.MkDir()) |
34 } | 34 } |
35 | 35 |
36 func (s *MongoSuite) TestJujuMongodPath(c *gc.C) { | 36 func (s *MongoSuite) TestJujuMongodPath(c *gc.C) { |
37 d := c.MkDir() | 37 d := c.MkDir() |
38 defer os.RemoveAll(d) | 38 defer os.RemoveAll(d) |
39 mongoPath := filepath.Join(d, "mongod") | 39 mongoPath := filepath.Join(d, "mongod") |
40 s.PatchValue(&JujuMongodPath, mongoPath) | 40 s.PatchValue(&JujuMongodPath, mongoPath) |
41 | 41 |
42 » err := ioutil.WriteFile(mongoPath, []byte{}, 0777) | 42 » err := ioutil.WriteFile(mongoPath, nil, 0777) |
43 c.Assert(err, gc.IsNil) | 43 c.Assert(err, gc.IsNil) |
44 | 44 |
45 obtained, err := MongodPath() | 45 obtained, err := MongodPath() |
46 c.Check(err, gc.IsNil) | 46 c.Check(err, gc.IsNil) |
47 c.Check(obtained, gc.Equals, mongoPath) | 47 c.Check(obtained, gc.Equals, mongoPath) |
48 } | 48 } |
49 | 49 |
50 func (s *MongoSuite) TestDefaultMongodPath(c *gc.C) { | 50 func (s *MongoSuite) TestDefaultMongodPath(c *gc.C) { |
51 s.PatchValue(&JujuMongodPath, "/not/going/to/exist/mongod") | 51 s.PatchValue(&JujuMongodPath, "/not/going/to/exist/mongod") |
52 | 52 |
53 dir := c.MkDir() | 53 dir := c.MkDir() |
54 s.PatchEnvPathPrepend(dir) | 54 s.PatchEnvPathPrepend(dir) |
55 filename := filepath.Join(dir, "mongod") | 55 filename := filepath.Join(dir, "mongod") |
56 » err := ioutil.WriteFile(filename, []byte{}, 0777) | 56 » err := ioutil.WriteFile(filename, nil, 0777) |
rog
2014/03/04 16:24:46
s/[]byte{}/nil/
?
natefinch
2014/03/04 17:01:05
Done.
| |
57 c.Assert(err, gc.IsNil) | 57 c.Assert(err, gc.IsNil) |
58 | 58 |
59 obtained, err := MongodPath() | 59 obtained, err := MongodPath() |
60 c.Check(err, gc.IsNil) | 60 c.Check(err, gc.IsNil) |
61 c.Check(obtained, gc.Equals, filename) | 61 c.Check(obtained, gc.Equals, filename) |
62 } | 62 } |
63 | 63 |
64 func (s *MongoSuite) TestRemoveOldMongoServices(c *gc.C) { | 64 func (s *MongoSuite) TestRemoveOldMongoServices(c *gc.C) { |
65 s.PatchValue(&oldMongoServiceName, "someNameThatShouldntExist") | 65 s.PatchValue(&oldMongoServiceName, "someNameThatShouldntExist") |
66 | 66 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 func makeService(name string, c *gc.C) *upstart.Conf { | 137 func makeService(name string, c *gc.C) *upstart.Conf { |
138 conf := &upstart.Conf{ | 138 conf := &upstart.Conf{ |
139 Desc: "foo", | 139 Desc: "foo", |
140 Service: *upstart.NewService(name), | 140 Service: *upstart.NewService(name), |
141 Cmd: "echo hi", | 141 Cmd: "echo hi", |
142 } | 142 } |
143 err := conf.Install() | 143 err := conf.Install() |
144 c.Assert(err, gc.IsNil) | 144 c.Assert(err, gc.IsNil) |
145 return conf | 145 return conf |
146 } | 146 } |
LEFT | RIGHT |