[MM-56348] system/ping: add new method with options (#26079)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0aaa047ea3
Коммит
7d8a56019b
@@ -119,6 +119,7 @@ type Client interface {
|
||||
MigrateAuthToSaml(ctx context.Context, fromAuthService string, usersMap map[string]string, auto bool) (*model.Response, error)
|
||||
GetPing(ctx context.Context) (string, *model.Response, error)
|
||||
GetPingWithFullServerStatus(ctx context.Context) (map[string]string, *model.Response, error)
|
||||
GetPingWithOptions(ctx context.Context, options model.SystemPingOptions) (map[string]string, *model.Response, error)
|
||||
CreateUpload(ctx context.Context, us *model.UploadSession) (*model.UploadSession, *model.Response, error)
|
||||
GetUpload(ctx context.Context, uploadID string) (*model.UploadSession, *model.Response, error)
|
||||
GetUploadsForUser(ctx context.Context, userID string) ([]*model.UploadSession, *model.Response, error)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1054,6 +1054,22 @@ func (mr *MockClientMockRecorder) GetPingWithFullServerStatus(arg0 interface{})
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPingWithFullServerStatus", reflect.TypeOf((*MockClient)(nil).GetPingWithFullServerStatus), arg0)
|
||||
}
|
||||
|
||||
// GetPingWithOptions mocks base method.
|
||||
func (m *MockClient) GetPingWithOptions(arg0 context.Context, arg1 model.SystemPingOptions) (map[string]string, *model.Response, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPingWithOptions", arg0, arg1)
|
||||
ret0, _ := ret[0].(map[string]string)
|
||||
ret1, _ := ret[1].(*model.Response)
|
||||
ret2, _ := ret[2].(error)
|
||||
return ret0, ret1, ret2
|
||||
}
|
||||
|
||||
// GetPingWithOptions indicates an expected call of GetPingWithOptions.
|
||||
func (mr *MockClientMockRecorder) GetPingWithOptions(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPingWithOptions", reflect.TypeOf((*MockClient)(nil).GetPingWithOptions), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetPlugins mocks base method.
|
||||
func (m *MockClient) GetPlugins(arg0 context.Context) (*model.PluginsResponse, *model.Response, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
Ссылка в новой задаче
Block a user