OLD | NEW |
1 // Copyright 2012, 2013 Canonical Ltd. | 1 // Copyright 2012, 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 state_test | 4 package state_test |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 "sort" | 8 "sort" |
9 "strconv" | 9 "strconv" |
10 "time" | 10 "time" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 c.Assert(err, ErrorMatches, `unit "logging/0" is not assigned to a machi
ne`) | 181 c.Assert(err, ErrorMatches, `unit "logging/0" is not assigned to a machi
ne`) |
182 } | 182 } |
183 | 183 |
184 func (s *AssignSuite) TestDeployerTag(c *C) { | 184 func (s *AssignSuite) TestDeployerTag(c *C) { |
185 machine, err := s.State.AddMachine("series", state.JobHostUnits) | 185 machine, err := s.State.AddMachine("series", state.JobHostUnits) |
186 c.Assert(err, IsNil) | 186 c.Assert(err, IsNil) |
187 principal, err := s.wordpress.AddUnit() | 187 principal, err := s.wordpress.AddUnit() |
188 c.Assert(err, IsNil) | 188 c.Assert(err, IsNil) |
189 subordinate := s.addSubordinate(c, principal) | 189 subordinate := s.addSubordinate(c, principal) |
190 | 190 |
191 » assertDeployer := func(u *state.Unit, d state.Tagger) { | 191 » assertDeployer := func(u *state.Unit, d state.Entity) { |
192 err := u.Refresh() | 192 err := u.Refresh() |
193 c.Assert(err, IsNil) | 193 c.Assert(err, IsNil) |
194 name, ok := u.DeployerTag() | 194 name, ok := u.DeployerTag() |
195 if d == nil { | 195 if d == nil { |
196 c.Assert(ok, jc.IsFalse) | 196 c.Assert(ok, jc.IsFalse) |
197 } else { | 197 } else { |
198 c.Assert(ok, jc.IsTrue) | 198 c.Assert(ok, jc.IsTrue) |
199 c.Assert(name, Equals, d.Tag()) | 199 c.Assert(name, Equals, d.Tag()) |
200 } | 200 } |
201 } | 201 } |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 c.Assert(err, IsNil) | 1158 c.Assert(err, IsNil) |
1159 assignments[id] = append(assignments[id], r.u) | 1159 assignments[id] = append(assignments[id], r.u) |
1160 } | 1160 } |
1161 for id, us := range assignments { | 1161 for id, us := range assignments { |
1162 if len(us) != 1 { | 1162 if len(us) != 1 { |
1163 c.Errorf("machine %s expected one unit, got %q", id, us) | 1163 c.Errorf("machine %s expected one unit, got %q", id, us) |
1164 } | 1164 } |
1165 } | 1165 } |
1166 c.Assert(assignments, HasLen, len(us)) | 1166 c.Assert(assignments, HasLen, len(us)) |
1167 } | 1167 } |
OLD | NEW |