mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-07 22:53:08 -06:00
core: Don't panic in TestContext2Apply_dataDependsOn if data source fails
This commit is contained in:
parent
412439ae01
commit
8ada1bd712
@ -9276,8 +9276,16 @@ func TestContext2Apply_dataDependsOn(t *testing.T) {
|
||||
assertNoErrors(t, diags)
|
||||
|
||||
root := state.Module(addrs.RootModuleInstance)
|
||||
is := root.ResourceInstance(addrs.Resource{
|
||||
Mode: addrs.DataResourceMode,
|
||||
Type: "null_data_source",
|
||||
Name: "read",
|
||||
}.Instance(addrs.NoKey))
|
||||
if is == nil {
|
||||
t.Fatal("data resource instance is not present in state; should be")
|
||||
}
|
||||
var attrs map[string]interface{}
|
||||
err := json.Unmarshal(root.Resources["data.null_data_source.read"].Instances[addrs.NoKey].Current.AttrsJSON, &attrs)
|
||||
err := json.Unmarshal(is.Current.AttrsJSON, &attrs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user