core: Add schema mocks to more of the context apply tests

This commit is contained in:
Martin Atkins 2018-05-25 15:25:28 -07:00
parent 5cf06e86c6
commit cdb32390b9
2 changed files with 39 additions and 16 deletions

View File

@ -3228,10 +3228,33 @@ func TestContext2Apply_multiProviderDestroy(t *testing.T) {
p := testProvider("aws")
p.ApplyFn = testApplyFn
p.DiffFn = testDiffFn
p.GetSchemaReturn = &ProviderSchema{
Provider: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"addr": {Type: cty.String, Optional: true},
},
},
ResourceTypes: map[string]*configschema.Block{
"aws_instance": {
Attributes: map[string]*configschema.Attribute{
"foo": {Type: cty.String, Optional: true},
},
},
},
}
p2 := testProvider("do")
p2 := testProvider("vault")
p2.ApplyFn = testApplyFn
p2.DiffFn = testDiffFn
p2.GetSchemaReturn = &ProviderSchema{
ResourceTypes: map[string]*configschema.Block{
"vault_instance": {
Attributes: map[string]*configschema.Attribute{
"id": {Type: cty.String, Computed: true},
},
},
},
}
var state *State
@ -3248,12 +3271,12 @@ func TestContext2Apply_multiProviderDestroy(t *testing.T) {
})
if _, diags := ctx.Plan(); diags.HasErrors() {
t.Fatalf("diags: %s", diags.Err())
t.Fatalf("errors during create plan: %s", diags.Err())
}
s, diags := ctx.Apply()
if diags.HasErrors() {
t.Fatalf("diags: %s", diags.Err())
t.Fatalf("errors during create apply: %s", diags.Err())
}
state = s
@ -3305,12 +3328,12 @@ func TestContext2Apply_multiProviderDestroy(t *testing.T) {
})
if _, diags := ctx.Plan(); diags.HasErrors() {
t.Fatalf("diags: %s", diags.Err())
t.Fatalf("errors during destroy plan: %s", diags.Err())
}
s, diags := ctx.Apply()
if diags.HasErrors() {
t.Fatalf("diags: %s", diags.Err())
t.Fatalf("errors during destroy apply: %s", diags.Err())
}
if !checked {