Add uptime to ServiceStatus (#3690)

This commit is contained in:
Krishnan Parthasarathi
2017-02-08 13:43:02 +05:30
committed by Harshavardhana
parent 7547f3c8a3
commit ce9aa2f2b2
7 changed files with 139 additions and 10 deletions

View File

@@ -25,6 +25,7 @@ import (
"net/http/httptest"
"net/url"
"testing"
"time"
router "github.com/gorilla/mux"
)
@@ -55,6 +56,9 @@ func prepareAdminXLTestBed() (*adminXLTestBed, error) {
return nil, xlErr
}
// Initialize boot time
globalBootTime = time.Now().UTC()
// Set globalEndpoints for a single node XL setup.
for _, xlDir := range xlDirs {
globalEndpoints = append(globalEndpoints, &url.URL{
@@ -225,14 +229,13 @@ func testServicesCmdHandler(cmd cmdType, t *testing.T) {
if cmd == statusCmd {
expectedInfo := ServerStatus{
StorageInfo: newObjectLayerFn().StorageInfo(),
ServerVersion: ServerVersion{Version: Version, CommitID: CommitID},
}
receivedInfo := ServerStatus{}
if jsonErr := json.Unmarshal(rec.Body.Bytes(), &receivedInfo); jsonErr != nil {
t.Errorf("Failed to unmarshal StorageInfo - %v", jsonErr)
}
if expectedInfo != receivedInfo {
if expectedInfo.ServerVersion != receivedInfo.ServerVersion {
t.Errorf("Expected storage info and received storage info differ, %v %v", expectedInfo, receivedInfo)
}
}