update test

This commit is contained in:
Clint Shryock 2015-06-16 16:15:07 -05:00
parent b25fb8a55d
commit 2d06c81e4b
1 changed files with 24 additions and 12 deletions

View File

@ -7,6 +7,11 @@ import (
)
func TestAWSSecurityGroupRuleMigrateState(t *testing.T) {
// "id":"sg-4235098228", "from_port":"0", "source_security_group_id":"sg-11877275"}
// 2015/06/16 16:04:21 terraform-provider-aws: 2015/06/16 16:04:21 [DEBUG] Attributes after migration:
// map[string]string{"from_port":"0", "source_security_group_id":"sg-11877275", "id":"sg-3766347571", "security_group_id":"sg-13877277", "cidr_blocks.#":"0", "type":"ingress", "protocol":"-1", "self":"false", "to_port":"0"}, new id: sg-3766347571
cases := map[string]struct {
StateVersion int
Attributes map[string]string
@ -16,24 +21,31 @@ func TestAWSSecurityGroupRuleMigrateState(t *testing.T) {
"v0_1": {
StateVersion: 0,
Attributes: map[string]string{
// EBS
"self": "true",
"self": "false",
"to_port": "0",
"security_group_id": "sg-13877277",
"cidr_blocks.#": "0",
"type": "ingress",
"protocol": "-1",
"id": "sg-4235098228",
"from_port": "0",
"source_security_group_id": "sg-11877275",
},
Expected: "sg-1234",
},
"v0_2": {
StateVersion: 0,
Attributes: map[string]string{
// EBS
"self": "false",
},
Expected: "sg-1235",
Expected: "sg-3766347571",
},
// "v0_2": {
// StateVersion: 0,
// Attributes: map[string]string{
// // EBS
// "self": "false",
// },
// Expected: "sg-1235",
// },
}
for tn, tc := range cases {
is := &terraform.InstanceState{
ID: "sg-12333",
ID: "sg-4235098228",
Attributes: tc.Attributes,
}
is, err := resourceAwsSecurityGroupRuleMigrateState(