Example #1
0
func (s *instanceSuite) TestAvailabilityZoneUnsupported(c *gc.C) {
	// Trigger a not supported error.
	s.AssertConfigParameterUpdated(c, "broken", "InstanceAvailabilityZoneNames")

	_, err := utils.AvailabilityZone(s.State, "id-1")
	c.Check(err, jc.Satisfies, errors.IsNotSupported)
}
Example #2
0
func (s *instanceSuite) TestAvailabilityZone(c *gc.C) {
	env := fakeZonedEnv{Environ: s.Environ}
	env.instZones = []string{"a_zone"}
	s.PatchValue(utils.PatchedGetEnvironment, func(st *state.State) (environs.Environ, error) {
		return &env, nil
	})

	zone, err := utils.AvailabilityZone(s.State, "id-1")
	c.Assert(err, jc.ErrorIsNil)

	c.Check(zone, gc.Equals, "a_zone")
}