From 99b9611351fdbb183b42fe126d1d8f34da26f623 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Mon, 25 Jan 2016 16:36:14 +0100 Subject: [PATCH] Remove a race condition from TestRetentionCutoff --- storage/local/storage_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/local/storage_test.go b/storage/local/storage_test.go index e85316708..701a56f38 100644 --- a/storage/local/storage_test.go +++ b/storage/local/storage_test.go @@ -377,7 +377,10 @@ func TestRetentionCutoff(t *testing.T) { defer closer.Close() // Stop maintenance loop to prevent actual purging. - s.loopStopping <- struct{}{} + close(s.loopStopping) + <-s.loopStopped + // Recreate channel to avoid panic when we really shut down. + s.loopStopping = make(chan struct{}) s.dropAfter = 1 * time.Hour