states/statemgr: t.Fatal from goroutine
This commit is contained in:
parent
3a6c32cb1c
commit
0fb7d19191
|
@ -67,12 +67,11 @@ func TestLockWithContext(t *testing.T) {
|
||||||
|
|
||||||
// unlock the state during LockWithContext
|
// unlock the state during LockWithContext
|
||||||
unlocked := make(chan struct{})
|
unlocked := make(chan struct{})
|
||||||
|
var unlockErr error
|
||||||
go func() {
|
go func() {
|
||||||
defer close(unlocked)
|
defer close(unlocked)
|
||||||
<-attempted
|
<-attempted
|
||||||
if err := s.Unlock(id); err != nil {
|
unlockErr = s.Unlock(id)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second)
|
ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
|
@ -85,6 +84,9 @@ func TestLockWithContext(t *testing.T) {
|
||||||
|
|
||||||
// ensure the goruotine completes
|
// ensure the goruotine completes
|
||||||
<-unlocked
|
<-unlocked
|
||||||
|
if unlockErr != nil {
|
||||||
|
t.Fatal(unlockErr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
|
Loading…
Reference in New Issue