-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SDKv2 Detailed Diff tests for list replacements
- Loading branch information
1 parent
f94f380
commit bca1c95
Showing
34 changed files
with
1,271 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
pkg/tests/testdata/TestDetailedDiffList/list_attribute_force_new/added_empty.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
tests.testOutput{ | ||
changeValue: &[]string{}, | ||
tfOut: ` | ||
No changes. Your infrastructure matches the configuration. | ||
|
||
Terraform has compared your real infrastructure against your configuration | ||
and found no differences, so no changes are needed. | ||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
Resources: | ||
2 unchanged | ||
`, | ||
} |
37 changes: 37 additions & 0 deletions
37
pkg/tests/testdata/TestDetailedDiffList/list_attribute_force_new/added_non-empty.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
tests.testOutput{ | ||
changeValue: &[]string{ | ||
"val1", | ||
}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
+/- create replacement and then destroy | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example must be replaced | ||
+/- resource "crossprovider_test_res" "example" { | ||
~ id = "newid" -> (known after apply) | ||
+ list_attr = [ # forces replacement | ||
+ "val1", | ||
] | ||
} | ||
|
||
Plan: 1 to add, 0 to change, 1 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
+-crossprovider:index/testRes:TestRes: (replace) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
+ listAttrs: [ | ||
+ [0]: "val1" | ||
] | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listAttrs": map[string]interface{}{"kind": "ADD_REPLACE"}}, | ||
} |
38 changes: 38 additions & 0 deletions
38
pkg/tests/testdata/TestDetailedDiffList/list_attribute_force_new/changed.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
tests.testOutput{ | ||
initialValue: &[]string{ | ||
"val1", | ||
}, | ||
changeValue: &[]string{"val2"}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
+/- create replacement and then destroy | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example must be replaced | ||
+/- resource "crossprovider_test_res" "example" { | ||
~ id = "newid" -> (known after apply) | ||
~ list_attr = [ # forces replacement | ||
~ "val1" -> "val2", | ||
] | ||
} | ||
|
||
Plan: 1 to add, 0 to change, 1 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
+-crossprovider:index/testRes:TestRes: (replace) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ listAttrs: [ | ||
~ [0]: "val1" => "val2" | ||
] | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listAttrs[0]": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, | ||
} |
45 changes: 45 additions & 0 deletions
45
...sts/testdata/TestDetailedDiffList/list_attribute_force_new/list_element_added_back.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
tests.testOutput{ | ||
initialValue: &[]string{ | ||
"val1", | ||
"val2", | ||
}, | ||
changeValue: &[]string{ | ||
"val1", | ||
"val2", | ||
"val3", | ||
}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
+/- create replacement and then destroy | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example must be replaced | ||
+/- resource "crossprovider_test_res" "example" { | ||
~ id = "newid" -> (known after apply) | ||
~ list_attr = [ # forces replacement | ||
# (1 unchanged element hidden) | ||
"val2", | ||
+ "val3", | ||
] | ||
} | ||
|
||
Plan: 1 to add, 0 to change, 1 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
+-crossprovider:index/testRes:TestRes: (replace) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ listAttrs: [ | ||
+ [2]: "val3" | ||
] | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listAttrs[2]": map[string]interface{}{"kind": "ADD_REPLACE"}}, | ||
} |
51 changes: 51 additions & 0 deletions
51
...ts/testdata/TestDetailedDiffList/list_attribute_force_new/list_element_added_front.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
tests.testOutput{ | ||
initialValue: &[]string{ | ||
"val2", | ||
"val3", | ||
}, | ||
changeValue: &[]string{ | ||
"val1", | ||
"val2", | ||
"val3", | ||
}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
+/- create replacement and then destroy | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example must be replaced | ||
+/- resource "crossprovider_test_res" "example" { | ||
~ id = "newid" -> (known after apply) | ||
~ list_attr = [ # forces replacement | ||
+ "val1", | ||
"val2", | ||
# (1 unchanged element hidden) | ||
] | ||
} | ||
|
||
Plan: 1 to add, 0 to change, 1 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
+-crossprovider:index/testRes:TestRes: (replace) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ listAttrs: [ | ||
~ [0]: "val2" => "val1" | ||
~ [1]: "val3" => "val2" | ||
+ [2]: "val3" | ||
] | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"listAttrs[0]": map[string]interface{}{"kind": "UPDATE_REPLACE"}, | ||
"listAttrs[1]": map[string]interface{}{"kind": "UPDATE_REPLACE"}, | ||
"listAttrs[2]": map[string]interface{}{"kind": "ADD_REPLACE"}, | ||
}, | ||
} |
49 changes: 49 additions & 0 deletions
49
...s/testdata/TestDetailedDiffList/list_attribute_force_new/list_element_added_middle.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
tests.testOutput{ | ||
initialValue: &[]string{ | ||
"val1", | ||
"val3", | ||
}, | ||
changeValue: &[]string{ | ||
"val1", | ||
"val2", | ||
"val3", | ||
}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
+/- create replacement and then destroy | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example must be replaced | ||
+/- resource "crossprovider_test_res" "example" { | ||
~ id = "newid" -> (known after apply) | ||
~ list_attr = [ # forces replacement | ||
"val1", | ||
+ "val2", | ||
"val3", | ||
] | ||
} | ||
|
||
Plan: 1 to add, 0 to change, 1 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
+-crossprovider:index/testRes:TestRes: (replace) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ listAttrs: [ | ||
~ [1]: "val3" => "val2" | ||
+ [2]: "val3" | ||
] | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"listAttrs[1]": map[string]interface{}{"kind": "UPDATE_REPLACE"}, | ||
"listAttrs[2]": map[string]interface{}{"kind": "ADD_REPLACE"}, | ||
}, | ||
} |
Oops, something went wrong.