func (s *localServerSuite) TestFindImageInvalidInstanceConstraint(c *gc.C) { // Prevent falling over to the public datasource. s.BaseSuite.PatchValue(&imagemetadata.DefaultBaseURL, "") env := s.Open(c) _, err := openstack.FindInstanceSpec(env, "precise", "amd64", "instance-type=m1.large") c.Assert(err, gc.ErrorMatches, `no instance types in some-region matching constraints "instance-type=m1.large"`) }
func (s *localServerSuite) TestFindImageInstanceConstraint(c *gc.C) { // Prevent falling over to the public datasource. s.BaseSuite.PatchValue(&imagemetadata.DefaultBaseURL, "") env := s.Open(c) spec, err := openstack.FindInstanceSpec(env, "precise", "amd64", "instance-type=m1.tiny") c.Assert(err, gc.IsNil) c.Assert(spec.InstanceType.Name, gc.Equals, "m1.tiny") }
func (s *localServerSuite) TestFindImageBadDefaultImage(c *gc.C) { // Prevent falling over to the public datasource. s.BaseSuite.PatchValue(&imagemetadata.DefaultBaseURL, "") env := s.Open(c) // An error occurs if no suitable image is found. _, err := openstack.FindInstanceSpec(env, "saucy", "amd64", "mem=1G") c.Assert(err, gc.ErrorMatches, `no "saucy" images in some-region with arches \[amd64\]`) }