Пример #1
0
func (s *localServerSuite) TestFindInstanceSpec(c *gc.C) {
	env := s.Prepare(c)
	spec, err := joyent.FindInstanceSpec(env, "trusty", "amd64", "mem=4G")
	c.Assert(err, gc.IsNil)
	c.Assert(spec.InstanceType.VirtType, gc.NotNil)
	c.Check(spec.Image.Arch, gc.Equals, "amd64")
	c.Check(spec.Image.VirtType, gc.Equals, "kvm")
	c.Check(*spec.InstanceType.VirtType, gc.Equals, "kvm")
	c.Check(spec.InstanceType.CpuCores, gc.Equals, uint64(4))
}
Пример #2
0
func (s *localServerSuite) TestFindInstanceSpec(c *gc.C) {
	env := s.Prepare(c)
	imageMetadata := []*imagemetadata.ImageMetadata{{
		Id:       "image-id",
		Arch:     "amd64",
		VirtType: "kvm",
	}}
	spec, err := joyent.FindInstanceSpec(env, "trusty", "amd64", "mem=4G", imageMetadata)
	c.Assert(err, gc.IsNil)
	c.Assert(spec.InstanceType.VirtType, gc.NotNil)
	c.Check(spec.Image.Arch, gc.Equals, "amd64")
	c.Check(spec.Image.VirtType, gc.Equals, "kvm")
	c.Check(*spec.InstanceType.VirtType, gc.Equals, "kvm")
	c.Check(spec.InstanceType.CpuCores, gc.Equals, uint64(4))
}
Пример #3
0
func (s *localServerSuite) TestFindImageBadDefaultImage(c *gc.C) {
	env := s.Prepare(c)
	// An error occurs if no suitable image is found.
	_, err := joyent.FindInstanceSpec(env, "saucy", "amd64", "mem=4G", nil)
	c.Assert(err, gc.ErrorMatches, `no "saucy" images in some-region with arches \[amd64\]`)
}