terraform: provider mock should close itself to find bugs

This commit is contained in:
Mitchell Hashimoto 2015-06-29 10:33:37 -07:00
parent 00a177cd99
commit d6f7261190
2 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,8 @@ type MockResourceProvider struct {
// Anything you want, in case you need to store extra data with the mock.
Meta interface{}
CloseCalled bool
CloseError error
InputCalled bool
InputInput UIInput
InputConfig *ResourceConfig
@ -55,6 +57,11 @@ type MockResourceProvider struct {
ValidateResourceReturnErrors []error
}
func (p *MockResourceProvider) Close() error {
p.CloseCalled = true
return p.CloseError
}
func (p *MockResourceProvider) Input(
input UIInput, c *ResourceConfig) (*ResourceConfig, error) {
p.InputCalled = true

View File

@ -6,4 +6,5 @@ import (
func TestMockResourceProvider_impl(t *testing.T) {
var _ ResourceProvider = new(MockResourceProvider)
var _ ResourceProviderCloser = new(MockResourceProvider)
}