core: Fix TestContext2Apply_dataDependsOn

The value returned from ReadDataSourceFn must conform to the schema for
the data source.
This commit is contained in:
Martin Atkins 2018-09-26 13:27:56 -07:00
parent fbe959ae6e
commit ab1dc08e5c
1 changed files with 5 additions and 9 deletions

View File

@ -9181,24 +9181,20 @@ func TestContext2Apply_dataDependsOn(t *testing.T) {
p.ReadDataSourceFn = func(req providers.ReadDataSourceRequest) providers.ReadDataSourceResponse {
return providers.ReadDataSourceResponse{
State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("boop"),
"foo": cty.StringVal(provisionerOutput),
}),
}
}
_, diags := ctx.Refresh()
if diags.HasErrors() {
t.Fatalf("diags: %s", diags.Err())
}
assertNoErrors(t, diags)
if _, diags := ctx.Plan(); diags.HasErrors() {
t.Fatalf("plan errors: %s", diags.Err())
}
_, diags = ctx.Plan()
assertNoErrors(t, diags)
state, diags := ctx.Apply()
if diags.HasErrors() {
t.Fatalf("diags: %s", diags.Err())
}
assertNoErrors(t, diags)
root := state.Module(addrs.RootModuleInstance)
var attrs map[string]interface{}