diff --git a/pitr/cli/internal/cmd/backup.go b/pitr/cli/internal/cmd/backup.go index 066f065d..3f2a7a71 100644 --- a/pitr/cli/internal/cmd/backup.go +++ b/pitr/cli/internal/cmd/backup.go @@ -56,7 +56,7 @@ var BackupCmd = &cobra.Command{ // convert BackupModeStr to BackupMode switch BackupModeStr { case "FULL", "full": - BackupMode = model.BDBackModeFull + BackupMode = model.DBBackModeFull case "PTRACK", "ptrack": BackupMode = model.DBBackModePTrack } diff --git a/pitr/cli/internal/cmd/backup_test.go b/pitr/cli/internal/cmd/backup_test.go index 2ddab5c5..4bced1fd 100644 --- a/pitr/cli/internal/cmd/backup_test.go +++ b/pitr/cli/internal/cmd/backup_test.go @@ -370,6 +370,7 @@ var _ = Describe("test backup mock", func() { BeforeEach(func() { mockCtrl = gomock.NewController(GinkgoT()) mockIreq = mock_httputils.NewMockIreq(mockCtrl) + mockIreq.EXPECT().Body(gomock.Any()).AnyTimes() monkey.Patch(httputils.NewRequest, func(ctx context.Context, method, url string) httputils.Ireq { return mockIreq diff --git a/pitr/cli/internal/pkg/agent-server.go b/pitr/cli/internal/pkg/agent-server.go index 137c08fd..5ba5d1f3 100644 --- a/pitr/cli/internal/pkg/agent-server.go +++ b/pitr/cli/internal/pkg/agent-server.go @@ -63,13 +63,21 @@ func NewAgentServer(addr string) IAgentServer { } } +type CommonOutResp struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data any `json:"data"` +} + // CheckStatus check agent server is alive func (as *agentServer) CheckStatus(in *model.HealthCheckIn) error { url := fmt.Sprintf("%s%s", as.addr, as._apiHealthCheck) + out := &CommonOutResp{} r := httputils.NewRequest(context.Background(), http.MethodPost, url) + r.Body(in) - if err := r.Send(in); err != nil { + if err := r.Send(out); err != nil { return xerr.NewUnknownErr(url, in, nil, err) } diff --git a/pitr/cli/internal/pkg/model/const.go b/pitr/cli/internal/pkg/model/const.go index f5165b29..41c77d69 100644 --- a/pitr/cli/internal/pkg/model/const.go +++ b/pitr/cli/internal/pkg/model/const.go @@ -28,6 +28,6 @@ const ( SsBackupStatusCheckError BackupStatus = "CheckError" SsBackupStatusCanceled BackupStatus = "Canceled" - BDBackModeFull DBBackupMode = "FULL" + DBBackModeFull DBBackupMode = "FULL" DBBackModePTrack DBBackupMode = "PTRACK" )