mirror of
https://github.com/docker/compose.git
synced 2025-07-25 06:34:35 +02:00
use BlockUntilContext
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
fa4cfb652e
commit
ed72c21871
@ -147,7 +147,8 @@ func TestWatch_Sync(t *testing.T) {
|
|||||||
|
|
||||||
watcher.Events() <- watch.NewFileEvent("/sync/changed")
|
watcher.Events() <- watch.NewFileEvent("/sync/changed")
|
||||||
watcher.Events() <- watch.NewFileEvent("/sync/changed/sub")
|
watcher.Events() <- watch.NewFileEvent("/sync/changed/sub")
|
||||||
clock.BlockUntil(3)
|
err := clock.BlockUntilContext(ctx, 3)
|
||||||
|
assert.NilError(t, err)
|
||||||
clock.Advance(watch.QuietPeriod)
|
clock.Advance(watch.QuietPeriod)
|
||||||
select {
|
select {
|
||||||
case actual := <-syncer.synced:
|
case actual := <-syncer.synced:
|
||||||
@ -161,7 +162,8 @@ func TestWatch_Sync(t *testing.T) {
|
|||||||
|
|
||||||
watcher.Events() <- watch.NewFileEvent("/rebuild")
|
watcher.Events() <- watch.NewFileEvent("/rebuild")
|
||||||
watcher.Events() <- watch.NewFileEvent("/sync/changed")
|
watcher.Events() <- watch.NewFileEvent("/sync/changed")
|
||||||
clock.BlockUntil(4)
|
err = clock.BlockUntilContext(ctx, 4)
|
||||||
|
assert.NilError(t, err)
|
||||||
clock.Advance(watch.QuietPeriod)
|
clock.Advance(watch.QuietPeriod)
|
||||||
select {
|
select {
|
||||||
case batch := <-syncer.synced:
|
case batch := <-syncer.synced:
|
||||||
|
@ -40,7 +40,8 @@ func Test_BatchDebounceEvents(t *testing.T) {
|
|||||||
ch <- FileEvent(path)
|
ch <- FileEvent(path)
|
||||||
}
|
}
|
||||||
// we sent 100 events + the debouncer
|
// we sent 100 events + the debouncer
|
||||||
clock.BlockUntil(101)
|
err := clock.BlockUntilContext(ctx, 101)
|
||||||
|
assert.NilError(t, err)
|
||||||
clock.Advance(QuietPeriod)
|
clock.Advance(QuietPeriod)
|
||||||
select {
|
select {
|
||||||
case batch := <-eventBatchCh:
|
case batch := <-eventBatchCh:
|
||||||
@ -51,7 +52,8 @@ func Test_BatchDebounceEvents(t *testing.T) {
|
|||||||
case <-time.After(50 * time.Millisecond):
|
case <-time.After(50 * time.Millisecond):
|
||||||
t.Fatal("timed out waiting for events")
|
t.Fatal("timed out waiting for events")
|
||||||
}
|
}
|
||||||
clock.BlockUntil(1)
|
err = clock.BlockUntilContext(ctx, 1)
|
||||||
|
assert.NilError(t, err)
|
||||||
clock.Advance(QuietPeriod)
|
clock.Advance(QuietPeriod)
|
||||||
|
|
||||||
// there should only be a single batch
|
// there should only be a single batch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user