Add failing test case for tuple

This commit is contained in:
Radek Simko 2019-01-22 16:49:49 +00:00
parent 3d0a25c65d
commit 0dff8fe5e0
No known key found for this signature in database
GPG Key ID: 1F1C84FE689A88D7
1 changed files with 35 additions and 1 deletions

View File

@ -376,6 +376,41 @@ func TestResourceChange_JSON(t *testing.T) {
}
)
}
`,
},
"in-place update (tuple of different types)": {
Action: plans.Update,
Mode: addrs.ManagedResourceMode,
Before: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("i-02ae66f368e8518a9"),
"json_field": cty.StringVal(`{"aaa": [42, {"foo":"bar"}, "value"]}`),
}),
After: cty.ObjectVal(map[string]cty.Value{
"id": cty.UnknownVal(cty.String),
"json_field": cty.StringVal(`{"aaa": [42, {"foo":"baz"}, "value"]}`),
}),
Schema: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"id": {Type: cty.String, Optional: true, Computed: true},
"json_field": {Type: cty.String, Optional: true},
},
},
RequiredReplace: cty.NewPathSet(),
ExpectedOutput: ` # test_instance.example will be updated in-place
~ resource "test_instance" "example" {
~ id = "i-02ae66f368e8518a9" -> (known after apply)
~ json_field = jsonencode(
~ {
~ aaa = [
42,
~ {
~ foo = "bar" -> "baz"
},
"value",
]
}
)
}
`,
},
"force-new update": {
@ -730,7 +765,6 @@ func TestResourceChange_JSON(t *testing.T) {
}
`,
},
// TODO: JSON with unknown values inside
}
runTestCases(t, testCases)
}