mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: use t.Context in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@@ -15,7 +14,7 @@ func TestContainerPruneError(t *testing.T) {
|
||||
client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.ContainerPrune(context.Background(), ContainerPruneOptions{})
|
||||
_, err = client.ContainerPrune(t.Context(), ContainerPruneOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
}
|
||||
|
||||
@@ -89,7 +88,7 @@ func TestContainerPrune(t *testing.T) {
|
||||
}))
|
||||
assert.NilError(t, err)
|
||||
|
||||
req, err := client.ContainerPrune(context.Background(), ContainerPruneOptions{Filters: listCase.filters})
|
||||
req, err := client.ContainerPrune(t.Context(), ContainerPruneOptions{Filters: listCase.filters})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Len(req.Report.ContainersDeleted, 2))
|
||||
assert.Check(t, is.Equal(uint64(9999), req.Report.SpaceReclaimed))
|
||||
|
||||
Reference in New Issue
Block a user