Skip to content

Commit 264b2de

Browse files
committed
Add 'unknown prior nested objects' test
1 parent 543afd2 commit 264b2de

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

internal/fwserver/schema_propose_new_plan_test.go

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3851,6 +3851,81 @@ func TestSchemaProposeNewState(t *testing.T) {
38513851
),
38523852
},
38533853
},
3854+
"unknown prior nested objects": {
3855+
schema: schema.Schema{
3856+
Attributes: map[string]schema.Attribute{
3857+
"list": schema.ListNestedAttribute{
3858+
Computed: true,
3859+
NestedObject: schema.NestedAttributeObject{
3860+
Attributes: map[string]schema.Attribute{
3861+
"list": schema.ListNestedAttribute{
3862+
Computed: true,
3863+
NestedObject: schema.NestedAttributeObject{
3864+
Attributes: map[string]schema.Attribute{
3865+
"foo": schema.StringAttribute{},
3866+
},
3867+
},
3868+
},
3869+
},
3870+
},
3871+
},
3872+
},
3873+
},
3874+
priorVal: map[string]tftypes.Value{
3875+
"list": tftypes.NewValue(
3876+
tftypes.List{
3877+
ElementType: tftypes.Object{
3878+
AttributeTypes: map[string]tftypes.Type{
3879+
"list": tftypes.List{
3880+
ElementType: tftypes.Object{
3881+
AttributeTypes: map[string]tftypes.Type{
3882+
"foo": tftypes.String,
3883+
},
3884+
},
3885+
},
3886+
},
3887+
},
3888+
},
3889+
tftypes.UnknownValue,
3890+
),
3891+
},
3892+
configVal: map[string]tftypes.Value{
3893+
"list": tftypes.NewValue(
3894+
tftypes.List{
3895+
ElementType: tftypes.Object{
3896+
AttributeTypes: map[string]tftypes.Type{
3897+
"list": tftypes.List{
3898+
ElementType: tftypes.Object{
3899+
AttributeTypes: map[string]tftypes.Type{
3900+
"foo": tftypes.String,
3901+
},
3902+
},
3903+
},
3904+
},
3905+
},
3906+
},
3907+
nil,
3908+
),
3909+
},
3910+
expectedVal: map[string]tftypes.Value{
3911+
"list": tftypes.NewValue(
3912+
tftypes.List{
3913+
ElementType: tftypes.Object{
3914+
AttributeTypes: map[string]tftypes.Type{
3915+
"list": tftypes.List{
3916+
ElementType: tftypes.Object{
3917+
AttributeTypes: map[string]tftypes.Type{
3918+
"foo": tftypes.String,
3919+
},
3920+
},
3921+
},
3922+
},
3923+
},
3924+
},
3925+
tftypes.UnknownValue,
3926+
),
3927+
},
3928+
},
38543929
}
38553930

38563931
for name, test := range tests {

0 commit comments

Comments
 (0)