Skip to content

Commit 0cbaa0b

Browse files
authored
Remove incorrect "db.DefaultContext" usages (#35366)
1 parent 7aef7ea commit 0cbaa0b

File tree

256 files changed

+1951
-2098
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+1951
-2098
lines changed

cmd/admin_user_change_password_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ func TestChangePasswordCommand(t *testing.T) {
1818
ctx := t.Context()
1919

2020
defer func() {
21-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.User{}))
21+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.User{}))
2222
}()
2323

2424
t.Run("change password successfully", func(t *testing.T) {
2525
// defer func() {
26-
// require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.User{}))
26+
// require.NoError(t, db.TruncateBeans(t.Context(), &user_model.User{}))
2727
// }()
2828
// Prepare test user
2929
unittest.AssertNotExistsBean(t, &user_model.User{LowerName: "testuser"})

cmd/admin_user_create_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import (
1919

2020
func TestAdminUserCreate(t *testing.T) {
2121
reset := func() {
22-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.User{}))
23-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.EmailAddress{}))
24-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &auth_model.AccessToken{}))
22+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.User{}))
23+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.EmailAddress{}))
24+
require.NoError(t, db.TruncateBeans(t.Context(), &auth_model.AccessToken{}))
2525
}
2626

2727
t.Run("MustChangePassword", func(t *testing.T) {

cmd/admin_user_delete_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import (
1919
func TestAdminUserDelete(t *testing.T) {
2020
ctx := t.Context()
2121
defer func() {
22-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.User{}))
23-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.EmailAddress{}))
24-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &auth_model.AccessToken{}))
22+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.User{}))
23+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.EmailAddress{}))
24+
require.NoError(t, db.TruncateBeans(t.Context(), &auth_model.AccessToken{}))
2525
}()
2626

2727
setupTestUser := func(t *testing.T) {
@@ -104,8 +104,8 @@ func TestAdminUserDeleteFailure(t *testing.T) {
104104
require.Contains(t, err.Error(), tc.expectedErr)
105105
})
106106

107-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.User{}))
108-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.EmailAddress{}))
109-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &auth_model.AccessToken{}))
107+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.User{}))
108+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.EmailAddress{}))
109+
require.NoError(t, db.TruncateBeans(t.Context(), &auth_model.AccessToken{}))
110110
}
111111
}

cmd/admin_user_must_change_password_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func TestMustChangePassword(t *testing.T) {
1818
defer func() {
19-
require.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.User{}))
19+
require.NoError(t, db.TruncateBeans(t.Context(), &user_model.User{}))
2020
}()
2121
err := microcmdUserCreate().Run(t.Context(), []string{"create", "--username", "testuser", "--email", "[email protected]", "--random-password"})
2222
require.NoError(t, err)

cmd/migrate_storage_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"strings"
99
"testing"
1010

