update tests with another example
This commit is contained in:
parent
2d06c81e4b
commit
3bf89fb81e
|
@ -14,12 +14,14 @@ func TestAWSSecurityGroupRuleMigrateState(t *testing.T) {
|
||||||
// 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
|
// 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 {
|
cases := map[string]struct {
|
||||||
StateVersion int
|
StateVersion int
|
||||||
|
ID string
|
||||||
Attributes map[string]string
|
Attributes map[string]string
|
||||||
Expected string
|
Expected string
|
||||||
Meta interface{}
|
Meta interface{}
|
||||||
}{
|
}{
|
||||||
"v0_1": {
|
"v0_1": {
|
||||||
StateVersion: 0,
|
StateVersion: 0,
|
||||||
|
ID: "sg-4235098228",
|
||||||
Attributes: map[string]string{
|
Attributes: map[string]string{
|
||||||
"self": "false",
|
"self": "false",
|
||||||
"to_port": "0",
|
"to_port": "0",
|
||||||
|
@ -27,25 +29,33 @@ func TestAWSSecurityGroupRuleMigrateState(t *testing.T) {
|
||||||
"cidr_blocks.#": "0",
|
"cidr_blocks.#": "0",
|
||||||
"type": "ingress",
|
"type": "ingress",
|
||||||
"protocol": "-1",
|
"protocol": "-1",
|
||||||
"id": "sg-4235098228",
|
|
||||||
"from_port": "0",
|
"from_port": "0",
|
||||||
"source_security_group_id": "sg-11877275",
|
"source_security_group_id": "sg-11877275",
|
||||||
},
|
},
|
||||||
Expected: "sg-3766347571",
|
Expected: "sg-3766347571",
|
||||||
},
|
},
|
||||||
// "v0_2": {
|
"v0_2": {
|
||||||
// StateVersion: 0,
|
StateVersion: 0,
|
||||||
// Attributes: map[string]string{
|
ID: "sg-1021609891",
|
||||||
// // EBS
|
Attributes: map[string]string{
|
||||||
// "self": "false",
|
"security_group_id": "sg-0981746d",
|
||||||
// },
|
"from_port": "0",
|
||||||
// Expected: "sg-1235",
|
"to_port": "0",
|
||||||
// },
|
"type": "ingress",
|
||||||
|
"self": "false",
|
||||||
|
"protocol": "-1",
|
||||||
|
"cidr_blocks.0": "172.16.1.0/24",
|
||||||
|
"cidr_blocks.1": "172.16.2.0/24",
|
||||||
|
"cidr_blocks.2": "172.16.3.0/24",
|
||||||
|
"cidr_blocks.3": "172.16.4.0/24",
|
||||||
|
"cidr_blocks.#": "4"},
|
||||||
|
Expected: "sg-4100229787",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for tn, tc := range cases {
|
for tn, tc := range cases {
|
||||||
is := &terraform.InstanceState{
|
is := &terraform.InstanceState{
|
||||||
ID: "sg-4235098228",
|
ID: tc.ID,
|
||||||
Attributes: tc.Attributes,
|
Attributes: tc.Attributes,
|
||||||
}
|
}
|
||||||
is, err := resourceAwsSecurityGroupRuleMigrateState(
|
is, err := resourceAwsSecurityGroupRuleMigrateState(
|
||||||
|
|
Loading…
Reference in New Issue