diff options
author | Joe Chen <jc@unknwon.io> | 2023-12-17 16:32:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-17 16:32:28 -0500 |
commit | 25fdeaac49af622ff8e059a3502df6d7190f7313 (patch) | |
tree | 7a0a516f8034f6bdf070d2e7c27c1b70950d0476 /internal/db/public_keys_test.go | |
parent | 0c7b45ad1f41e0aa4494fae70cfa3b7668245e24 (diff) |
db: pass context to tests by default (#7622)
[skip ci]
Diffstat (limited to 'internal/db/public_keys_test.go')
-rw-r--r-- | internal/db/public_keys_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/db/public_keys_test.go b/internal/db/public_keys_test.go index 1e83014b..32983e96 100644 --- a/internal/db/public_keys_test.go +++ b/internal/db/public_keys_test.go @@ -5,6 +5,7 @@ package db import ( + "context" "fmt" "os" "path/filepath" @@ -23,6 +24,7 @@ func TestPublicKeys(t *testing.T) { } t.Parallel() + ctx := context.Background() tables := []any{new(PublicKey)} db := &publicKeys{ DB: dbtest.NewDB(t, "publicKeys", tables...), @@ -30,7 +32,7 @@ func TestPublicKeys(t *testing.T) { for _, tc := range []struct { name string - test func(t *testing.T, db *publicKeys) + test func(t *testing.T, ctx context.Context, db *publicKeys) }{ {"RewriteAuthorizedKeys", publicKeysRewriteAuthorizedKeys}, } { @@ -39,7 +41,7 @@ func TestPublicKeys(t *testing.T) { err := clearTables(t, db.DB, tables...) require.NoError(t, err) }) - tc.test(t, db) + tc.test(t, ctx, db) }) if t.Failed() { break @@ -47,7 +49,7 @@ func TestPublicKeys(t *testing.T) { } } -func publicKeysRewriteAuthorizedKeys(t *testing.T, db *publicKeys) { +func publicKeysRewriteAuthorizedKeys(t *testing.T, ctx context.Context, db *publicKeys) { // TODO: Use PublicKeys.Add to replace SQL hack when the method is available. publicKey := &PublicKey{ OwnerID: 1, |