You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/11/14 10:44:17 UTC

(shardingsphere-on-cloud) branch main updated: fix: fix checkstatus post req and resp body (#454)

This is an automated email from the ASF dual-hosted git repository.

zhonghongsheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git


The following commit(s) were added to refs/heads/main by this push:
     new 8fcdf3c  fix: fix checkstatus post req and resp body (#454)
8fcdf3c is described below

commit 8fcdf3c9c6e60e964ae52a44755d1e06033146f6
Author: liyao <ma...@126.com>
AuthorDate: Tue Nov 14 18:44:10 2023 +0800

    fix: fix checkstatus post req and resp body (#454)
    
    * fix: fix typo DBBackModeFull
    
    * fix: fix checkstatus post req and resp body
    
    * chore: update backup test
---
 pitr/cli/internal/cmd/backup.go       |  2 +-
 pitr/cli/internal/cmd/backup_test.go  |  1 +
 pitr/cli/internal/pkg/agent-server.go | 10 +++++++++-
 pitr/cli/internal/pkg/model/const.go  |  2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/pitr/cli/internal/cmd/backup.go b/pitr/cli/internal/cmd/backup.go
index 066f065..3f2a7a7 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 2ddab5c..4bced1f 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 137c08f..5ba5d1f 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 f5165b2..41c77d6 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"
 )