core: Update MockResourceProvisioner to include GetConfigSchema

This method is now required for the ResourceProvisioner interface.
This commit is contained in:
Martin Atkins 2018-05-04 12:06:05 -07:00
parent f085af4ba6
commit 20f6de735d
1 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,10 @@
package terraform
import "sync"
import (
"sync"
"github.com/hashicorp/terraform/config/configschema"
)
// MockResourceProvisioner implements ResourceProvisioner but mocks out all the
// calls for testing purposes.
@ -9,6 +13,10 @@ type MockResourceProvisioner struct {
// Anything you want, in case you need to store extra data with the mock.
Meta interface{}
GetConfigSchemaCalled bool
GetConfigSchemaReturnSchema *configschema.Block
GetConfigSchemaReturnError error
ApplyCalled bool
ApplyOutput UIOutput
ApplyState *InstanceState
@ -27,6 +35,13 @@ type MockResourceProvisioner struct {
StopReturnError error
}
var _ ResourceProvisioner = (*MockResourceProvisioner)(nil)
func (p *MockResourceProvisioner) GetConfigSchema() (*configschema.Block, error) {
p.GetConfigSchemaCalled = true
return p.GetConfigSchemaReturnSchema, p.GetConfigSchemaReturnError
}
func (p *MockResourceProvisioner) Validate(c *ResourceConfig) ([]string, []error) {
p.Lock()
defer p.Unlock()