Skip to content

Commit

Permalink
api: make api/version and release version consistent (#2191) (#2192)
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
sre-bot authored Mar 5, 2020
1 parent 95e74f8 commit bf609e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions server/api/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type statusHandler struct {

type status struct {
BuildTS string `json:"build_ts"`
Version string `json:"version"`
GitHash string `json:"git_hash"`
StartTimestamp int64 `json:"start_timestamp"`
}
Expand All @@ -42,6 +43,7 @@ func (h *statusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
version := status{
BuildTS: server.PDBuildTS,
GitHash: server.PDGitHash,
Version: server.PDReleaseVersion,
StartTimestamp: h.svr.StartTimestamp(),
}

Expand Down
1 change: 1 addition & 0 deletions server/api/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func checkStatusResponse(c *C, body []byte) {
c.Assert(json.Unmarshal(body, &got), IsNil)
c.Assert(got.BuildTS, Equals, server.PDBuildTS)
c.Assert(got.GitHash, Equals, server.PDGitHash)
c.Assert(got.Version, Equals, server.PDReleaseVersion)
}

func (s *testStatusAPISuite) TestStatus(c *C) {
Expand Down
3 changes: 2 additions & 1 deletion server/api/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"net/http"

"github.com/pingcap/pd/v3/server"
"github.com/unrolled/render"
)

Expand All @@ -22,7 +23,7 @@ func newVersionHandler(rd *render.Render) *versionHandler {

func (h *versionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
version := &version{
Version: "1.0.0",
Version: server.PDReleaseVersion,
}
h.rd.JSON(w, http.StatusOK, version)
}

0 comments on commit bf609e4

Please sign in to comment.