[MM-62888] mmctl: Add compliance export list cmd (#30914)

* Add compliance export list cmd and tests

- Introduced `ListComplianceExports` method in the Client interface to retrieve compliance export jobs.
- Added `compliance_export` command with subcommand `list` for listing compliance export jobs, including pagination options.
- Implemented end-to-end and unit tests for the compliance export listing functionality.

* Add docs for mmctl

* fix test typo

* added paging, tested

* update docs with better desc (how it's sorted)

* simplified, reusing job call

* add show cmd, unit tests, e2e tests

* update mmctl docs
Этот коммит содержится в:
Christopher Poile
2025-06-24 11:20:40 -04:00
коммит произвёл GitHub
родитель 5d7c3b52ed
Коммит 9399398e04
8 изменённых файлов: 593 добавлений и 4 удалений

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

@@ -4,14 +4,16 @@
package commands
import (
"github.com/golang/mock/gomock"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/v8/channels/api4"
"github.com/mattermost/mattermost/server/v8/channels/jobs"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/client"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/mocks"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/printer"
"github.com/golang/mock/gomock"
"github.com/mattermost/mattermost/server/v8/enterprise/message_export"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/mattermost/mattermost/server/v8/channels/api4"
)
var EnableEnterpriseTests string
@@ -67,6 +69,26 @@ func (s *MmctlE2ETestSuite) SetupEnterpriseTestHelper() *api4.TestHelper {
return s.th
}
func (s *MmctlE2ETestSuite) SetupMessageExportTestHelper() *api4.TestHelper {
if EnableEnterpriseTests != "true" {
s.T().SkipNow()
}
jobs.DefaultWatcherPollingInterval = 100
s.th = api4.SetupEnterprise(s.T()).InitBasic()
s.th.App.Srv().SetLicense(model.NewTestLicense("message_export"))
messageExportImpl := message_export.MessageExportJobInterfaceImpl{Server: s.th.App.Srv()}
s.th.App.Srv().Jobs.RegisterJobType(model.JobTypeMessageExport, messageExportImpl.MakeWorker(), messageExportImpl.MakeScheduler())
err := s.th.App.Srv().Jobs.StartWorkers()
require.NoError(s.T(), err)
err = s.th.App.Srv().Jobs.StartSchedulers()
require.NoError(s.T(), err)
return s.th
}
// RunForSystemAdminAndLocal runs a test function for both SystemAdmin
// and Local clients. Several commands work in the same way when used
// by a fully privileged user and through the local mode, so this