From bc7428b326a059a4358d94d42418e1e9cf1ae7b3 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 12 Nov 2024 11:18:46 +0800 Subject: [PATCH] address comments Signed-off-by: lhy1024 --- pkg/versioninfo/versioninfo.go | 2 +- server/api/status.go | 2 +- server/api/status_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/versioninfo/versioninfo.go b/pkg/versioninfo/versioninfo.go index af93338fddd..5fca7e1698b 100644 --- a/pkg/versioninfo/versioninfo.go +++ b/pkg/versioninfo/versioninfo.go @@ -31,7 +31,7 @@ type Status struct { Version string `json:"version"` GitHash string `json:"git_hash"` StartTimestamp int64 `json:"start_timestamp"` - Loaded bool `json:"loaded"` + RegionLoaded bool `json:"region_loaded"` } const ( diff --git a/server/api/status.go b/server/api/status.go index 6548ba0f161..5b9e877aa1a 100644 --- a/server/api/status.go +++ b/server/api/status.go @@ -45,7 +45,7 @@ func (h *statusHandler) GetPDStatus(w http.ResponseWriter, _ *http.Request) { GitHash: versioninfo.PDGitHash, Version: versioninfo.PDReleaseVersion, StartTimestamp: h.svr.StartTimestamp(), - Loaded: storage.AreRegionsLoaded(h.svr.GetStorage()), + RegionLoaded: storage.AreRegionsLoaded(h.svr.GetStorage()), } h.rd.JSON(w, http.StatusOK, version) diff --git a/server/api/status_test.go b/server/api/status_test.go index c3db51b71df..221bce6160b 100644 --- a/server/api/status_test.go +++ b/server/api/status_test.go @@ -52,7 +52,7 @@ func checkStatusResponse(re *require.Assertions, body []byte) { re.Equal(versioninfo.PDBuildTS, got.BuildTS) re.Equal(versioninfo.PDGitHash, got.GitHash) re.Equal(versioninfo.PDReleaseVersion, got.Version) - re.Equal(false, got.Loaded) + re.False(got.RegionLoaded) gotWithOldStatus := oldStatus{} re.NoError(json.Unmarshal(body, &gotWithOldStatus)) re.Equal(versioninfo.PDBuildTS, gotWithOldStatus.BuildTS)