Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Extended sleep duration by 100 ms to allow to complete post-schedule …
Browse files Browse the repository at this point in the history
…activities
  • Loading branch information
IzabellaRaulin committed Mar 24, 2017
1 parent 0ac530a commit 4f681cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
8 changes: 5 additions & 3 deletions scheduler/distributed_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ func TestDistributedSubscriptions(t *testing.T) {
})
Convey("Task should be ended after an interval", func() {
// wait for the end of the task
// we are ok at this precision with being within 10% over the interval (100ms)
time.Sleep(interval * 110 / 100)
// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)
So(t.State(), ShouldEqual, core.TaskEnded)

Convey("So all dependencies should have been usubscribed", func() {
Expand Down Expand Up @@ -364,7 +364,9 @@ func TestDistributedSubscriptions(t *testing.T) {
// wait for the end of determined window
time.Sleep(startWait + windowSize)
// wait an interval to be sure that the task state has been updated
time.Sleep(interval)
// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)

// check if the task has ended
So(t.State(), ShouldEqual, core.TaskEnded)

Expand Down
21 changes: 12 additions & 9 deletions scheduler/scheduler_medium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ func TestCreateTask(t *testing.T) {
// wait for the end of determined window
time.Sleep(startWait + windowSize)
// wait an interval to be sure that the task state has been updated
time.Sleep(interval)
// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)
// check if the task is ended
So(tsk.State(), ShouldEqual, core.TaskEnded)
})
Expand All @@ -282,8 +283,8 @@ func TestCreateTask(t *testing.T) {

Convey("the task should be ended after reaching the end of window", func() {
// wait an interval to be sure that the task state has been updated
// we are ok at this precision with being within 10% over the interval (10ms)
time.Sleep(interval * 110 / 100)
// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)
// check if the task is ended
So(tsk.State(), ShouldEqual, core.TaskEnded)
})
Expand All @@ -302,8 +303,8 @@ func TestCreateTask(t *testing.T) {
// wait for the end of determined window
time.Sleep(startWait)
// wait an interval to be sure that the task state has been updated
// we are ok at this precision with being within 10% over the interval (10ms)
time.Sleep(interval * 110 / 100)
// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)
// check if the task is ended
So(tsk.State(), ShouldEqual, core.TaskEnded)
})
Expand Down Expand Up @@ -414,8 +415,8 @@ func TestStopTask(t *testing.T) {
// wait for the end of determined window
time.Sleep(startWait + windowSize)
// wait an interval to be sure that the task state has been updated
time.Sleep(interval)

// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)
// check if the task is ended
So(tsk.State(), ShouldEqual, core.TaskEnded)

Expand Down Expand Up @@ -500,7 +501,8 @@ func TestStartTask(t *testing.T) {
// wait for the end of determined window
time.Sleep(startWait + windowSize)
// wait an interval to be sure that the task state has been updated
time.Sleep(interval)
// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)

// check if the task is ended
So(tsk.State(), ShouldEqual, core.TaskEnded)
Expand Down Expand Up @@ -596,7 +598,8 @@ func TestEnableTask(t *testing.T) {
// wait for the end of determined window
time.Sleep(startWait + windowSize)
// wait an interval to be sure that the task state has been updated
time.Sleep(interval)
/// we are ok to extend sleeping by 100ms to allow to complete post-schedule activities
time.Sleep(interval + time.Millisecond*100)

// check if the task is ended
So(tsk.State(), ShouldEqual, core.TaskEnded)
Expand Down

0 comments on commit 4f681cb

Please sign in to comment.