~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/gomaasapi/controller_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
        c.Assert(machines[0].Hostname(), gc.Equals, "untasted-markita")
247
247
}
248
248
 
 
249
func (s *controllerSuite) TestMachinesFilterWithOwnerData(c *gc.C) {
 
250
        controller := s.getController(c)
 
251
        machines, err := controller.Machines(MachinesArgs{
 
252
                Hostnames: []string{"untasted-markita"},
 
253
                OwnerData: map[string]string{
 
254
                        "fez": "jim crawford",
 
255
                },
 
256
        })
 
257
        c.Assert(err, jc.ErrorIsNil)
 
258
        c.Assert(machines, gc.HasLen, 0)
 
259
}
 
260
 
 
261
func (s *controllerSuite) TestMachinesFilterWithOwnerData_MultipleMatches(c *gc.C) {
 
262
        controller := s.getController(c)
 
263
        machines, err := controller.Machines(MachinesArgs{
 
264
                OwnerData: map[string]string{
 
265
                        "braid": "jonathan blow",
 
266
                },
 
267
        })
 
268
        c.Assert(err, jc.ErrorIsNil)
 
269
        c.Assert(machines, gc.HasLen, 2)
 
270
        c.Assert(machines[0].Hostname(), gc.Equals, "lowlier-glady")
 
271
        c.Assert(machines[1].Hostname(), gc.Equals, "icier-nina")
 
272
}
 
273
 
 
274
func (s *controllerSuite) TestMachinesFilterWithOwnerData_RequiresAllMatch(c *gc.C) {
 
275
        controller := s.getController(c)
 
276
        machines, err := controller.Machines(MachinesArgs{
 
277
                OwnerData: map[string]string{
 
278
                        "braid":          "jonathan blow",
 
279
                        "frog-fractions": "jim crawford",
 
280
                },
 
281
        })
 
282
        c.Assert(err, jc.ErrorIsNil)
 
283
        c.Assert(machines, gc.HasLen, 1)
 
284
        c.Assert(machines[0].Hostname(), gc.Equals, "lowlier-glady")
 
285
}
 
286
 
249
287
func (s *controllerSuite) TestMachinesArgs(c *gc.C) {
250
288
        controller := s.getController(c)
251
289
        // This will fail with a 404 due to the test server not having something  at