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

View File

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