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:
parent
85295e5c23
commit
df38c2e3ea
|
@ -196,13 +196,14 @@ func (p *MockResourceProvider) Diff(
|
||||||
info *InstanceInfo,
|
info *InstanceInfo,
|
||||||
state *InstanceState,
|
state *InstanceState,
|
||||||
desired *ResourceConfig) (*InstanceDiff, error) {
|
desired *ResourceConfig) (*InstanceDiff, error) {
|
||||||
p.Lock()
|
|
||||||
defer p.Unlock()
|
|
||||||
|
|
||||||
|
p.Lock()
|
||||||
p.DiffCalled = true
|
p.DiffCalled = true
|
||||||
p.DiffInfo = info
|
p.DiffInfo = info
|
||||||
p.DiffState = state
|
p.DiffState = state
|
||||||
p.DiffDesired = desired
|
p.DiffDesired = desired
|
||||||
|
p.Unlock()
|
||||||
|
|
||||||
if p.DiffFn != nil {
|
if p.DiffFn != nil {
|
||||||
return p.DiffFn(info, state, desired)
|
return p.DiffFn(info, state, desired)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue