LEFT | RIGHT |
(no file at all) | |
1 package state_test | 1 package state_test |
2 | 2 |
3 import ( | 3 import ( |
4 . "launchpad.net/gocheck" | 4 . "launchpad.net/gocheck" |
5 "launchpad.net/gozk/zookeeper" | 5 "launchpad.net/gozk/zookeeper" |
6 "launchpad.net/juju/go/state" | 6 "launchpad.net/juju/go/state" |
7 "time" | 7 "time" |
8 ) | 8 ) |
9 | 9 |
10 var serviceWatchConfigData = []map[string]interface{}{ | 10 var serviceWatchConfigData = []map[string]interface{}{ |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 296 } |
297 | 297 |
298 func (s *StateSuite) TestWatchEnvironment(c *C) { | 298 func (s *StateSuite) TestWatchEnvironment(c *C) { |
299 // create a blank /environment key manually as it is· | 299 // create a blank /environment key manually as it is· |
300 // not created by state.Init(). | 300 // not created by state.Init(). |
301 path, err := s.zkConn.Create("/environment", "", 0, zookeeper.WorldACL(z
ookeeper.PERM_ALL)) | 301 path, err := s.zkConn.Create("/environment", "", 0, zookeeper.WorldACL(z
ookeeper.PERM_ALL)) |
302 c.Assert(err, IsNil) | 302 c.Assert(err, IsNil) |
303 c.Assert(path, Equals, "/environment") | 303 c.Assert(path, Equals, "/environment") |
304 | 304 |
305 // fetch the /environment key as a *ConfigNode | 305 // fetch the /environment key as a *ConfigNode |
306 » w := s.st.WatchEnvrionConfig() | 306 » w := s.st.WatchEnvironConfig() |
307 config, ok := <-w.Changes() | 307 config, ok := <-w.Changes() |
308 c.Assert(ok, Equals, true) | 308 c.Assert(ok, Equals, true) |
309 | 309 |
310 for _, test := range environmentWatchTests { | 310 for _, test := range environmentWatchTests { |
311 config.Set(test.key, test.value) | 311 config.Set(test.key, test.value) |
312 _, err := config.Write() | 312 _, err := config.Write() |
313 c.Assert(err, IsNil) | 313 c.Assert(err, IsNil) |
314 select { | 314 select { |
315 case got, ok := <-w.Changes(): | 315 case got, ok := <-w.Changes(): |
316 c.Assert(ok, Equals, true) | 316 c.Assert(ok, Equals, true) |
(...skipping 21 matching lines...) Expand all Loading... |
338 {[]string{"B"}, []string{"A", "B", "C"}, nil}, | 338 {[]string{"B"}, []string{"A", "B", "C"}, nil}, |
339 {[]string{"A", "D", "C"}, []string{}, []string{"A", "D", "C"}}, | 339 {[]string{"A", "D", "C"}, []string{}, []string{"A", "D", "C"}}, |
340 {[]string{}, []string{"A", "D", "C"}, nil}, | 340 {[]string{}, []string{"A", "D", "C"}, nil}, |
341 } | 341 } |
342 | 342 |
343 func (*StateSuite) TestDiff(c *C) { | 343 func (*StateSuite) TestDiff(c *C) { |
344 for _, test := range diffTests { | 344 for _, test := range diffTests { |
345 c.Assert(test.want, DeepEquals, state.Diff(test.A, test.B)) | 345 c.Assert(test.want, DeepEquals, state.Diff(test.A, test.B)) |
346 } | 346 } |
347 } | 347 } |
LEFT | RIGHT |