core: use testProvider for TestContextImport_moduleProvider
This test depends on the Refresh callback that comes built in to a provider returned from testProvider.
This commit is contained in:
parent
9c0335e22e
commit
fc8030d2ae
|
@ -189,23 +189,19 @@ func TestContextImport_missingType(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContextImport_moduleProvider(t *testing.T) {
|
func TestContextImport_moduleProvider(t *testing.T) {
|
||||||
p := mockProviderWithResourceTypeSchema("aws_instance", &configschema.Block{})
|
p := testProvider("aws")
|
||||||
p.GetSchemaReturn.Provider = &configschema.Block{
|
|
||||||
Attributes: map[string]*configschema.Attribute{
|
p.GetSchemaReturn = &ProviderSchema{
|
||||||
"foo": {Type: cty.String, Optional: true},
|
Provider: &configschema.Block{
|
||||||
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
"foo": {Type: cty.String, Optional: true},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ResourceTypes: map[string]*configschema.Block{
|
||||||
|
"aws_instance": {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
m := testModule(t, "import-provider")
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
|
||||||
Config: m,
|
|
||||||
ProviderResolver: ResourceProviderResolverFixed(
|
|
||||||
map[string]ResourceProviderFactory{
|
|
||||||
"aws": testProviderFuncFixed(p),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
})
|
|
||||||
|
|
||||||
p.ImportStateReturn = []*InstanceState{
|
p.ImportStateReturn = []*InstanceState{
|
||||||
&InstanceState{
|
&InstanceState{
|
||||||
ID: "foo",
|
ID: "foo",
|
||||||
|
@ -224,6 +220,16 @@ func TestContextImport_moduleProvider(t *testing.T) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m := testModule(t, "import-provider")
|
||||||
|
ctx := testContext2(t, &ContextOpts{
|
||||||
|
Config: m,
|
||||||
|
ProviderResolver: ResourceProviderResolverFixed(
|
||||||
|
map[string]ResourceProviderFactory{
|
||||||
|
"aws": testProviderFuncFixed(p),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
state, diags := ctx.Import(&ImportOpts{
|
state, diags := ctx.Import(&ImportOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Targets: []*ImportTarget{
|
Targets: []*ImportTarget{
|
||||||
|
|
Loading…
Reference in New Issue