From a66085444cf3563969ff41545468a67e966ea351 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 21 Aug 2013 10:21:32 -0700 Subject: [PATCH] packer/rpc: get rid of data races in tests --- packer/rpc/communicator_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packer/rpc/communicator_test.go b/packer/rpc/communicator_test.go index 52867a8e2..b54ad0115 100644 --- a/packer/rpc/communicator_test.go +++ b/packer/rpc/communicator_test.go @@ -99,7 +99,10 @@ func TestCommunicatorRPC(t *testing.T) { c.startCmd.SetExited(42) for i := 0; i < 5; i++ { - if cmd.Exited { + cmd.Lock() + exited := cmd.Exited + cmd.Unlock() + if exited { assert.Equal(cmd.ExitStatus, 42, "should have proper exit status") break }