[MM-54434] Use job.Logger to capture ldap logs (#24493)

Этот коммит содержится в:
Ben Schumacher
2023-10-06 22:43:21 +02:00
коммит произвёл GitHub
родитель afaf41b587
Коммит aad25be4e1
50 изменённых файлов: 385 добавлений и 426 удалений

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

@@ -10,7 +10,6 @@ import (
"path/filepath"
"time"
"github.com/mattermost/mattermost/server/public/shared/request"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/client"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/printer"
@@ -276,9 +275,8 @@ func (s *MmctlE2ETestSuite) TestExportDownloadCmdF() {
func (s *MmctlE2ETestSuite) TestExportJobShowCmdF() {
s.SetupTestHelper().InitBasic()
ctx := request.EmptyContext(s.th.App.Log())
job, appErr := s.th.App.CreateJob(ctx, &model.Job{
job, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
@@ -289,7 +287,7 @@ func (s *MmctlE2ETestSuite) TestExportJobShowCmdF() {
s.Run("MM-T3885 - no permissions", func() {
printer.Clean()
job1, appErr := s.th.App.CreateJob(ctx, &model.Job{
job1, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
@@ -322,7 +320,6 @@ func (s *MmctlE2ETestSuite) TestExportJobShowCmdF() {
func (s *MmctlE2ETestSuite) TestExportJobListCmdF() {
s.SetupTestHelper().InitBasic()
ctx := request.EmptyContext(s.th.App.Log())
s.Run("MM-T3887 - no permissions", func() {
printer.Clean()
@@ -362,14 +359,14 @@ func (s *MmctlE2ETestSuite) TestExportJobListCmdF() {
cmd.Flags().Int("per-page", perPage, "")
cmd.Flags().Bool("all", false, "")
_, appErr := s.th.App.CreateJob(ctx, &model.Job{
_, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
time.Sleep(time.Millisecond)
job2, appErr := s.th.App.CreateJob(ctx, &model.Job{
job2, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
@@ -377,7 +374,7 @@ func (s *MmctlE2ETestSuite) TestExportJobListCmdF() {
time.Sleep(time.Millisecond)
job3, appErr := s.th.App.CreateJob(ctx, &model.Job{
job3, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
@@ -394,14 +391,13 @@ func (s *MmctlE2ETestSuite) TestExportJobListCmdF() {
func (s *MmctlE2ETestSuite) TestExportJobCancelCmdF() {
s.SetupTestHelper().InitBasic()
ctx := request.EmptyContext(s.th.App.Log())
s.Run("Cancel an export job without permissions", func() {
printer.Clean()
cmd := &cobra.Command{}
job, appErr := s.th.App.CreateJob(ctx, &model.Job{
job, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
@@ -430,14 +426,14 @@ func (s *MmctlE2ETestSuite) TestExportJobCancelCmdF() {
cmd := &cobra.Command{}
job1, appErr := s.th.App.CreateJob(ctx, &model.Job{
job1, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
time.Sleep(time.Millisecond)
job2, appErr := s.th.App.CreateJob(ctx, &model.Job{
job2, appErr := s.th.App.CreateJob(s.th.Context, &model.Job{
Type: model.JobTypeExportProcess,
})
s.Require().Nil(appErr)
@@ -448,11 +444,11 @@ func (s *MmctlE2ETestSuite) TestExportJobCancelCmdF() {
s.Require().Empty(printer.GetErrorLines())
// Get job1 again to refresh its status
job1, appErr = s.th.App.GetJob(ctx, job1.Id)
job1, appErr = s.th.App.GetJob(s.th.Context, job1.Id)
s.Require().Nil(appErr)
// Get job2 again to ensure its status did not change
job2, _ = s.th.App.GetJob(ctx, job2.Id)
job2, _ = s.th.App.GetJob(s.th.Context, job2.Id)
s.Require().Nil(appErr)
s.Require().Equal(job1.Status, model.JobStatusCanceled)