Simplify request generation in store tests (#25422)

Этот коммит содержится в:
Ben Schumacher
2023-11-16 09:51:18 +01:00
коммит произвёл GitHub
родитель 51715d5ed6
Коммит afb48219c0
52 изменённых файлов: 1666 добавлений и 1752 удалений

Просмотреть файл

@@ -9,8 +9,6 @@ import (
"time"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/request"
"github.com/mattermost/mattermost/server/v8/channels/jobs"
"github.com/mattermost/mattermost/server/v8/channels/store"
"github.com/stretchr/testify/assert"
@@ -75,8 +73,7 @@ func TestBatchMigrationWorker(t *testing.T) {
)
th.Server.Jobs.RegisterJobType(migrationKey, worker, nil)
ctx := request.EmptyContext(mlog.CreateConsoleTestLogger(t))
job, appErr := th.Server.Jobs.CreateJob(ctx, migrationKey, nil)
job, appErr := th.Server.Jobs.CreateJob(th.Context, migrationKey, nil)
require.Nil(t, appErr)
done := make(chan bool)
@@ -112,8 +109,7 @@ func TestBatchMigrationWorker(t *testing.T) {
t.Helper()
require.Eventuallyf(t, func() bool {
ctx := request.EmptyContext(mlog.CreateConsoleTestLogger(t))
actualJob, appErr := th.Server.Jobs.GetJob(ctx, job.Id)
actualJob, appErr := th.Server.Jobs.GetJob(th.Context, job.Id)
require.Nil(t, appErr)
require.Equal(t, job.Id, actualJob.Id)
@@ -122,8 +118,7 @@ func TestBatchMigrationWorker(t *testing.T) {
}
assertJobReset := func(t *testing.T, th *TestHelper, job *model.Job) {
ctx := request.EmptyContext(mlog.CreateConsoleTestLogger(t))
actualJob, appErr := th.Server.Jobs.GetJob(ctx, job.Id)
actualJob, appErr := th.Server.Jobs.GetJob(th.Context, job.Id)
require.Nil(t, appErr)
assert.Empty(t, actualJob.Progress)
assert.Empty(t, actualJob.Data)