mirror of
https://github.com/elyby/chrly.git
synced 2024-11-22 21:23:17 +05:30
Another attempt to fix FullBus test
This commit is contained in:
parent
b2e501af60
commit
585318d307
@ -236,8 +236,8 @@ func TestPeriodicStrategy(t *testing.T) {
|
||||
strategy.Queue(j)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ch := strategy.GetJobs(ctx)
|
||||
startedAt := time.Now()
|
||||
ch := strategy.GetJobs(ctx)
|
||||
iteration := <-ch
|
||||
durationBeforeResult := time.Now().Sub(startedAt)
|
||||
require.True(t, durationBeforeResult >= d)
|
||||
@ -371,9 +371,10 @@ func TestFullBusStrategy(t *testing.T) {
|
||||
d := 20 * time.Millisecond
|
||||
strategy := NewFullBusStrategy(d, 10)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
startedAt := time.Now()
|
||||
ch := strategy.GetJobs(ctx)
|
||||
|
||||
var startedAt time.Time
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
defer close(done)
|
||||
@ -385,7 +386,6 @@ func TestFullBusStrategy(t *testing.T) {
|
||||
require.Equal(t, 0, iteration.Queue)
|
||||
}()
|
||||
|
||||
startedAt = time.Now()
|
||||
for _, j := range jobs {
|
||||
strategy.Queue(j)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user