terraform: provider mock should close itself to find bugs
This commit is contained in:
parent
00a177cd99
commit
d6f7261190
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue