@@ -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,8 +101,8 @@ func TestAcquireJobWithCancel_Cancel(t *testing.T) {
101
101
func TestHeartbeat (t * testing.T ) {
102
102
t .Parallel ()
103
103
104
- ctx , cancel := context . WithCancel ( context . Background ())
105
- t . Cleanup ( cancel )
104
+ numBeats := 3
105
+ ctx := testutil . Context ( t , testutil . WaitShort )
106
106
heartbeatChan := make (chan struct {})
107
107
heartbeatFn := func (hbCtx context.Context ) error {
108
108
t .Logf ("heartbeat" )
@@ -114,28 +114,17 @@ func TestHeartbeat(t *testing.T) {
114
114
return nil
115
115
}
116
116
}
117
- //nolint:dogsled // 。:゚૮ ˶ˆ ﻌ ˆ˶ ა ゚:。
117
+ //nolint:dogsled
118
118
_ , _ , _ , _ = setup (t , false , & overrides {
119
119
ctx : ctx ,
120
120
heartbeatFn : heartbeatFn ,
121
121
heartbeatInterval : testutil .IntervalFast ,
122
122
})
123
123
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 )
124
+ for i := 0 ; i < numBeats ; i ++ {
125
+ testutil .RequireRecvCtx (ctx , t , heartbeatChan )
126
+ }
127
+ // goleak.VerifyTestMain ensures that the heartbeat goroutine does not leak
139
128
}
140
129
141
130
func TestAcquireJob (t * testing.T ) {
0 commit comments