mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
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
|
||||
cases := map[string]struct {
|
||||
StateVersion int
|
||||
ID string
|
||||
Attributes map[string]string
|
||||
Expected string
|
||||
Meta interface{}
|
||||
}{
|
||||
"v0_1": {
|
||||
StateVersion: 0,
|
||||
ID: "sg-4235098228",
|
||||
Attributes: map[string]string{
|
||||
"self": "false",
|
||||
"to_port": "0",
|
||||
@ -27,25 +29,33 @@ func TestAWSSecurityGroupRuleMigrateState(t *testing.T) {
|
||||
"cidr_blocks.#": "0",
|
||||
"type": "ingress",
|
||||
"protocol": "-1",
|
||||
"id": "sg-4235098228",
|
||||
"from_port": "0",
|
||||
"source_security_group_id": "sg-11877275",
|
||||
},
|
||||
Expected: "sg-3766347571",
|
||||
},
|
||||
// "v0_2": {
|
||||
// StateVersion: 0,
|
||||
// Attributes: map[string]string{
|
||||
// // EBS
|
||||
// "self": "false",
|
||||
// },
|
||||
// Expected: "sg-1235",
|
||||
// },
|
||||
"v0_2": {
|
||||
StateVersion: 0,
|
||||
ID: "sg-1021609891",
|
||||
Attributes: map[string]string{
|
||||
"security_group_id": "sg-0981746d",
|
||||
"from_port": "0",
|
||||
"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 {
|
||||
is := &terraform.InstanceState{
|
||||
ID: "sg-4235098228",
|
||||
ID: tc.ID,
|
||||
Attributes: tc.Attributes,
|
||||
}
|
||||
is, err := resourceAwsSecurityGroupRuleMigrateState(
|
||||
|
Loading…
Reference in New Issue
Block a user