fix test fixtures with multiple providers

Allow these to share the same backing MockProvider.
This commit is contained in:
James Bardin 2021-10-12 14:08:37 -04:00
parent ef8f1b3e38
commit 903ae5edfd
2 changed files with 12 additions and 4 deletions

View File

@ -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
},
},
})

View File

@ -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,
})