From 1aad5cf6d5e10254e4659cd7836bc31fbe412b1e Mon Sep 17 00:00:00 2001 From: Mark Peek Date: Mon, 12 Oct 2015 13:20:18 -0700 Subject: [PATCH] provisioner/windows-restart: remove race in test --- provisioner/windows-restart/provisioner_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/provisioner/windows-restart/provisioner_test.go b/provisioner/windows-restart/provisioner_test.go index 1f3f70ba3..9baf65845 100644 --- a/provisioner/windows-restart/provisioner_test.go +++ b/provisioner/windows-restart/provisioner_test.go @@ -193,12 +193,14 @@ func TestProvision_waitForRestartTimeout(t *testing.T) { p.Prepare(config) waitForCommunicatorOld := waitForCommunicator waitDone := make(chan bool) + waitContinue := make(chan bool) // Block until cancel comes through waitForCommunicator = func(p *Provisioner) error { for { select { case <-waitDone: + waitContinue <- true } } } @@ -207,7 +209,7 @@ func TestProvision_waitForRestartTimeout(t *testing.T) { err = p.Provision(ui, comm) waitDone <- true }() - <-waitDone + <-waitContinue if err == nil { t.Fatal("should not have error")