From 39a8ce6cdb129b04e73033916273bbf6789c7671 Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Thu, 16 Mar 2017 13:22:08 -0700 Subject: [PATCH] Fix test deadlock due to alloc runner not running Don't actualy call AllocRunner.Run() because that executes so much unneeded code for this test. Manually close the waitCh to simulate Run() exiting. --- client/gc_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/gc_test.go b/client/gc_test.go index cc3e7aa27..f4fdedfbf 100644 --- a/client/gc_test.go +++ b/client/gc_test.go @@ -117,6 +117,10 @@ func TestAllocGarbageCollector_Collect(t *testing.T) { t.Fatalf("err: %v", err) } + // Fake that ar.Run() exits + close(ar1.waitCh) + close(ar2.waitCh) + if err := gc.Collect(ar1.Alloc().ID); err != nil { t.Fatalf("err: %v", err) }