Ejemplo n.º 1
0
func (t *LiveTests) TestStartInstanceConstraints(c *C) {
	cons := constraints.MustParse("mem=2G")
	inst, hc, err := t.Env.StartInstance("31", "fake_nonce", config.DefaultSeries, cons, testing.FakeStateInfo("31"), testing.FakeAPIInfo("31"))
	c.Assert(err, IsNil)
	defer t.Env.StopInstances([]instance.Instance{inst})
	ec2inst := ec2.InstanceEC2(inst)
	c.Assert(ec2inst.InstanceType, Equals, "m1.medium")
	c.Assert(*hc.Arch, Equals, "amd64")
	c.Assert(*hc.Mem, Equals, uint64(3840))
	c.Assert(*hc.CpuCores, Equals, uint64(1))
	c.Assert(*hc.CpuPower, Equals, uint64(200))
}
Ejemplo n.º 2
0
func (t *LiveTests) TestInstanceDNSName(c *C) {
	inst, err := t.Env.StartInstance("30", testing.InvalidStateInfo("30"), nil)
	c.Assert(err, IsNil)
	defer t.Env.StopInstances([]environs.Instance{inst})
	dns, err := inst.WaitDNSName()
	// TODO(niemeyer): This assert sometimes fails with "no instances found"
	c.Assert(err, IsNil)
	c.Assert(dns, Not(Equals), "")

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

	ec2inst := ec2.InstanceEC2(insts[0])
	c.Assert(ec2inst.DNSName, Equals, dns)
}
Ejemplo n.º 3
0
func (t *LiveTests) TestInstanceAttributes(c *C) {
	inst, hc := testing.StartInstance(c, t.Env, "30")
	defer t.Env.StopInstances([]instance.Instance{inst})
	// Sanity check for hardware characteristics.
	c.Assert(hc.Arch, NotNil)
	c.Assert(hc.Mem, NotNil)
	c.Assert(hc.CpuCores, NotNil)
	c.Assert(hc.CpuPower, NotNil)
	dns, err := inst.WaitDNSName()
	// TODO(niemeyer): This assert sometimes fails with "no instances found"
	c.Assert(err, IsNil)
	c.Assert(dns, Not(Equals), "")

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

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