mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-04 02:42:34 +02:00
fix(task): fix task tests
This commit is contained in:
parent
72923b8cfa
commit
93a81fd558
1 changed files with 3 additions and 3 deletions
|
@ -49,7 +49,7 @@ func TestTaskStuck(t *testing.T) {
|
||||||
})
|
})
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
task.Finish(nil)
|
task.FinishAndWait(nil)
|
||||||
close(done)
|
close(done)
|
||||||
}()
|
}()
|
||||||
time.Sleep(time.Millisecond * 100)
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
@ -81,7 +81,7 @@ func TestTaskOnCancelOnFinished(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
expect.False(t, shouldTrueOnFinish)
|
expect.False(t, shouldTrueOnFinish)
|
||||||
task.Finish(nil)
|
task.FinishAndWait(nil)
|
||||||
expect.True(t, shouldTrueOnCancel)
|
expect.True(t, shouldTrueOnCancel)
|
||||||
expect.True(t, shouldTrueOnFinish)
|
expect.True(t, shouldTrueOnFinish)
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func TestCommonFlowWithGracefulShutdown(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer task.Finish(nil)
|
defer task.FinishAndWait(nil)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-task.Context().Done():
|
case <-task.Context().Done():
|
||||||
|
|
Loading…
Add table
Reference in a new issue