Skip to content

Commit 301471a

Browse files
fix comptued tests
1 parent e9fa3ae commit 301471a

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

pkg/tests/diff_test/detailed_diff_primitive_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1010
"github.com/hexops/autogold/v2"
11-
crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests"
1211
"github.com/zclconf/go-cty/cty"
12+
13+
crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests"
1314
)
1415

1516
func TestSDKv2DetailedDiffString(t *testing.T) {
@@ -54,7 +55,7 @@ func TestSDKv2DetailedDiffString(t *testing.T) {
5455
}
5556

5657
setComputedFunc := func(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
57-
if d.Get("string_prop") == nil {
58+
if _, ok := d.GetOk("string_prop"); !ok {
5859
err := d.Set("string_prop", "computed")
5960
if err != nil {
6061
return diag.FromErr(err)

pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Terraform will perform the following actions:
1010
# crossprovider_test_res.example will be updated in-place
1111
~ resource "crossprovider_test_res" "example" {
1212
id = "id"
13-
+ string_prop = "val1"
13+
~ string_prop = "computed" -> "val1"
1414
}
1515

1616
Plan: 0 to add, 1 to change, 0 to destroy.
@@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy.
2222
~ crossprovider:index/testRes:TestRes: (update)
2323
[id=id]
2424
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example]
25-
+ stringProp: "val1"
25+
~ stringProp: "computed" => "val1"
2626
Resources:
2727
~ 1 to update
2828
1 unchanged
2929
`,
30-
detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{}},
30+
detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}},
3131
}

pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Terraform will perform the following actions:
1010
# crossprovider_test_res.example must be replaced
1111
+/- resource "crossprovider_test_res" "example" {
1212
~ id = "id" -> (known after apply)
13-
+ string_prop = "val1" # forces replacement
13+
~ string_prop = "computed" -> "val1" # forces replacement
1414
}
1515

1616
Plan: 1 to add, 0 to change, 1 to destroy.
@@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy.
2222
+-crossprovider:index/testRes:TestRes: (replace)
2323
[id=id]
2424
[urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example]
25-
+ stringProp: "val1"
25+
~ stringProp: "computed" => "val1"
2626
Resources:
2727
+-1 to replace
2828
1 unchanged
2929
`,
30-
detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "ADD_REPLACE"}},
30+
detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}},
3131
}

0 commit comments

Comments
 (0)