Includes mmctl into the mono-repo (#23091)
* Includes mmctl into the mono-repo * Update to use the new public module paths * Adds docs check to the mmctl CI * Fix public utils import path * Tidy up modules * Fix linter * Update CI tasks to use the new file structure * Update CI references
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
412109b02e
Коммит
951456c780
44
server/cmd/mmctl/commands/logs_e2e_test.go
Обычный файл
44
server/cmd/mmctl/commands/logs_e2e_test.go
Обычный файл
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/mattermost/mattermost-server/server/v8/cmd/mmctl/client"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func (s *MmctlE2ETestSuite) TestlogsCmdF() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
s.RunForSystemAdminAndLocal("Display single log line", func(c client.Client) {
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().Int("number", 1, "")
|
||||
|
||||
data, err := testLogsCmdF(c, cmd, []string{})
|
||||
s.Require().Nil(err)
|
||||
s.Require().Len(data, 2)
|
||||
})
|
||||
|
||||
s.RunForSystemAdminAndLocal("Display in logrus for formatting", func(c client.Client) {
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().Bool("logrus", true, "")
|
||||
cmd.Flags().Int("number", 1, "")
|
||||
|
||||
data, err := testLogsCmdF(c, cmd, []string{})
|
||||
s.Require().Nil(err)
|
||||
s.Require().Len(data, 2)
|
||||
s.Contains(data[1], "time=")
|
||||
s.Contains(data[1], "level=")
|
||||
s.Contains(data[1], "msg=")
|
||||
})
|
||||
|
||||
s.Run("Should not allow normal user to retrieve logs", func() {
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().Int("number", 1, "")
|
||||
|
||||
_, err := testLogsCmdF(s.th.Client, cmd, []string{})
|
||||
s.Require().Error(err)
|
||||
})
|
||||
}
|
||||
Ссылка в новой задаче
Block a user