mirror of
https://github.com/mattermost/mattermost.git
synced 2026-04-25 16:20:12 -04:00
It was a good decision in hindsight to keep the public module as 0.x because this would have been a breaking change again. https://mattermost.atlassian.net/browse/MM-53032 ```release-note Changed the Go module path from github.com/mattermost/mattermost-server/server/v8 to github.com/mattermost/mattermost/server/v8. For the public facing module, it's path is also changed from github.com/mattermost/mattermost-server/server/public to github.com/mattermost/mattermost/server/public ```
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package commands
|
|
|
|
import (
|
|
"github.com/mattermost/mattermost/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)
|
|
})
|
|
}
|