From 6b7479b396f14b0b90eb79a4516bcf88f01a6b02 Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Wed, 6 Sep 2017 14:07:26 -0700 Subject: [PATCH] Fix swallowed errors in TestRollbackManager_Join() --- vault/rollback_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/vault/rollback_test.go b/vault/rollback_test.go index f050df7e0845..2df77a9046bc 100644 --- a/vault/rollback_test.go +++ b/vault/rollback_test.go @@ -81,11 +81,12 @@ func TestRollbackManager_Join(t *testing.T) { wg := &sync.WaitGroup{} wg.Add(3) + errCh := make(chan error, 3) go func() { defer wg.Done() err := m.Rollback("foo") if err != nil { - t.Fatalf("err: %v", err) + errCh <- err } }() @@ -93,7 +94,7 @@ func TestRollbackManager_Join(t *testing.T) { defer wg.Done() err := m.Rollback("foo") if err != nil { - t.Fatalf("err: %v", err) + errCh <- err } }() @@ -101,8 +102,13 @@ func TestRollbackManager_Join(t *testing.T) { defer wg.Done() err := m.Rollback("foo") if err != nil { - t.Fatalf("err: %v", err) + errCh <- err } }() wg.Wait() + close(errCh) + err := <-errCh + if err != nil { + t.Fatalf("Error on rollback:%v", err) + } }