Skip to content

Commit

Permalink
api: make api/version and release version consistent (tikv#2191)
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch committed Mar 5, 2020
1 parent 8956c7f commit 429fb88
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 @@ -26,6 +26,7 @@ type statusHandler struct {

type status struct {
BuildTS string `json:"build_ts"`
Version string `json:"version"`
GitHash string `json:"git_hash"`
}

Expand All @@ -39,6 +40,7 @@ func (h *statusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
version := status{
BuildTS: server.PDBuildTS,
GitHash: server.PDGitHash,
Version: server.PDReleaseVersion,
}

h.rd.JSON(w, http.StatusOK, version)
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 @@ -38,6 +38,7 @@ func checkStatusResponse(c *C, body []byte, cfgs []*server.Config) {

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 429fb88

Please sign in to comment.