コード例 #1
0
func (s *S) TestDeleteMachine(c *gocheck.C) {
	m := iaas.Machine{
		Id:             "i-0",
		CreationParams: map[string]string{"region": "myregion"},
	}
	iaas := &EC2IaaS{}
	err := iaas.DeleteMachine(&m)
	c.Assert(err, gocheck.IsNil)
}
コード例 #2
0
func (s *S) TestCreateMachine(c *gocheck.C) {
	params := map[string]string{
		"region": "myregion",
		"image":  "ami-xxxxxx",
		"type":   "m1.micro",
	}
	iaas := &EC2IaaS{}
	m, err := iaas.CreateMachine(params)
	m.CreationParams = map[string]string{"region": "myregion"}
	defer iaas.DeleteMachine(m)
	c.Assert(err, gocheck.IsNil)
	c.Assert(m.Id, gocheck.Matches, `i-\d`)
	c.Assert(m.Address, gocheck.Matches, `i-\d.testing.invalid`)
	c.Assert(m.Status, gocheck.Equals, "pending")
}