client: use t.Context in tests

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-11-10 23:23:23 +01:00
parent d105562bef
commit c950796596
64 changed files with 244 additions and 289 deletions

View File

@@ -1,7 +1,6 @@
package client
import (
"context"
"net/http"
"testing"
@@ -15,7 +14,7 @@ func TestSwarmGetUnlockKeyError(t *testing.T) {
client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
assert.NilError(t, err)
_, err = client.SwarmGetUnlockKey(context.Background())
_, err = client.SwarmGetUnlockKey(t.Context())
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
}
@@ -35,7 +34,7 @@ func TestSwarmGetUnlockKey(t *testing.T) {
}))
assert.NilError(t, err)
result, err := client.SwarmGetUnlockKey(context.Background())
result, err := client.SwarmGetUnlockKey(t.Context())
assert.NilError(t, err)
assert.Check(t, is.Equal(unlockKey, result.Key))
}