Skip to content

Commit 10171c0

Browse files
committed
address comments
1 parent 8adb984 commit 10171c0

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

leader/leader_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,18 @@ func TestElector_Run_ExitsOnContextCancel(t *testing.T) {
190190
e := New(f, log)
191191

192192
ctx, cancel := context.WithCancel(context.Background())
193+
// Cancel immediately
194+
cancel()
193195

194196
done := make(chan struct{})
195197
go func() {
196198
defer close(done)
197199
e.Run(ctx, 33333, time.Hour, func(ctx context.Context) {
198-
cancel()
199-
t.Fatal("onWork should not be called")
200+
t.Error("onWork should not be called")
201+
return
200202
})
201203
}()
202204

203-
// Cancel immediately
204-
cancel()
205-
206205
select {
207206
case <-done:
208207
// Success - Run exited

0 commit comments

Comments
 (0)