-
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 secret list type (#2835)
This adds Diff tests for the SDKv2 bridge for secrets in list types. Part of #2791
- Loading branch information
1 parent
80add2e
commit 278674c
Showing
37 changed files
with
1,982 additions
and
3 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
...ff_test/testdata/TestSDKv2DetailedDiffList/list_block_nested_sensitive/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 | ||
`, | ||
} |
36 changes: 36 additions & 0 deletions
36
...est/testdata/TestSDKv2DetailedDiffList/list_block_nested_sensitive/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,36 @@ | ||
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" | ||
|
||
+ list_block { | ||
+ nested_prop = (sensitive value) | ||
} | ||
} | ||
|
||
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] | ||
+ listBlocks: [secret] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listBlocks": map[string]interface{}{}}, | ||
} |
41 changes: 41 additions & 0 deletions
41
...s/diff_test/testdata/TestSDKv2DetailedDiffList/list_block_nested_sensitive/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,41 @@ | ||
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" | ||
|
||
~ list_block { | ||
~ nested_prop = (sensitive value) | ||
} | ||
} | ||
|
||
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] | ||
~ listBlocks: [ | ||
~ [0]: { | ||
~ nestedProp: [secret] => [secret] | ||
} | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listBlocks[0].nestedProp": map[string]interface{}{"kind": "UPDATE"}}, | ||
} |
46 changes: 46 additions & 0 deletions
46
...data/TestSDKv2DetailedDiffList/list_block_nested_sensitive/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,46 @@ | ||
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" | ||
|
||
+ list_block { | ||
+ nested_prop = (sensitive value) | ||
} | ||
|
||
# (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] | ||
~ listBlocks: [ | ||
+ [2]: [secret] | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"listBlocks[2]": map[string]interface{}{}}, | ||
} |
60 changes: 60 additions & 0 deletions
60
...ata/TestSDKv2DetailedDiffList/list_block_nested_sensitive/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,60 @@ | ||
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" | ||
|
||
~ list_block { | ||
~ nested_prop = (sensitive value) | ||
} | ||
~ list_block { | ||
~ nested_prop = (sensitive value) | ||
} | ||
+ list_block { | ||
+ nested_prop = (sensitive value) | ||
} | ||
} | ||
|
||
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] | ||
~ listBlocks: [ | ||
~ [0]: { | ||
~ nestedProp: [secret] => [secret] | ||
} | ||
~ [1]: { | ||
~ nestedProp: [secret] => [secret] | ||
} | ||
+ [2]: [secret] | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"listBlocks[0].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"listBlocks[1].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"listBlocks[2]": map[string]interface{}{}, | ||
}, | ||
} |
55 changes: 55 additions & 0 deletions
55
...ta/TestSDKv2DetailedDiffList/list_block_nested_sensitive/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,55 @@ | ||
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" | ||
|
||
~ list_block { | ||
~ nested_prop = (sensitive value) | ||
} | ||
+ list_block { | ||
+ nested_prop = (sensitive value) | ||
} | ||
|
||
# (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] | ||
~ listBlocks: [ | ||
~ [1]: { | ||
~ nestedProp: [secret] => [secret] | ||
} | ||
+ [2]: [secret] | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"listBlocks[1].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"listBlocks[2]": map[string]interface{}{}, | ||
}, | ||
} |
60 changes: 60 additions & 0 deletions
60
...ata/TestSDKv2DetailedDiffList/list_block_nested_sensitive/list_element_removed_end.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", | ||
"val2", | ||
"val3", | ||
}, | ||
changeValue: &[]string{ | ||
"val2", | ||
"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" | ||
|
||
~ list_block { | ||
~ nested_prop = (sensitive value) | ||
} | ||
~ list_block { | ||
~ nested_prop = (sensitive value) | ||
} | ||
- list_block { | ||
- nested_prop = (sensitive value) -> null | ||
} | ||
} | ||
|
||
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] | ||
~ listBlocks: [ | ||
~ [0]: { | ||
~ nestedProp: [secret] => [secret] | ||
} | ||
~ [1]: { | ||
~ nestedProp: [secret] => [secret] | ||
} | ||
- [2]: [secret] | ||
] | ||
Resources: | ||
~ 1 to update | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{ | ||
"listBlocks[0].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"listBlocks[1].nestedProp": map[string]interface{}{"kind": "UPDATE"}, | ||
"listBlocks[2]": map[string]interface{}{"kind": "DELETE"}, | ||
}, | ||
} |
Oops, something went wrong.