Exemplo n.º 1
0
func (s *localServerSuite) TestFindImageInvalidInstanceConstraint(c *gc.C) {
	// Prevent falling over to the public datasource.
	s.PatchValue(&imagemetadata.DefaultBaseURL, "")

	env := s.Open(c)
	_, err := openstack.FindInstanceSpec(env, "precise", "amd64", "instance-type=m1.large")
	c.Assert(err, gc.ErrorMatches, `invalid instance type "m1.large"`)
}
Exemplo n.º 2
0
func (s *localServerSuite) TestFindImageInstanceConstraint(c *gc.C) {
	// Prevent falling over to the public datasource.
	s.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")
}
Exemplo n.º 3
0
func (s *localServerSuite) TestFindImageBadDefaultImage(c *gc.C) {
	// Prevent falling over to the public datasource.
	s.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\]`)
}