-
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.
SDKv2 Diff cross tests for replacement of computed properties
- Loading branch information
1 parent
d7eacfb
commit 4eeafda
Showing
6 changed files
with
273 additions
and
1 deletion.
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
24 changes: 24 additions & 0 deletions
24
pkg/internal/tests/cross-tests/testdata/TestComputedProperty/no_change.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,24 @@ | ||
crosstests.testOutput{ | ||
initialValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{ | ||
AttrTypes: map[string]cty.Type{}, | ||
}}, | ||
v: map[string]interface{}{}, | ||
}, | ||
changeValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{AttrTypes: map[string]cty.Type{}}}, | ||
v: map[string]interface{}{}, | ||
}, | ||
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 | ||
`, | ||
} |
45 changes: 45 additions & 0 deletions
45
pkg/internal/tests/cross-tests/testdata/TestComputedProperty/non-computed_added.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 @@ | ||
crosstests.testOutput{ | ||
initialValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{ | ||
AttrTypes: map[string]cty.Type{}, | ||
}}, | ||
v: map[string]interface{}{}, | ||
}, | ||
changeValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{AttrTypes: map[string]cty.Type{ | ||
"other": {typeImpl: cty.primitiveType{ | ||
Kind: cty.primitiveTypeKind(83), | ||
}}, | ||
}}}, | ||
v: map[string]interface{}{"other": "other_value"}, | ||
}, | ||
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" { | ||
~ computed = "computed_value" -> (known after apply) | ||
~ id = "r1" -> (known after apply) | ||
+ other = "other_value" # forces replacement | ||
} | ||
|
||
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=r1] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
+ other: "other_value" | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"other": map[string]interface{}{"kind": "ADD_REPLACE"}}, | ||
} |
47 changes: 47 additions & 0 deletions
47
pkg/internal/tests/cross-tests/testdata/TestComputedProperty/non-computed_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,47 @@ | ||
crosstests.testOutput{ | ||
initialValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{ | ||
AttrTypes: map[string]cty.Type{"other": { | ||
typeImpl: cty.primitiveType{Kind: cty.primitiveTypeKind(83)}, | ||
}}, | ||
}}, | ||
v: map[string]interface{}{"other": "other_value"}, | ||
}, | ||
changeValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{AttrTypes: map[string]cty.Type{ | ||
"other": {typeImpl: cty.primitiveType{ | ||
Kind: cty.primitiveTypeKind(83), | ||
}}, | ||
}}}, | ||
v: map[string]interface{}{"other": "other_value_2"}, | ||
}, | ||
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" { | ||
~ computed = "computed_value" -> (known after apply) | ||
~ id = "r1" -> (known after apply) | ||
~ other = "other_value" -> "other_value_2" # forces replacement | ||
} | ||
|
||
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=r1] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
~ other: "other_value" => "other_value_2" | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"other": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, | ||
} |
43 changes: 43 additions & 0 deletions
43
pkg/internal/tests/cross-tests/testdata/TestComputedProperty/non-computed_removed.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,43 @@ | ||
crosstests.testOutput{ | ||
initialValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{ | ||
AttrTypes: map[string]cty.Type{"other": { | ||
typeImpl: cty.primitiveType{Kind: cty.primitiveTypeKind(83)}, | ||
}}, | ||
}}, | ||
v: map[string]interface{}{"other": "other_value"}, | ||
}, | ||
changeValue: cty.Value{ | ||
ty: cty.Type{typeImpl: cty.typeObject{AttrTypes: map[string]cty.Type{}}}, | ||
v: map[string]interface{}{}, | ||
}, | ||
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" { | ||
~ computed = "computed_value" -> (known after apply) | ||
~ id = "r1" -> (known after apply) | ||
- other = "other_value" -> null # forces replacement | ||
} | ||
|
||
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=r1] | ||
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] | ||
- other: "other_value" | ||
Resources: | ||
+-1 to replace | ||
1 unchanged | ||
`, | ||
detailedDiff: map[string]interface{}{"other": map[string]interface{}{"kind": "DELETE_REPLACE"}}, | ||
} |