コード例 #1
0
ファイル: live_test.go プロジェクト: jameinel/core
func (t *LiveTests) TestStartInstanceConstraints(c *gc.C) {
	cons := constraints.MustParse("mem=2G")
	inst, hc := testing.AssertStartInstanceWithConstraints(c, t.Env, "30", cons)
	defer t.Env.StopInstances([]instance.Instance{inst})
	ec2inst := ec2.InstanceEC2(inst)
	c.Assert(ec2inst.InstanceType, gc.Equals, "m1.medium")
	c.Assert(*hc.Arch, gc.Equals, "amd64")
	c.Assert(*hc.Mem, gc.Equals, uint64(3840))
	c.Assert(*hc.RootDisk, gc.Equals, uint64(8192))
	c.Assert(*hc.CpuCores, gc.Equals, uint64(1))
	c.Assert(*hc.CpuPower, gc.Equals, uint64(200))
}
コード例 #2
0
ファイル: live_test.go プロジェクト: jameinel/core
func (t *LiveTests) TestInstanceAttributes(c *gc.C) {
	inst, hc := testing.AssertStartInstance(c, t.Env, "30")
	defer t.Env.StopInstances([]instance.Instance{inst})
	// Sanity check for hardware characteristics.
	c.Assert(hc.Arch, gc.NotNil)
	c.Assert(hc.Mem, gc.NotNil)
	c.Assert(hc.RootDisk, gc.NotNil)
	c.Assert(hc.CpuCores, gc.NotNil)
	c.Assert(hc.CpuPower, gc.NotNil)
	dns, err := inst.WaitDNSName()
	// TODO(niemeyer): This assert sometimes fails with "no instances found"
	c.Assert(err, gc.IsNil)
	c.Assert(dns, gc.Not(gc.Equals), "")

	insts, err := t.Env.Instances([]instance.Id{inst.Id()})
	c.Assert(err, gc.IsNil)
	c.Assert(len(insts), gc.Equals, 1)

	ec2inst := ec2.InstanceEC2(insts[0])
	c.Assert(ec2inst.DNSName, gc.Equals, dns)
	c.Assert(ec2inst.InstanceType, gc.Equals, "m1.small")
}