[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 удалений

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

@@ -8,7 +8,6 @@ import (
"time"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/request"
"github.com/mattermost/mattermost/server/v8/channels/api4"
"github.com/mattermost/mattermost/server/v8/channels/utils/testutils"
"github.com/spf13/cobra"
@@ -52,7 +51,6 @@ func configForLdap(th *api4.TestHelper) {
func (s *MmctlE2ETestSuite) TestLdapSyncCmd() {
s.SetupEnterpriseTestHelper().InitBasic()
configForLdap(s.th)
ctx := request.EmptyContext(s.th.App.Log())
s.Run("MM-T3971 Should not allow regular user to sync LDAP groups", func() {
printer.Clean()
@@ -66,7 +64,7 @@ func (s *MmctlE2ETestSuite) TestLdapSyncCmd() {
s.RunForSystemAdminAndLocal("MM-T2529 Should sync LDAP groups", func(c client.Client) {
printer.Clean()
jobs, appErr := s.th.App.GetJobsByTypePage(ctx, model.JobTypeLdapSync, 0, 100)
jobs, appErr := s.th.App.GetJobsByTypePage(s.th.Context, model.JobTypeLdapSync, 0, 100)
s.Require().Nil(appErr)
initialNumJobs := len(jobs)
@@ -80,7 +78,7 @@ func (s *MmctlE2ETestSuite) TestLdapSyncCmd() {
// we need to wait a bit for job creation
time.Sleep(time.Second)
jobs, appErr = s.th.App.GetJobsByTypePage(ctx, model.JobTypeLdapSync, 0, 100)
jobs, appErr = s.th.App.GetJobsByTypePage(s.th.Context, model.JobTypeLdapSync, 0, 100)
s.Require().Nil(appErr)
s.Require().NotEmpty(jobs)
s.Assert().Equal(initialNumJobs+1, len(jobs))
@@ -117,7 +115,7 @@ func (s *MmctlE2ETestSuite) TestLdapIDMigrateCmd() {
err := ldapIDMigrateCmdF(c, &cobra.Command{}, []string{"cn"})
s.Require().NoError(err)
defer func() {
s.Require().Nil(s.th.App.MigrateIdLDAP("uid"))
s.Require().Nil(s.th.App.MigrateIdLDAP(s.th.Context, "uid"))
}()
s.Require().NotEmpty(printer.GetLines())