LEFT | RIGHT |
1 package state_test | 1 package state_test |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 . "launchpad.net/gocheck" | 5 . "launchpad.net/gocheck" |
6 "launchpad.net/juju-core/charm" | 6 "launchpad.net/juju-core/charm" |
7 "launchpad.net/juju-core/state" | 7 "launchpad.net/juju-core/state" |
8 "launchpad.net/juju-core/testing" | 8 "launchpad.net/juju-core/testing" |
9 "os" | 9 "os" |
10 "path/filepath" | 10 "path/filepath" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 c.Assert(err, IsNil) | 249 c.Assert(err, IsNil) |
250 c.Assert(unitOne.Name(), Equals, "mysql/1") | 250 c.Assert(unitOne.Name(), Equals, "mysql/1") |
251 principal = unitOne.IsPrincipal() | 251 principal = unitOne.IsPrincipal() |
252 c.Assert(principal, Equals, true) | 252 c.Assert(principal, Equals, true) |
253 | 253 |
254 // Check that principal units cannot be added to principal units. | 254 // Check that principal units cannot be added to principal units. |
255 _, err = s.service.AddUnitSubordinateTo(unitZero) | 255 _, err = s.service.AddUnitSubordinateTo(unitZero) |
256 c.Assert(err, ErrorMatches, `cannot add unit to service "mysql" as a sub
ordinate of "mysql/0": service is not a subordinate`) | 256 c.Assert(err, ErrorMatches, `cannot add unit to service "mysql" as a sub
ordinate of "mysql/0": service is not a subordinate`) |
257 | 257 |
258 // Assign the principal unit to a machine. | 258 // Assign the principal unit to a machine. |
259 » m, err := s.State.AddMachine(state.HostPrincipalUnits) | 259 » m, err := s.State.AddMachine(state.JobHostUnits) |
260 c.Assert(err, IsNil) | 260 c.Assert(err, IsNil) |
261 err = unitZero.AssignToMachine(m) | 261 err = unitZero.AssignToMachine(m) |
262 c.Assert(err, IsNil) | 262 c.Assert(err, IsNil) |
263 | 263 |
264 // Add a subordinate service. | 264 // Add a subordinate service. |
265 subCharm := s.AddTestingCharm(c, "logging") | 265 subCharm := s.AddTestingCharm(c, "logging") |
266 logging, err := s.State.AddService("logging", subCharm) | 266 logging, err := s.State.AddService("logging", subCharm) |
267 c.Assert(err, IsNil) | 267 c.Assert(err, IsNil) |
268 | 268 |
269 // Check that subordinate units can be added to principal units | 269 // Check that subordinate units can be added to principal units |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 case <-time.After(500 * time.Millisecond): | 1068 case <-time.After(500 * time.Millisecond): |
1069 c.Fatalf("did not get change") | 1069 c.Fatalf("did not get change") |
1070 } | 1070 } |
1071 | 1071 |
1072 select { | 1072 select { |
1073 case got := <-configWatcher.Changes(): | 1073 case got := <-configWatcher.Changes(): |
1074 c.Fatalf("got unexpected change: %#v", got) | 1074 c.Fatalf("got unexpected change: %#v", got) |
1075 case <-time.After(100 * time.Millisecond): | 1075 case <-time.After(100 * time.Millisecond): |
1076 } | 1076 } |
1077 } | 1077 } |
LEFT | RIGHT |