@@ -67,7 +67,7 @@ func testUserQuietHoursScheduleStore() *atomic.Pointer[schedule.UserQuietHoursSc
67
67
68
68
func TestAcquireJob_LongPoll (t * testing.T ) {
69
69
t .Parallel ()
70
- //nolint:dogsled // ૮・ᴥ・ა
70
+ //nolint:dogsled
71
71
srv , _ , _ , _ := setup (t , false , & overrides {acquireJobLongPollDuration : time .Microsecond })
72
72
job , err := srv .AcquireJob (context .Background (), nil )
73
73
require .NoError (t , err )
@@ -76,7 +76,7 @@ func TestAcquireJob_LongPoll(t *testing.T) {
76
76
77
77
func TestAcquireJobWithCancel_Cancel (t * testing.T ) {
78
78
t .Parallel ()
79
- //nolint:dogsled // ૮ ˶′ﻌ ‵˶ ა
79
+ //nolint:dogsled
80
80
srv , _ , _ , _ := setup (t , false , nil )
81
81
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
82
82
defer cancel ()
@@ -101,6 +101,7 @@ func TestAcquireJobWithCancel_Cancel(t *testing.T) {
101
101
func TestHeartbeat (t * testing.T ) {
102
102
t .Parallel ()
103
103
104
+ numBeats := 3
104
105
ctx , cancel := context .WithCancel (context .Background ())
105
106
t .Cleanup (cancel )
106
107
heartbeatChan := make (chan struct {})
@@ -114,28 +115,17 @@ func TestHeartbeat(t *testing.T) {
114
115
return nil
115
116
}
116
117
}
117
- //nolint:dogsled // 。:゚૮ ˶ˆ ﻌ ˆ˶ ა ゚:。
118
+ //nolint:dogsled
118
119
_ , _ , _ , _ = setup (t , false , & overrides {
119
120
ctx : ctx ,
120
121
heartbeatFn : heartbeatFn ,
121
122
heartbeatInterval : testutil .IntervalFast ,
122
123
})
123
124
124
- _ , ok := <- heartbeatChan
125
- require .True (t , ok , "first heartbeat not received" )
126
- _ , ok = <- heartbeatChan
127
- require .True (t , ok , "second heartbeat not received" )
128
- cancel ()
129
- // Close the channel to ensure we don't receive any more heartbeats.
130
- // The test will fail if we do.
131
- defer func () {
132
- if r := recover (); r != nil {
133
- t .Fatalf ("heartbeat received after cancel: %v" , r )
134
- }
135
- }()
136
-
137
- close (heartbeatChan )
138
- <- time .After (testutil .IntervalMedium )
125
+ for i := 0 ; i < numBeats ; i ++ {
126
+ testutil .RequireRecvCtx (ctx , t , heartbeatChan )
127
+ }
128
+ // goleak.VerifyTestMain ensures that the heartbeat goroutine does not leak
139
129
}
140
130
141
131
func TestAcquireJob (t * testing.T ) {
0 commit comments