terraform: test that missing type results in error on import

This commit is contained in:
Mitchell Hashimoto 2016-04-30 16:55:26 -05:00
parent 0701c70eae
commit 58fe557a9f
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 27 additions and 0 deletions

View File

@ -39,6 +39,33 @@ func TestContextImport_basic(t *testing.T) {
}
}
func TestContextImport_missingType(t *testing.T) {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
&InstanceState{
ID: "foo",
},
}
_, err := ctx.Import(&ImportOpts{
Targets: []*ImportTarget{
&ImportTarget{
Addr: "aws_instance.foo",
ID: "bar",
},
},
})
if err == nil {
t.Fatal("should error")
}
}
func TestContextImport_refresh(t *testing.T) {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{