@@ -219,19 +219,19 @@ func TestRunningMultipleSchedules(t *testing.T) {
219
219
// Test that the cron is run in the local time zone (as opposed to UTC).
220
220
func TestLocalTimezone (t * testing.T ) {
221
221
wg := & sync.WaitGroup {}
222
- wg .Add (1 )
222
+ wg .Add (2 )
223
223
224
224
now := time .Now ().Local ()
225
- spec := fmt .Sprintf ("%d %d %d %d %d ?" ,
226
- now .Second ()+ 1 , now .Minute (), now .Hour (), now .Day (), now .Month ())
225
+ spec := fmt .Sprintf ("%d,%d %d %d %d %d ?" ,
226
+ now .Second ()+ 1 , now .Second () + 2 , now . Minute (), now .Hour (), now .Day (), now .Month ())
227
227
228
228
cron := New ()
229
229
cron .AddFunc (spec , func () { wg .Done () })
230
230
cron .Start ()
231
231
defer cron .Stop ()
232
232
233
233
select {
234
- case <- time .After (ONE_SECOND ):
234
+ case <- time .After (ONE_SECOND * 2 ):
235
235
t .FailNow ()
236
236
case <- wait (wg ):
237
237
}
@@ -240,7 +240,7 @@ func TestLocalTimezone(t *testing.T) {
240
240
// Test that the cron is run in the given time zone (as opposed to local).
241
241
func TestNonLocalTimezone (t * testing.T ) {
242
242
wg := & sync.WaitGroup {}
243
- wg .Add (1 )
243
+ wg .Add (2 )
244
244
245
245
loc , err := time .LoadLocation ("Atlantic/Cape_Verde" )
246
246
if err != nil {
@@ -249,16 +249,16 @@ func TestNonLocalTimezone(t *testing.T) {
249
249
}
250
250
251
251
now := time .Now ().In (loc )
252
- spec := fmt .Sprintf ("%d %d %d %d %d ?" ,
253
- now .Second ()+ 1 , now .Minute (), now .Hour (), now .Day (), now .Month ())
252
+ spec := fmt .Sprintf ("%d,%d %d %d %d %d ?" ,
253
+ now .Second ()+ 1 , now .Second () + 2 , now . Minute (), now .Hour (), now .Day (), now .Month ())
254
254
255
255
cron := NewWithLocation (loc )
256
256
cron .AddFunc (spec , func () { wg .Done () })
257
257
cron .Start ()
258
258
defer cron .Stop ()
259
259
260
260
select {
261
- case <- time .After (ONE_SECOND ):
261
+ case <- time .After (ONE_SECOND * 2 ):
262
262
t .FailNow ()
263
263
case <- wait (wg ):
264
264
}
0 commit comments