func (s *environInstSuite) TestParsePlacementZoneFailure(c *gc.C) { failure := errors.New("<unknown>") s.FakeConn.Err = failure _, err := gce.ParsePlacement(s.Env, "zone=a-zone") c.Check(errors.Cause(err), gc.Equals, failure) }
func (s *environInstSuite) TestParsePlacement(c *gc.C) { zone := google.NewZone("a-zone", google.StatusUp, "", "") s.FakeConn.Zones = []google.AvailabilityZone{zone} placement, err := gce.ParsePlacement(s.Env, "zone=a-zone") c.Assert(err, jc.ErrorIsNil) c.Check(placement.Zone, jc.DeepEquals, &zone) }
func (s *environInstSuite) TestParsePlacementUnknownDirective(c *gc.C) { _, err := gce.ParsePlacement(s.Env, "inst=spam") c.Check(err, gc.ErrorMatches, `.*unknown placement directive: .*`) }
func (s *environInstSuite) TestParsePlacementMissingDirective(c *gc.C) { _, err := gce.ParsePlacement(s.Env, "a-zone") c.Check(err, gc.ErrorMatches, `.*unknown placement directive: .*`) }