From cba592d54f83d0b98f85aa2005d6227f33f660af Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 20 Dec 2017 09:18:38 -0500 Subject: [PATCH] minor race issue in mockResourceProvider The interrupt tests for providers no longer check for the condition during the diff operation. defer the lock so other test's DiffFns don't need to be as carefull locking themselves. --- terraform/resource_provider_mock.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/resource_provider_mock.go b/terraform/resource_provider_mock.go index 9131f0f5f..4000e3d21 100644 --- a/terraform/resource_provider_mock.go +++ b/terraform/resource_provider_mock.go @@ -196,13 +196,13 @@ func (p *MockResourceProvider) Diff( info *InstanceInfo, state *InstanceState, desired *ResourceConfig) (*InstanceDiff, error) { - p.Lock() + defer p.Unlock() + p.DiffCalled = true p.DiffInfo = info p.DiffState = state p.DiffDesired = desired - p.Unlock() if p.DiffFn != nil { return p.DiffFn(info, state, desired)