Add TestReset to terraformMockResourceProvider

Have MockResourceProvider implement TestProvider to check that TestReset
is called by the test harness.
This commit is contained in:
James Bardin 2017-03-07 10:05:07 -05:00
parent 1eb9a2d083
commit 0279d11c8a
1 changed files with 10 additions and 0 deletions

View File

@ -56,6 +56,8 @@ type MockResourceProvider struct {
ReadDataDiffFn func(*InstanceInfo, *ResourceConfig) (*InstanceDiff, error)
ReadDataDiffReturn *InstanceDiff
ReadDataDiffReturnError error
TestResetCalled bool
TestResetError error
StopCalled bool
StopFn func() error
StopReturnError error
@ -144,6 +146,14 @@ func (p *MockResourceProvider) Configure(c *ResourceConfig) error {
return p.ConfigureReturnError
}
func (p *MockResourceProvider) TestReset() error {
p.Lock()
defer p.Unlock()
p.TestResetCalled = true
return p.TestResetError
}
func (p *MockResourceProvider) Stop() error {
p.Lock()
defer p.Unlock()