From 0fb7d19191ac4a6662830aaf2f73a8df9ed4fa69 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 1 Dec 2020 15:54:03 -0500 Subject: [PATCH] states/statemgr: t.Fatal from goroutine --- states/statemgr/statemgr_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/states/statemgr/statemgr_test.go b/states/statemgr/statemgr_test.go index 41c73d1dc1..e9e8226712 100644 --- a/states/statemgr/statemgr_test.go +++ b/states/statemgr/statemgr_test.go @@ -67,12 +67,11 @@ func TestLockWithContext(t *testing.T) { // unlock the state during LockWithContext unlocked := make(chan struct{}) + var unlockErr error go func() { defer close(unlocked) <-attempted - if err := s.Unlock(id); err != nil { - t.Fatal(err) - } + unlockErr = s.Unlock(id) }() ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second) @@ -85,6 +84,9 @@ func TestLockWithContext(t *testing.T) { // ensure the goruotine completes <-unlocked + if unlockErr != nil { + t.Fatal(unlockErr) + } } func TestMain(m *testing.M) {