Browse Source

Merge pull request #2131 from xiang90/version

etcdhttp: add internalVersion
Xiang Li 11 years ago
parent
commit
f16ff64949
3 changed files with 4 additions and 3 deletions
  1. 1 1
      etcdserver/etcdhttp/client.go
  2. 1 1
      etcdserver/etcdhttp/client_test.go
  3. 2 1
      version/version.go

+ 1 - 1
etcdserver/etcdhttp/client.go

@@ -335,7 +335,7 @@ func serveVersion(w http.ResponseWriter, r *http.Request) {
 	if !allowMethod(w, r.Method, "GET") {
 	if !allowMethod(w, r.Method, "GET") {
 		return
 		return
 	}
 	}
-	w.Write([]byte("etcd " + version.Version))
+	fmt.Fprintf(w, `{"releaseVersion":"%s","internalVersion":"%s"}`, version.Version, version.InternalVersion)
 }
 }
 
 
 // parseKeyRequest converts a received http.Request on keysPrefix to
 // parseKeyRequest converts a received http.Request on keysPrefix to

+ 1 - 1
etcdserver/etcdhttp/client_test.go

@@ -1329,7 +1329,7 @@ func TestServeVersion(t *testing.T) {
 	if rw.Code != http.StatusOK {
 	if rw.Code != http.StatusOK {
 		t.Errorf("code=%d, want %d", rw.Code, http.StatusOK)
 		t.Errorf("code=%d, want %d", rw.Code, http.StatusOK)
 	}
 	}
-	w := fmt.Sprintf("etcd %s", version.Version)
+	w := fmt.Sprintf(`{"releaseVersion":"%s","internalVersion":"%s"}`, version.Version, version.InternalVersion)
 	if g := rw.Body.String(); g != w {
 	if g := rw.Body.String(); g != w {
 		t.Fatalf("body = %q, want %q", g, w)
 		t.Fatalf("body = %q, want %q", g, w)
 	}
 	}

+ 2 - 1
version/version.go

@@ -17,5 +17,6 @@
 package version
 package version
 
 
 var (
 var (
-	Version = "2.0.0-rc.1"
+	Version         = "2.0.0-rc.1"
+	InternalVersion = "2"
 )
 )