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"
|
||||
|
||||
@@ -14,14 +13,14 @@ func TestSecretUpdateError(t *testing.T) {
|
||||
client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.SecretUpdate(context.Background(), "secret_id", SecretUpdateOptions{})
|
||||
_, err = client.SecretUpdate(t.Context(), "secret_id", SecretUpdateOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
|
||||
_, err = client.SecretUpdate(context.Background(), "", SecretUpdateOptions{})
|
||||
_, err = client.SecretUpdate(t.Context(), "", SecretUpdateOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
|
||||
_, err = client.SecretUpdate(context.Background(), " ", SecretUpdateOptions{})
|
||||
_, err = client.SecretUpdate(t.Context(), " ", SecretUpdateOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
}
|
||||
@@ -37,6 +36,6 @@ func TestSecretUpdate(t *testing.T) {
|
||||
}))
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.SecretUpdate(context.Background(), "secret_id", SecretUpdateOptions{})
|
||||
_, err = client.SecretUpdate(t.Context(), "secret_id", SecretUpdateOptions{})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user