core: TestContext2Plan_requiredModuleOutput to use t.Run
This allows us to see the results of the tests for all resources even if one of them fails.
This commit is contained in:
parent
21064771ea
commit
d73b2d778f
|
@ -5551,30 +5551,32 @@ func TestContext2Plan_requiredModuleOutput(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, res := range plan.Changes.Resources {
|
for _, res := range plan.Changes.Resources {
|
||||||
if res.Action != plans.Create {
|
t.Run(fmt.Sprintf("%s %s", res.Action, res.Addr), func(t *testing.T) {
|
||||||
t.Fatalf("expected resource creation, got %s", res.Action)
|
if res.Action != plans.Create {
|
||||||
}
|
t.Fatalf("expected resource creation, got %s", res.Action)
|
||||||
ric, err := res.Decode(ty)
|
}
|
||||||
if err != nil {
|
ric, err := res.Decode(ty)
|
||||||
t.Fatal(err)
|
if err != nil {
|
||||||
}
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
var expected cty.Value
|
var expected cty.Value
|
||||||
switch i := ric.Addr.String(); i {
|
switch i := ric.Addr.String(); i {
|
||||||
case "test_resource.root":
|
case "test_resource.root":
|
||||||
expected = objectVal(t, schema, map[string]cty.Value{
|
expected = objectVal(t, schema, map[string]cty.Value{
|
||||||
"id": cty.UnknownVal(cty.String),
|
"id": cty.UnknownVal(cty.String),
|
||||||
"required": cty.UnknownVal(cty.String),
|
"required": cty.UnknownVal(cty.String),
|
||||||
})
|
})
|
||||||
case "module.mod.test_resource.for_output":
|
case "module.mod.test_resource.for_output":
|
||||||
expected = objectVal(t, schema, map[string]cty.Value{
|
expected = objectVal(t, schema, map[string]cty.Value{
|
||||||
"id": cty.UnknownVal(cty.String),
|
"id": cty.UnknownVal(cty.String),
|
||||||
"required": cty.StringVal("val"),
|
"required": cty.StringVal("val"),
|
||||||
})
|
})
|
||||||
default:
|
default:
|
||||||
t.Fatal("unknown instance:", i)
|
t.Fatal("unknown instance:", i)
|
||||||
}
|
}
|
||||||
|
|
||||||
checkVals(t, expected, ric.After)
|
checkVals(t, expected, ric.After)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue