add data responses where they were missing

A few test with had data sources that were never read before, and needed
to get valid responses for the tests.
This commit is contained in:
James Bardin 2020-05-05 21:34:31 -04:00
parent 047c9b3cc6
commit cf2dd43f30
2 changed files with 20 additions and 1 deletions

View File

@ -5504,11 +5504,18 @@ func TestContext2Plan_invalidOutput(t *testing.T) {
data "aws_data_source" "name" {}
output "out" {
value = "${data.aws_data_source.name.missing}"
value = data.aws_data_source.name.missing
}`,
})
p := testProvider("aws")
p.ReadDataSourceResponse = providers.ReadDataSourceResponse{
State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("data_id"),
"foo": cty.StringVal("foo"),
}),
}
ctx := testContext2(t, &ContextOpts{
Config: m,
Providers: map[addrs.Provider]providers.Factory{
@ -5549,6 +5556,13 @@ resource "aws_instance" "foo" {
})
p := testProvider("aws")
p.ReadDataSourceResponse = providers.ReadDataSourceResponse{
State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("data_id"),
"foo": cty.StringVal("foo"),
}),
}
ctx := testContext2(t, &ContextOpts{
Config: m,
Providers: map[addrs.Provider]providers.Factory{

View File

@ -1612,6 +1612,11 @@ func TestContext2Refresh_dataResourceDependsOn(t *testing.T) {
},
}
p.DiffFn = testDiffFn
p.ReadDataSourceResponse = providers.ReadDataSourceResponse{
State: cty.ObjectVal(map[string]cty.Value{
"compute": cty.StringVal("value"),
}),
}
state := states.NewState()
root := state.EnsureModule(addrs.RootModuleInstance)