Remove incorrect "db.DefaultContext" usages (#35366)

This commit is contained in:
wxiaoguang
2025-08-28 11:52:43 +08:00
committed by GitHub
parent 7aef7ea2d4
commit 0cbaa0b662
256 changed files with 1951 additions and 2098 deletions

View File

@@ -69,7 +69,7 @@ func TestMirrorPull(t *testing.T) {
IncludeTags: true,
RepoID: mirrorRepo.ID,
}
initCount, err := db.Count[repo_model.Release](db.DefaultContext, findOptions)
initCount, err := db.Count[repo_model.Release](t.Context(), findOptions)
assert.NoError(t, err)
assert.Zero(t, initCount) // no sync yet, so even though there is a tag in source repo, the mirror's release table is still empty
@@ -96,18 +96,18 @@ func TestMirrorPull(t *testing.T) {
// actually there is a tag in the source repo, so after "sync", that tag will also come into the mirror
initCount++
count, err := db.Count[repo_model.Release](db.DefaultContext, findOptions)
count, err := db.Count[repo_model.Release](t.Context(), findOptions)
assert.NoError(t, err)
assert.Equal(t, initCount+1, count)
release, err := repo_model.GetRelease(db.DefaultContext, repo.ID, "v0.2")
release, err := repo_model.GetRelease(t.Context(), repo.ID, "v0.2")
assert.NoError(t, err)
assert.NoError(t, release_service.DeleteReleaseByID(ctx, repo, release, user, true))
ok = mirror_service.SyncPullMirror(ctx, mirrorRepo.ID)
assert.True(t, ok)
count, err = db.Count[repo_model.Release](db.DefaultContext, findOptions)
count, err = db.Count[repo_model.Release](t.Context(), findOptions)
assert.NoError(t, err)
assert.Equal(t, initCount, count)
}