remove temp test
This commit is contained in:
parent
ea68d79ea2
commit
f195ce7fd4
|
@ -1486,85 +1486,3 @@ func TestAssertPlanValid(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssertPlanValidTEST(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
Schema *configschema.Block
|
||||
Prior cty.Value
|
||||
Config cty.Value
|
||||
Planned cty.Value
|
||||
WantErrs []string
|
||||
}{
|
||||
"computed in map": {
|
||||
&configschema.Block{
|
||||
Attributes: map[string]*configschema.Attribute{
|
||||
"items": {
|
||||
NestedType: &configschema.Object{
|
||||
Nesting: configschema.NestingMap,
|
||||
Attributes: map[string]*configschema.Attribute{
|
||||
"name": {
|
||||
Type: cty.String,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
cty.NullVal(cty.Object(map[string]cty.Type{
|
||||
"items": cty.Map(cty.Object(map[string]cty.Type{
|
||||
"name": cty.String,
|
||||
})),
|
||||
})),
|
||||
cty.ObjectVal(map[string]cty.Value{
|
||||
"items": cty.MapVal(map[string]cty.Value{
|
||||
"one": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
//"name": cty.StringVal("computed"),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
cty.ObjectVal(map[string]cty.Value{
|
||||
"items": cty.MapVal(map[string]cty.Value{
|
||||
"one": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("computed"),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
nil,
|
||||
},
|
||||
}
|
||||
for name, test := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
errs := AssertPlanValid(test.Schema, test.Prior, test.Config, test.Planned)
|
||||
|
||||
wantErrs := make(map[string]struct{})
|
||||
gotErrs := make(map[string]struct{})
|
||||
for _, err := range errs {
|
||||
gotErrs[tfdiags.FormatError(err)] = struct{}{}
|
||||
}
|
||||
for _, msg := range test.WantErrs {
|
||||
wantErrs[msg] = struct{}{}
|
||||
}
|
||||
|
||||
t.Logf(
|
||||
"\nprior: %sconfig: %splanned: %s",
|
||||
dump.Value(test.Planned),
|
||||
dump.Value(test.Config),
|
||||
dump.Value(test.Planned),
|
||||
)
|
||||
for msg := range wantErrs {
|
||||
if _, ok := gotErrs[msg]; !ok {
|
||||
t.Errorf("missing expected error: %s", msg)
|
||||
}
|
||||
}
|
||||
for msg := range gotErrs {
|
||||
if _, ok := wantErrs[msg]; !ok {
|
||||
t.Errorf("unexpected extra error: %s", msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue