LEFT | RIGHT |
1 package state_test | 1 package state_test |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 "labix.org/v2/mgo/bson" | 5 "labix.org/v2/mgo/bson" |
6 . "launchpad.net/gocheck" | 6 . "launchpad.net/gocheck" |
7 "launchpad.net/juju-core/charm" | 7 "launchpad.net/juju-core/charm" |
8 "launchpad.net/juju-core/constraints" | 8 "launchpad.net/juju-core/constraints" |
9 "launchpad.net/juju-core/environs/config" | 9 "launchpad.net/juju-core/environs/config" |
10 "launchpad.net/juju-core/state" | 10 "launchpad.net/juju-core/state" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 c.Assert(err, ErrorMatches, "cannot add a new machine: no jobs specified
") | 158 c.Assert(err, ErrorMatches, "cannot add a new machine: no jobs specified
") |
159 } | 159 } |
160 | 160 |
161 func (s *StateSuite) TestInjectMachine(c *C) { | 161 func (s *StateSuite) TestInjectMachine(c *C) { |
162 m, err := s.State.InjectMachine("series", state.InstanceId("i-mindustrio
us"), state.JobHostUnits, state.JobManageEnviron) | 162 m, err := s.State.InjectMachine("series", state.InstanceId("i-mindustrio
us"), state.JobHostUnits, state.JobManageEnviron) |
163 c.Assert(err, IsNil) | 163 c.Assert(err, IsNil) |
164 c.Assert(m.Jobs(), DeepEquals, []state.MachineJob{state.JobHostUnits, st
ate.JobManageEnviron}) | 164 c.Assert(m.Jobs(), DeepEquals, []state.MachineJob{state.JobHostUnits, st
ate.JobManageEnviron}) |
165 instanceId, ok := m.InstanceId() | 165 instanceId, ok := m.InstanceId() |
166 c.Assert(ok, Equals, true) | 166 c.Assert(ok, Equals, true) |
167 c.Assert(instanceId, Equals, state.InstanceId("i-mindustrious")) | 167 c.Assert(instanceId, Equals, state.InstanceId("i-mindustrious")) |
| 168 |
| 169 // Make sure the bootstrap nonce value is set. |
| 170 c.Assert(m.CheckProvisioned(state.BootstrapNonce), Equals, true) |
168 } | 171 } |
169 | 172 |
170 func (s *StateSuite) TestReadMachine(c *C) { | 173 func (s *StateSuite) TestReadMachine(c *C) { |
171 machine, err := s.State.AddMachine("series", state.JobHostUnits) | 174 machine, err := s.State.AddMachine("series", state.JobHostUnits) |
172 c.Assert(err, IsNil) | 175 c.Assert(err, IsNil) |
173 expectedId := machine.Id() | 176 expectedId := machine.Id() |
174 machine, err = s.State.Machine(expectedId) | 177 machine, err = s.State.Machine(expectedId) |
175 c.Assert(err, IsNil) | 178 c.Assert(err, IsNil) |
176 c.Assert(machine.Id(), Equals, expectedId) | 179 c.Assert(machine.Id(), Equals, expectedId) |
177 } | 180 } |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 c.Assert(err, IsNil) | 1401 c.Assert(err, IsNil) |
1399 | 1402 |
1400 // Parse a user entity name. | 1403 // Parse a user entity name. |
1401 user, err := s.State.AddUser("arble", "pass") | 1404 user, err := s.State.AddUser("arble", "pass") |
1402 c.Assert(err, IsNil) | 1405 c.Assert(err, IsNil) |
1403 coll, id, err = s.State.ParseTag(user.Tag()) | 1406 coll, id, err = s.State.ParseTag(user.Tag()) |
1404 c.Assert(coll, Equals, "users") | 1407 c.Assert(coll, Equals, "users") |
1405 c.Assert(id, Equals, user.Name()) | 1408 c.Assert(id, Equals, user.Name()) |
1406 c.Assert(err, IsNil) | 1409 c.Assert(err, IsNil) |
1407 } | 1410 } |
LEFT | RIGHT |