Skip to content

Commit

Permalink
resolve nsqio#846: nsqd: expose memory stats under /stats
Browse files Browse the repository at this point in the history
  • Loading branch information
sparklxb committed Mar 31, 2017
1 parent 670c149 commit 5a88882
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nsqd/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"testing"
"time"

"strings"

"github.com/nsqio/go-nsq"
"github.com/nsqio/nsq/internal/test"
"github.com/nsqio/nsq/internal/version"
Expand Down Expand Up @@ -478,15 +480,15 @@ func TestHTTPgetStatusJSON(t *testing.T) {
defer nsqd.Exit()

nsqd.startTime = testTime
expectedJSON := fmt.Sprintf(`{"version":"%v","health":"OK","start_time":%v,"topics":[]}`, version.Binary, testTime.Unix())
expectedJSON := fmt.Sprintf(`{"version":"%v","health":"OK","start_time":%v,"topics":[],"memory":{`, version.Binary, testTime.Unix())

url := fmt.Sprintf("http://%s/stats?format=json", httpAddr)
resp, err := http.Get(url)
test.Nil(t, err)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
test.Equal(t, 200, resp.StatusCode)
test.Equal(t, expectedJSON, string(body))
test.Equal(t, true, strings.HasPrefix(string(body), expectedJSON))
}

func TestHTTPgetStatusText(t *testing.T) {
Expand Down

0 comments on commit 5a88882

Please sign in to comment.