-
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 lists with many elements (#2736)
This adds tests for the SDKv2 bridge detailed diff for lists with many elements. Some previews are suboptimal because of #2239
- Loading branch information
1 parent
82a4eec
commit 4128d15
Showing
21 changed files
with
2,293 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
81 changes: 81 additions & 0 deletions
81
pkg/tests/testdata/TestDetailedDiffList/list_attribute/long_list_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,81 @@ | ||
tests.testOutput{ | ||
initialValue: &[]string{ | ||
"value0", | ||
"value1", | ||
"value2", | ||
"value3", | ||
"value4", | ||
"value5", | ||
"value6", | ||
"value7", | ||
"value8", | ||
"value9", | ||
"value10", | ||
"value11", | ||
"value12", | ||
"value13", | ||
"value14", | ||
"value15", | ||
"value16", | ||
"value17", | ||
"value18", | ||
"value19", | ||
}, | ||
changeValue: &[]string{ | ||
"value0", | ||
"value1", | ||
"value2", | ||
"value3", | ||
"value4", | ||
"value5", | ||
"value6", | ||
"value7", | ||
"value8", | ||
"value9", | ||
"value10", | ||
"value11", | ||
"value12", | ||
"value13", | ||
"value14", | ||
"value15", | ||
"value16", | ||
"value17", | ||
"value18", | ||
"value19", | ||
"value20", | ||
}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
~ update in-place | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example will be updated in-place | ||
~ resource "crossprovider_test_res" "example" { | ||
id = "newid" | ||
~ list_attr = [ | ||
# (19 unchanged elements hidden) | ||
"value19", | ||
+ "value20", | ||
] | ||
} | ||
|
||
Plan: 0 to add, 1 to change, 0 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
~ crossprovider:index/testRes:TestRes: (update) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ listAttrs: [ | ||
+ [20]: "value20" | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listAttrs[20]": map[string]interface{}{}}, | ||
} |
123 changes: 123 additions & 0 deletions
123
pkg/tests/testdata/TestDetailedDiffList/list_attribute/long_list_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,123 @@ | ||
tests.testOutput{ | ||
initialValue: &[]string{ | ||
"value0", | ||
"value1", | ||
"value2", | ||
"value3", | ||
"value4", | ||
"value5", | ||
"value6", | ||
"value7", | ||
"value8", | ||
"value9", | ||
"value10", | ||
"value11", | ||
"value12", | ||
"value13", | ||
"value14", | ||
"value15", | ||
"value16", | ||
"value17", | ||
"value18", | ||
"value19", | ||
}, | ||
changeValue: &[]string{ | ||
"value20", | ||
"value0", | ||
"value1", | ||
"value2", | ||
"value3", | ||
"value4", | ||
"value5", | ||
"value6", | ||
"value7", | ||
"value8", | ||
"value9", | ||
"value10", | ||
"value11", | ||
"value12", | ||
"value13", | ||
"value14", | ||
"value15", | ||
"value16", | ||
"value17", | ||
"value18", | ||
"value19", | ||
}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
~ update in-place | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example will be updated in-place | ||
~ resource "crossprovider_test_res" "example" { | ||
id = "newid" | ||
~ list_attr = [ | ||
+ "value20", | ||
"value0", | ||
# (19 unchanged elements hidden) | ||
] | ||
} | ||
|
||
Plan: 0 to add, 1 to change, 0 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
~ crossprovider:index/testRes:TestRes: (update) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ listAttrs: [ | ||
~ [0]: "value0" => "value20" | ||
~ [1]: "value1" => "value0" | ||
~ [2]: "value2" => "value1" | ||
~ [3]: "value3" => "value2" | ||
~ [4]: "value4" => "value3" | ||
~ [5]: "value5" => "value4" | ||
~ [6]: "value6" => "value5" | ||
~ [7]: "value7" => "value6" | ||
~ [8]: "value8" => "value7" | ||
~ [9]: "value9" => "value8" | ||
~ [10]: "value10" => "value9" | ||
~ [11]: "value11" => "value10" | ||
~ [12]: "value12" => "value11" | ||
~ [13]: "value13" => "value12" | ||
~ [14]: "value14" => "value13" | ||
~ [15]: "value15" => "value14" | ||
~ [16]: "value16" => "value15" | ||
~ [17]: "value17" => "value16" | ||
~ [18]: "value18" => "value17" | ||
~ [19]: "value19" => "value18" | ||
+ [20]: "value19" | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"listAttrs[0]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[10]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[11]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[12]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[13]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[14]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[15]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[16]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[17]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[18]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[19]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[1]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[20]": map[string]interface{}{}, | ||
"listAttrs[2]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[3]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[4]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[5]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[6]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[7]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[8]": map[string]interface{}{"kind": "UPDATE"}, | ||
"listAttrs[9]": map[string]interface{}{"kind": "UPDATE"}, | ||
}, | ||
} |
81 changes: 81 additions & 0 deletions
81
pkg/tests/testdata/TestDetailedDiffList/list_attribute/long_list_removed_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,81 @@ | ||
tests.testOutput{ | ||
initialValue: &[]string{ | ||
"value0", | ||
"value1", | ||
"value2", | ||
"value3", | ||
"value4", | ||
"value5", | ||
"value6", | ||
"value7", | ||
"value8", | ||
"value9", | ||
"value10", | ||
"value11", | ||
"value12", | ||
"value13", | ||
"value14", | ||
"value15", | ||
"value16", | ||
"value17", | ||
"value18", | ||
"value19", | ||
"value20", | ||
}, | ||
changeValue: &[]string{ | ||
"value0", | ||
"value1", | ||
"value2", | ||
"value3", | ||
"value4", | ||
"value5", | ||
"value6", | ||
"value7", | ||
"value8", | ||
"value9", | ||
"value10", | ||
"value11", | ||
"value12", | ||
"value13", | ||
"value14", | ||
"value15", | ||
"value16", | ||
"value17", | ||
"value18", | ||
"value19", | ||
}, | ||
tfOut: ` | ||
Terraform used the selected providers to generate the following execution | ||
plan. Resource actions are indicated with the following symbols: | ||
~ update in-place | ||
|
||
Terraform will perform the following actions: | ||
|
||
# crossprovider_test_res.example will be updated in-place | ||
~ resource "crossprovider_test_res" "example" { | ||
id = "newid" | ||
~ list_attr = [ | ||
# (19 unchanged elements hidden) | ||
"value19", | ||
- "value20", | ||
] | ||
} | ||
|
||
Plan: 0 to add, 1 to change, 0 to destroy. | ||
|
||
`, | ||
pulumiOut: `Previewing update (test): | ||
pulumi:pulumi:Stack: (same) | ||
[urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] | ||
~ crossprovider:index/testRes:TestRes: (update) | ||
[id=newid] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ listAttrs: [ | ||
- [20]: "value20" | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listAttrs[20]": map[string]interface{}{"kind": "DELETE"}}, | ||
} |
Oops, something went wrong.