@@ -263,7 +263,8 @@ func TestCreateTask(t *testing.T) {
263263 // wait for the end of determined window
264264 time .Sleep (startWait + windowSize )
265265 // wait an interval to be sure that the task state has been updated
266- time .Sleep (interval )
266+ // we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
267+ time .Sleep (interval + time .Millisecond * 100 )
267268 // check if the task is ended
268269 So (tsk .State (), ShouldEqual , core .TaskEnded )
269270 })
@@ -282,8 +283,8 @@ func TestCreateTask(t *testing.T) {
282283
283284 Convey ("the task should be ended after reaching the end of window" , func () {
284285 // wait an interval to be sure that the task state has been updated
285- // we are ok at this precision with being within 10% over the interval (10ms)
286- time .Sleep (interval * 110 / 100 )
286+ // we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
287+ time .Sleep (interval + time . Millisecond * 100 )
287288 // check if the task is ended
288289 So (tsk .State (), ShouldEqual , core .TaskEnded )
289290 })
@@ -302,8 +303,8 @@ func TestCreateTask(t *testing.T) {
302303 // wait for the end of determined window
303304 time .Sleep (startWait )
304305 // wait an interval to be sure that the task state has been updated
305- // we are ok at this precision with being within 10% over the interval (10ms)
306- time .Sleep (interval * 110 / 100 )
306+ // we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
307+ time .Sleep (interval + time . Millisecond * 100 )
307308 // check if the task is ended
308309 So (tsk .State (), ShouldEqual , core .TaskEnded )
309310 })
@@ -414,8 +415,8 @@ func TestStopTask(t *testing.T) {
414415 // wait for the end of determined window
415416 time .Sleep (startWait + windowSize )
416417 // wait an interval to be sure that the task state has been updated
417- time . Sleep ( interval )
418-
418+ // we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
419+ time . Sleep ( interval + time . Millisecond * 100 )
419420 // check if the task is ended
420421 So (tsk .State (), ShouldEqual , core .TaskEnded )
421422
@@ -500,7 +501,8 @@ func TestStartTask(t *testing.T) {
500501 // wait for the end of determined window
501502 time .Sleep (startWait + windowSize )
502503 // wait an interval to be sure that the task state has been updated
503- time .Sleep (interval )
504+ // we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
505+ time .Sleep (interval + time .Millisecond * 100 )
504506
505507 // check if the task is ended
506508 So (tsk .State (), ShouldEqual , core .TaskEnded )
@@ -596,7 +598,8 @@ func TestEnableTask(t *testing.T) {
596598 // wait for the end of determined window
597599 time .Sleep (startWait + windowSize )
598600 // wait an interval to be sure that the task state has been updated
599- time .Sleep (interval )
601+ /// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
602+ time .Sleep (interval + time .Millisecond * 100 )
600603
601604 // check if the task is ended
602605 So (tsk .State (), ShouldEqual , core .TaskEnded )
0 commit comments