From 903ae5edfd1ed00db91d233ed9823b5c8069ba23 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 12 Oct 2021 14:08:37 -0400 Subject: [PATCH] fix test fixtures with multiple providers Allow these to share the same backing MockProvider. --- internal/terraform/context_apply_test.go | 12 +++++++++--- internal/terraform/context_input_test.go | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/terraform/context_apply_test.go b/internal/terraform/context_apply_test.go index a525ab52d..06ff0de10 100644 --- a/internal/terraform/context_apply_test.go +++ b/internal/terraform/context_apply_test.go @@ -582,7 +582,9 @@ func TestContext2Apply_providerAlias(t *testing.T) { p.ApplyResourceChangeFn = testApplyFn ctx := testContext2(t, &ContextOpts{ Providers: map[addrs.Provider]providers.Factory{ - addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p), + addrs.NewDefaultProvider("aws"): func() (providers.Interface, error) { + return p, nil + }, }, }) @@ -616,7 +618,9 @@ func TestContext2Apply_providerAliasConfigure(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Providers: map[addrs.Provider]providers.Factory{ - addrs.NewDefaultProvider("another"): testProviderFuncFixed(p2), + addrs.NewDefaultProvider("another"): func() (providers.Interface, error) { + return p2, nil + }, }, }) @@ -1554,7 +1558,9 @@ func TestContext2Apply_destroyModuleVarProviderConfig(t *testing.T) { ) ctx := testContext2(t, &ContextOpts{ Providers: map[addrs.Provider]providers.Factory{ - addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p), + addrs.NewDefaultProvider("aws"): func() (providers.Interface, error) { + return p, nil + }, }, }) diff --git a/internal/terraform/context_input_test.go b/internal/terraform/context_input_test.go index 819856a6c..a9ec11b38 100644 --- a/internal/terraform/context_input_test.go +++ b/internal/terraform/context_input_test.go @@ -117,7 +117,9 @@ func TestContext2Input_providerMulti(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Providers: map[addrs.Provider]providers.Factory{ - addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p), + addrs.NewDefaultProvider("aws"): func() (providers.Interface, error) { + return p, nil + }, }, UIInput: inp, })