-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDKv2 Diff tests for Defaults in sets and lists (#2838)
This PR adds Diff tests for Defaults in Set and List schemas. Note that the List and Set themselves can not have Defaults, since TF throws an error on these: `Default is not valid for lists or sets`. Related to #2788 Related to #2789
- Loading branch information
1 parent
413419b
commit 9357cbf
Showing
119 changed files
with
6,426 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
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
...diff_test/testdata/TestSDKv2DetailedDiffList/list_block_nested_default/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{ | ||
initialValue: nil, 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 | ||
`, | ||
} |
42 changes: 42 additions & 0 deletions
42
..._test/testdata/TestSDKv2DetailedDiffList/list_block_nested_default/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,42 @@ | ||
tests.testOutput{ | ||
initialValue: nil, changeValue: &[]string{ | ||
"val1", | ||
}, | ||
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" | ||
|
||
+ prop { | ||
+ default = "default" | ||
+ nested_prop = "val1" | ||
} | ||
} | ||
|
||
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] | ||
+ props: [ | ||
+ [0]: { | ||
+ default : "default" | ||
+ nestedProp: "val1" | ||
} | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"props": map[string]interface{}{}}, | ||
} |
42 changes: 42 additions & 0 deletions
42
...sts/diff_test/testdata/TestSDKv2DetailedDiffList/list_block_nested_default/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,42 @@ | ||
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: | ||
~ 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" | ||
|
||
~ prop { | ||
~ nested_prop = "val1" -> "val2" | ||
# (1 unchanged attribute 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] | ||
~ props: [ | ||
~ [0]: { | ||
~ nestedProp: "val1" => "val2" | ||
} | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"props[0].nestedProp": map[string]interface{}{"kind": "UPDATE"}}, | ||
} |
50 changes: 50 additions & 0 deletions
50
...stdata/TestSDKv2DetailedDiffList/list_block_nested_default/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,50 @@ | ||
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: | ||
~ 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" | ||
|
||
+ prop { | ||
+ default = "default" | ||
+ nested_prop = "val3" | ||
} | ||
|
||
# (2 unchanged blocks 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] | ||
~ props: [ | ||
+ [2]: { | ||
+ default : "default" | ||
+ nestedProp: "val3" | ||
} | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"props[2]": map[string]interface{}{}}, | ||
} |
66 changes: 66 additions & 0 deletions
66
...tdata/TestSDKv2DetailedDiffList/list_block_nested_default/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,66 @@ | ||
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: | ||
~ 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" | ||
|
||
~ prop { | ||
~ nested_prop = "val2" -> "val1" | ||
# (1 unchanged attribute hidden) | ||
} | ||
~ prop { | ||
~ nested_prop = "val3" -> "val2" | ||
# (1 unchanged attribute hidden) | ||
} | ||
+ prop { | ||
+ default = "default" | ||
+ nested_prop = "val3" | ||
} | ||
} | ||
|
||
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] | ||
~ props: [ | ||
~ [0]: { | ||
~ nestedProp: "val2" => "val1" | ||
} | ||
~ [1]: { | ||
~ nestedProp: "val3" => "val2" | ||
} | ||
+ [2]: { | ||
+ default : "default" | ||
+ nestedProp: "val3" | ||
} | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"props[0].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"props[1].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"props[2]": map[string]interface{}{}, | ||
}, | ||
} |
60 changes: 60 additions & 0 deletions
60
...data/TestSDKv2DetailedDiffList/list_block_nested_default/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,60 @@ | ||
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: | ||
~ 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" | ||
|
||
~ prop { | ||
~ nested_prop = "val3" -> "val2" | ||
# (1 unchanged attribute hidden) | ||
} | ||
+ prop { | ||
+ default = "default" | ||
+ nested_prop = "val3" | ||
} | ||
|
||
# (1 unchanged block 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] | ||
~ props: [ | ||
~ [1]: { | ||
~ nestedProp: "val3" => "val2" | ||
} | ||
+ [2]: { | ||
+ default : "default" | ||
+ nestedProp: "val3" | ||
} | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"props[1].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"props[2]": map[string]interface{}{}, | ||
}, | ||
} |
Oops, something went wrong.