make the mock provider stoppable

The mock provider couldn't be stopped during diff, because the single
mutex was held through the oepration. Release the mutex so Stop can be
called.
This commit is contained in:
James Bardin 2017-12-02 22:33:53 -05:00
parent 85295e5c23
commit df38c2e3ea
1 changed files with 3 additions and 2 deletions

View File

@ -196,13 +196,14 @@ func (p *MockResourceProvider) Diff(
info *InstanceInfo,
state *InstanceState,
desired *ResourceConfig) (*InstanceDiff, error) {
p.Lock()
defer p.Unlock()
p.Lock()
p.DiffCalled = true
p.DiffInfo = info
p.DiffState = state
p.DiffDesired = desired
p.Unlock()
if p.DiffFn != nil {
return p.DiffFn(info, state, desired)
}