Skip to content

Commit 69f75b8

Browse files
committed
Add some additional test cases for "Test_makeTerraformInputsNoDefaults"
1 parent ddb54e8 commit 69f75b8

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

pkg/tfbridge/schema_test.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,6 +3129,32 @@ func Test_makeTerraformInputsNoDefaults(t *testing.T) {
31293129
//nolint:lll
31303130
expect: autogold.Expect(map[string]interface{}{"nested_resource": []interface{}{map[string]interface{}{"configuration": map[string]interface{}{"configurationValue": true}}}}),
31313131
},
3132+
{
3133+
testCaseName: "set_nested_block",
3134+
schemaMap: map[string]*schema.Schema{
3135+
"nested_resource": {
3136+
Optional: true,
3137+
Type: shim.TypeSet,
3138+
Elem: (&schema.Resource{
3139+
Schema: schemaMap(map[string]*schema.Schema{
3140+
"configuration": {
3141+
Type: shim.TypeMap,
3142+
Optional: true,
3143+
},
3144+
}),
3145+
}).Shim(),
3146+
},
3147+
},
3148+
propMap: resource.NewPropertyMapFromMap(map[string]interface{}{
3149+
"nestedResources": []map[string]interface{}{{
3150+
"configuration": map[string]interface{}{
3151+
"configurationValue": true,
3152+
},
3153+
}},
3154+
}),
3155+
//nolint:lll
3156+
expect: autogold.Expect(map[string]interface{}{"nested_resource": []interface{}{map[string]interface{}{"configuration": map[string]interface{}{"configurationValue": true}}}}),
3157+
},
31323158
{
31333159
testCaseName: "optional_config",
31343160
schemaMap: map[string]*schema.Schema{
@@ -3263,6 +3289,40 @@ func Test_makeTerraformInputsNoDefaults(t *testing.T) {
32633289
}),
32643290
expect: autogold.Expect(map[string]interface{}{"nil_property_value": nil}),
32653291
},
3292+
{
3293+
testCaseName: "set_attribute",
3294+
schemaMap: map[string]*schema.Schema{
3295+
"set_attribute": {
3296+
Type: shim.TypeSet,
3297+
Optional: true,
3298+
Elem: (&schema.Schema{Type: shim.TypeInt}).Shim(),
3299+
},
3300+
},
3301+
propMap: resource.PropertyMap{
3302+
"set_attribute": resource.NewProperty([]resource.PropertyValue{
3303+
resource.NewProperty(1.0),
3304+
resource.NewProperty(2.0),
3305+
}),
3306+
},
3307+
expect: autogold.Expect(map[string]interface{}{"set_attribute": []interface{}{1, 2}}),
3308+
},
3309+
{
3310+
testCaseName: "list_attribute",
3311+
schemaMap: map[string]*schema.Schema{
3312+
"set_attribute": {
3313+
Type: shim.TypeList,
3314+
Optional: true,
3315+
Elem: (&schema.Schema{Type: shim.TypeInt}).Shim(),
3316+
},
3317+
},
3318+
propMap: resource.PropertyMap{
3319+
"set_attribute": resource.NewProperty([]resource.PropertyValue{
3320+
resource.NewProperty(1.0),
3321+
resource.NewProperty(2.0),
3322+
}),
3323+
},
3324+
expect: autogold.Expect(map[string]interface{}{"set_attribute": []interface{}{1, 2}}),
3325+
},
32663326
// {
32673327
// testCaseName: "???",
32683328
// schemaMap: map[string]*schema.Schema{},

0 commit comments

Comments
 (0)