11-
"code.gitea.io/gitea/models/db"
1211
"code.gitea.io/gitea/models/packages"
1312
"code.gitea.io/gitea/models/unittest"
1413
user_model "code.gitea.io/gitea/models/user"
@@ -30,7 +29,7 @@ func TestMigratePackages(t *testing.T) {
3029
assert.NoError(t, err)
3130
defer buf.Close()
3231

33-
v, f, err := packages_service.CreatePackageAndAddFile(db.DefaultContext, &packages_service.PackageCreationInfo{
32+
v, f, err := packages_service.CreatePackageAndAddFile(t.Context(), &packages_service.PackageCreationInfo{
3433
PackageInfo: packages_service.PackageInfo{
3534
Owner: creator,
3635
PackageType: packages.TypeGeneric,

models/actions/runner_token_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package actions
66
import (
77
"testing"
88

9-
"code.gitea.io/gitea/models/db"
109
"code.gitea.io/gitea/models/unittest"
1110

1211
"github.com/stretchr/testify/assert"
@@ -15,16 +14,16 @@ import (
1514
func TestGetLatestRunnerToken(t *testing.T) {
1615
assert.NoError(t, unittest.PrepareTestDatabase())
1716
token := unittest.AssertExistsAndLoadBean(t, &ActionRunnerToken{ID: 3})
18-
expectedToken, err := GetLatestRunnerToken(db.DefaultContext, 1, 0)
17+
expectedToken, err := GetLatestRunnerToken(t.Context(), 1, 0)
1918
assert.NoError(t, err)
2019
assert.Equal(t, expectedToken, token)
2120
}
2221

2322
func TestNewRunnerToken(t *testing.T) {
2423
assert.NoError(t, unittest.PrepareTestDatabase())
25-
token, err := NewRunnerToken(db.DefaultContext, 1, 0)
24+
token, err := NewRunnerToken(t.Context(), 1, 0)
2625
assert.NoError(t, err)
27-
expectedToken, err := GetLatestRunnerToken(db.DefaultContext, 1, 0)
26+
expectedToken, err := GetLatestRunnerToken(t.Context(), 1, 0)
2827
assert.NoError(t, err)
2928
assert.Equal(t, expectedToken, token)
3029
}
@@ -33,8 +32,8 @@ func TestUpdateRunnerToken(t *testing.T) {
3332
assert.NoError(t, unittest.PrepareTestDatabase())
3433
token := unittest.AssertExistsAndLoadBean(t, &ActionRunnerToken{ID: 3})
3534
token.IsActive = true
36-
assert.NoError(t, UpdateRunnerToken(db.DefaultContext, token))
37-
expectedToken, err := GetLatestRunnerToken(db.DefaultContext, 1, 0)
35+
assert.NoError(t, UpdateRunnerToken(t.Context(), token))
36+
expectedToken, err := GetLatestRunnerToken(t.Context(), 1, 0)
3837
assert.NoError(t, err)
3938
assert.Equal(t, expectedToken, token)
4039
}

models/activities/action_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestAction_GetRepoPath(t *testing.T) {
2525
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
2626
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
2727
action := &activities_model.Action{RepoID: repo.ID}
28-
assert.Equal(t, path.Join(owner.Name, repo.Name), action.GetRepoPath(db.DefaultContext))
28+
assert.Equal(t, path.Join(owner.Name, repo.Name), action.GetRepoPath(t.Context()))
2929
}
3030

3131
func TestAction_GetRepoLink(t *testing.T) {
@@ -37,9 +37,9 @@ func TestAction_GetRepoLink(t *testing.T) {
3737
defer test.MockVariableValue(&setting.AppURL, "https://try.gitea.io/suburl/")()
3838
defer test.MockVariableValue(&setting.AppSubURL, "/suburl")()
3939
expected := path.Join(setting.AppSubURL, owner.Name, repo.Name)
40-
assert.Equal(t, expected, action.GetRepoLink(db.DefaultContext))
41-
assert.Equal(t, repo.HTMLURL(), action.GetRepoAbsoluteLink(db.DefaultContext))
42-
assert.Equal(t, comment.HTMLURL(db.DefaultContext), action.GetCommentHTMLURL(db.DefaultContext))
40+
assert.Equal(t, expected, action.GetRepoLink(t.Context()))
41+
assert.Equal(t, repo.HTMLURL(), action.GetRepoAbsoluteLink(t.Context()))
42+
assert.Equal(t, comment.HTMLURL(t.Context()), action.GetCommentHTMLURL(t.Context()))
4343
}
4444

4545
func TestActivityReadable(t *testing.T) {
@@ -91,37 +91,37 @@ func TestConsistencyUpdateAction(t *testing.T) {
9191
unittest.AssertExistsAndLoadBean(t, &activities_model.Action{
9292
ID: int64(id),
9393
})
94-
_, err := db.GetEngine(db.DefaultContext).Exec(`UPDATE action SET created_unix = '' WHERE id = ?`, id)
94+
_, err := db.GetEngine(t.Context()).Exec(`UPDATE action SET created_unix = '' WHERE id = ?`, id)
9595
assert.NoError(t, err)
9696
actions := make([]*activities_model.Action, 0, 1)
9797
//
9898
// XORM returns an error when created_unix is a string
9999
//
100-
err = db.GetEngine(db.DefaultContext).Where("id = ?", id).Find(&actions)
100+
err = db.GetEngine(t.Context()).Where("id = ?", id).Find(&actions)
101101
if assert.Error(t, err) {
102102
assert.Contains(t, err.Error(), "type string to a int64: invalid syntax")
103103
}
104104
//
105105
// Get rid of incorrectly set created_unix
106106
//
107-
count, err := activities_model.CountActionCreatedUnixString(db.DefaultContext)
107+
count, err := activities_model.CountActionCreatedUnixString(t.Context())
108108
assert.NoError(t, err)
109109
assert.EqualValues(t, 1, count)
110-
count, err = activities_model.FixActionCreatedUnixString(db.DefaultContext)
110+
count, err = activities_model.FixActionCreatedUnixString(t.Context())
111111
assert.NoError(t, err)
112112
assert.EqualValues(t, 1, count)
113113

114-
count, err = activities_model.CountActionCreatedUnixString(db.DefaultContext)
114+
count, err = activities_model.CountActionCreatedUnixString(t.Context())
115115
assert.NoError(t, err)
116116
assert.EqualValues(t, 0, count)
117-
count, err = activities_model.FixActionCreatedUnixString(db.DefaultContext)
117+
count, err = activities_model.FixActionCreatedUnixString(t.Context())
118118
assert.NoError(t, err)
119119
assert.EqualValues(t, 0, count)
120120

121121
//
122122
// XORM must be happy now
123123
//
124-
assert.NoError(t, db.GetEngine(db.DefaultContext).Where("id = ?", id).Find(&actions))
124+
assert.NoError(t, db.GetEngine(t.Context()).Where("id = ?", id).Find(&actions))
125125
unittest.CheckConsistencyFor(t, &activities_model.Action{})
126126
}
127127

@@ -133,19 +133,19 @@ func TestDeleteIssueActions(t *testing.T) {
133133
assert.NotEqual(t, issue.ID, issue.Index) // it needs to use different ID/Index to test the DeleteIssueActions to delete some actions by IssueIndex
134134

135135
// insert a comment
136-
err := db.Insert(db.DefaultContext, &issue_model.Comment{Type: issue_model.CommentTypeComment, IssueID: issue.ID})
136+
err := db.Insert(t.Context(), &issue_model.Comment{Type: issue_model.CommentTypeComment, IssueID: issue.ID})
137137
assert.NoError(t, err)
138138
comment := unittest.AssertExistsAndLoadBean(t, &issue_model.Comment{Type: issue_model.CommentTypeComment, IssueID: issue.ID})
139139

140140
// truncate action table and insert some actions
141-
err = db.TruncateBeans(db.DefaultContext, &activities_model.Action{})
141+
err = db.TruncateBeans(t.Context(), &activities_model.Action{})
142142
assert.NoError(t, err)
143-
err = db.Insert(db.DefaultContext, &activities_model.Action{
143+
err = db.Insert(t.Context(), &activities_model.Action{
144144
OpType: activities_model.ActionCommentIssue,
145145
CommentID: comment.ID,
146146
})
147147
assert.NoError(t, err)
148-
err = db.Insert(db.DefaultContext, &activities_model.Action{
148+
err = db.Insert(t.Context(), &activities_model.Action{
149149
OpType: activities_model.ActionCreateIssue,
150150
RepoID: issue.RepoID,
151151
Content: fmt.Sprintf("%d|content...", issue.Index),
@@ -154,6 +154,6 @@ func TestDeleteIssueActions(t *testing.T) {
154154

155155
// assert that the actions exist, then delete them
156156
unittest.AssertCount(t, &activities_model.Action{}, 2)
157-
assert.NoError(t, activities_model.DeleteIssueActions(db.DefaultContext, issue.RepoID, issue.ID, issue.Index))
157+
assert.NoError(t, activities_model.DeleteIssueActions(t.Context(), issue.RepoID, issue.ID, issue.Index))
158158
unittest.AssertCount(t, &activities_model.Action{}, 0)
159159
}

models/activities/notification_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestCreateOrUpdateIssueNotifications(t *testing.T) {
2020
assert.NoError(t, unittest.PrepareTestDatabase())
2121
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1})
2222

23-
assert.NoError(t, activities_model.CreateOrUpdateIssueNotifications(db.DefaultContext, issue.ID, 0, 2, 0))
23+
assert.NoError(t, activities_model.CreateOrUpdateIssueNotifications(t.Context(), issue.ID, 0, 2, 0))
2424

2525
// User 9 is inactive, thus notifications for user 1 and 4 are created
2626
notf := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{UserID: 1, IssueID: issue.ID})
@@ -34,7 +34,7 @@ func TestCreateOrUpdateIssueNotifications(t *testing.T) {
3434
func TestNotificationsForUser(t *testing.T) {
3535
assert.NoError(t, unittest.PrepareTestDatabase())
3636
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
37-
notfs, err := db.Find[activities_model.Notification](db.DefaultContext, activities_model.FindNotificationOptions{
37+
notfs, err := db.Find[activities_model.Notification](t.Context(), activities_model.FindNotificationOptions{
3838
UserID: user.ID,
3939
Status: []activities_model.NotificationStatus{
4040
activities_model.NotificationStatusRead,
@@ -55,7 +55,7 @@ func TestNotificationsForUser(t *testing.T) {
5555
func TestNotification_GetRepo(t *testing.T) {
5656
assert.NoError(t, unittest.PrepareTestDatabase())
5757
notf := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{RepoID: 1})
58-
repo, err := notf.GetRepo(db.DefaultContext)
58+
repo, err := notf.GetRepo(t.Context())
5959
assert.NoError(t, err)
6060
assert.Equal(t, repo, notf.Repository)
6161
assert.Equal(t, notf.RepoID, repo.ID)
@@ -64,7 +64,7 @@ func TestNotification_GetRepo(t *testing.T) {
6464
func TestNotification_GetIssue(t *testing.T) {
6565
assert.NoError(t, unittest.PrepareTestDatabase())
6666
notf := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{RepoID: 1})
67-
issue, err := notf.GetIssue(db.DefaultContext)
67+
issue, err := notf.GetIssue(t.Context())
6868
assert.NoError(t, err)
6969
assert.Equal(t, issue, notf.Issue)
7070
assert.Equal(t, notf.IssueID, issue.ID)
@@ -73,7 +73,7 @@ func TestNotification_GetIssue(t *testing.T) {
7373
func TestGetNotificationCount(t *testing.T) {
7474
assert.NoError(t, unittest.PrepareTestDatabase())
7575
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
76-
cnt, err := db.Count[activities_model.Notification](db.DefaultContext, activities_model.FindNotificationOptions{
76+
cnt, err := db.Count[activities_model.Notification](t.Context(), activities_model.FindNotificationOptions{
7777
UserID: user.ID,
7878
Status: []activities_model.NotificationStatus{
7979
activities_model.NotificationStatusRead,
@@ -82,7 +82,7 @@ func TestGetNotificationCount(t *testing.T) {
8282
assert.NoError(t, err)
8383
assert.EqualValues(t, 0, cnt)
8484

85-
cnt, err = db.Count[activities_model.Notification](db.DefaultContext, activities_model.FindNotificationOptions{
85+
cnt, err = db.Count[activities_model.Notification](t.Context(), activities_model.FindNotificationOptions{
8686
UserID: user.ID,
8787
Status: []activities_model.NotificationStatus{
8888
activities_model.NotificationStatusUnread,
@@ -97,14 +97,14 @@ func TestSetNotificationStatus(t *testing.T) {
9797
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
9898
notf := unittest.AssertExistsAndLoadBean(t,
9999
&activities_model.Notification{UserID: user.ID, Status: activities_model.NotificationStatusRead})
100-
_, err := activities_model.SetNotificationStatus(db.DefaultContext, notf.ID, user, activities_model.NotificationStatusPinned)
100+
_, err := activities_model.SetNotificationStatus(t.Context(), notf.ID, user, activities_model.NotificationStatusPinned)
101101
assert.NoError(t, err)
102102
unittest.AssertExistsAndLoadBean(t,
103103
&activities_model.Notification{ID: notf.ID, Status: activities_model.NotificationStatusPinned})
104104

105-
_, err = activities_model.SetNotificationStatus(db.DefaultContext, 1, user, activities_model.NotificationStatusRead)
105+
_, err = activities_model.SetNotificationStatus(t.Context(), 1, user, activities_model.NotificationStatusRead)
106106
assert.Error(t, err)
107-
_, err = activities_model.SetNotificationStatus(db.DefaultContext, unittest.NonexistentID, user, activities_model.NotificationStatusRead)
107+
_, err = activities_model.SetNotificationStatus(t.Context(), unittest.NonexistentID, user, activities_model.NotificationStatusRead)
108108
assert.Error(t, err)
109109
}
110110

@@ -117,7 +117,7 @@ func TestUpdateNotificationStatuses(t *testing.T) {
117117
&activities_model.Notification{UserID: user.ID, Status: activities_model.NotificationStatusRead})
118118
notfPinned := unittest.AssertExistsAndLoadBean(t,
119119
&activities_model.Notification{UserID: user.ID, Status: activities_model.NotificationStatusPinned})
120-
assert.NoError(t, activities_model.UpdateNotificationStatuses(db.DefaultContext, user, activities_model.NotificationStatusUnread, activities_model.NotificationStatusRead))
120+
assert.NoError(t, activities_model.UpdateNotificationStatuses(t.Context(), user, activities_model.NotificationStatusUnread, activities_model.NotificationStatusRead))
121121
unittest.AssertExistsAndLoadBean(t,
122122
&activities_model.Notification{ID: notfUnread.ID, Status: activities_model.NotificationStatusRead})
123123
unittest.AssertExistsAndLoadBean(t,
@@ -130,11 +130,11 @@ func TestSetIssueReadBy(t *testing.T) {
130130
assert.NoError(t, unittest.PrepareTestDatabase())
131131
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
132132
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1})
133-
assert.NoError(t, db.WithTx(db.DefaultContext, func(ctx context.Context) error {
133+
assert.NoError(t, db.WithTx(t.Context(), func(ctx context.Context) error {
134134
return activities_model.SetIssueReadBy(ctx, issue.ID, user.ID)
135135
}))
136136

137-
nt, err := activities_model.GetIssueNotification(db.DefaultContext, user.ID, issue.ID)
137+
nt, err := activities_model.GetIssueNotification(t.Context(), user.ID, issue.ID)
138138
assert.NoError(t, err)
139139
assert.Equal(t, activities_model.NotificationStatusRead, nt.Status)
140140
}

models/activities/user_heatmap_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"time"
99

1010
activities_model "code.gitea.io/gitea/models/activities"
11-
"code.gitea.io/gitea/models/db"
1211
"code.gitea.io/gitea/models/unittest"
1312
user_model "code.gitea.io/gitea/models/user"
1413
"code.gitea.io/gitea/modules/json"
@@ -70,7 +69,7 @@ func TestGetUserHeatmapDataByUser(t *testing.T) {
7069
}
7170

7271
// get the action for comparison
73-
actions, count, err := activities_model.GetFeeds(db.DefaultContext, activities_model.GetFeedsOptions{
72+
actions, count, err := activities_model.GetFeeds(t.Context(), activities_model.GetFeedsOptions{
7473
RequestedUser: user,
7574
Actor: doer,
7675
IncludePrivate: true,
@@ -80,7 +79,7 @@ func TestGetUserHeatmapDataByUser(t *testing.T) {
8079
assert.NoError(t, err)
8180

8281
// Get the heatmap and compare
83-
heatmap, err := activities_model.GetUserHeatmapDataByUser(db.DefaultContext, user, doer)
82+
heatmap, err := activities_model.GetUserHeatmapDataByUser(t.Context(), user, doer)
8483
var contributions int
8584
for _, hm := range heatmap {
8685
contributions += int(hm.Contributions)

models/asymkey/gpg_key_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Q0KHb+QcycSgbDx0ZAvdIacuKvBBcbxrsmFUI4LR+oIup0G9gUc0roPvr014jYQL
232232
=zHo9
233233
-----END PGP PUBLIC KEY BLOCK-----`
234234

235-
keys, err := AddGPGKey(db.DefaultContext, 1, testEmailWithUpperCaseLetters, "", "")
235+
keys, err := AddGPGKey(t.Context(), 1, testEmailWithUpperCaseLetters, "", "")
236236
assert.NoError(t, err)
237237
if assert.NotEmpty(t, keys) {
238238
key := keys[0]
@@ -407,12 +407,12 @@ func TestTryGetKeyIDFromSignature(t *testing.T) {
407407

408408
func TestParseGPGKey(t *testing.T) {
409409
assert.NoError(t, unittest.PrepareTestDatabase())
410-
assert.NoError(t, db.Insert(db.DefaultContext, &user_model.EmailAddress{UID: 1, Email: "[email protected]", IsActivated: true}))
410+
assert.NoError(t, db.Insert(t.Context(), &user_model.EmailAddress{UID: 1, Email: "[email protected]", IsActivated: true}))
411411

412412
// create a key for test email
413413
e, err := openpgp.NewEntity("name", "comment", "[email protected]", nil)
414414
require.NoError(t, err)
415-
k, err := parseGPGKey(db.DefaultContext, 1, e, true)
415+
k, err := parseGPGKey(t.Context(), 1, e, true)
416416
require.NoError(t, err)
417417
assert.NotEmpty(t, k.KeyID)
418418
assert.NotEmpty(t, k.Emails) // the key is valid, matches the email
@@ -421,7 +421,7 @@ func TestParseGPGKey(t *testing.T) {
421421
for _, id := range e.Identities {
422422
id.Revocations = append(id.Revocations, &packet.Signature{RevocationReason: util.ToPointer(packet.KeyCompromised)})
423423
}
424-
k, err = parseGPGKey(db.DefaultContext, 1, e, true)
424+
k, err = parseGPGKey(t.Context(), 1, e, true)
425425
require.NoError(t, err)
426426
assert.NotEmpty(t, k.KeyID)
427427
assert.Empty(t, k.Emails) // the key is revoked, matches no email

0 commit comments

Comments
 (0)