[MM-56348] system/ping: add new method with options (#26079)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2024-02-20 14:22:28 +01:00
коммит произвёл GitHub
родитель 0aaa047ea3
Коммит 7d8a56019b
9 изменённых файлов: 83 добавлений и 25 удалений

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

@@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/client"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/printer"
)
@@ -150,7 +151,10 @@ func systemVersionCmdF(c client.Client, cmd *cobra.Command, _ []string) error {
func systemStatusCmdF(c client.Client, cmd *cobra.Command, _ []string) error {
printer.SetSingle(true)
status, _, err := c.GetPingWithFullServerStatus(context.TODO())
status, _, err := c.GetPingWithOptions(context.TODO(), model.SystemPingOptions{
FullStatus: true,
RESTSemantics: true,
})
if err != nil {
return fmt.Errorf("unable to fetch server status: %w", err)
}

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

@@ -188,7 +188,10 @@ func (s *MmctlUnitTestSuite) TestServerStatusCmd() {
expectedStatus := map[string]string{"status": "OK"}
s.client.
EXPECT().
GetPingWithFullServerStatus(context.Background()).
GetPingWithOptions(context.Background(), model.SystemPingOptions{
FullStatus: true,
RESTSemantics: true,
}).
Return(expectedStatus, &model.Response{}, nil).
Times(1)
@@ -204,7 +207,10 @@ func (s *MmctlUnitTestSuite) TestServerStatusCmd() {
s.client.
EXPECT().
GetPingWithFullServerStatus(context.Background()).
GetPingWithOptions(context.Background(), model.SystemPingOptions{
FullStatus: true,
RESTSemantics: true,
}).
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)