mirror of
https://github.com/docker/compose.git
synced 2026-11-18 22:27:03 +00:00
test(events): use t.Context() in stream error tests
forbidigo rejects context.Background() in tests; t.Context() is the intended replacement and carries the test's cancellation. Signed-off-by: Zhuoming Wang <zhuomingwang0901@outlook.com>
This commit is contained in:
parent
a74e89a7cc
commit
ac8b2cd44e
1 changed files with 2 additions and 3 deletions
|
|
@ -17,7 +17,6 @@
|
|||
package inspect
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"testing"
|
||||
|
|
@ -42,7 +41,7 @@ func TestEventsTreatsEOFAsCompletion(t *testing.T) {
|
|||
})
|
||||
service := New(&fakeBackend{apiClient: apiClient})
|
||||
|
||||
err := service.Events(context.Background(), "project", api.EventsOptions{
|
||||
err := service.Events(t.Context(), "project", api.EventsOptions{
|
||||
Consumer: func(api.Event) error { return nil },
|
||||
})
|
||||
|
||||
|
|
@ -61,7 +60,7 @@ func TestEventsPropagatesStreamErrors(t *testing.T) {
|
|||
})
|
||||
service := New(&fakeBackend{apiClient: apiClient})
|
||||
|
||||
err := service.Events(context.Background(), "project", api.EventsOptions{
|
||||
err := service.Events(t.Context(), "project", api.EventsOptions{
|
||||
Consumer: func(api.Event) error { return nil },
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue