Decouple ServiceUpdate to ServerUpdate to be more native (#8138)

The change now is to ensure that we take custom URL as
well for updating the deployment, this is required for
hotfix deliveries for certain deployments - other than
the community release.

This commit changes the previous work d65a2c6725
with newer set of requirements.

Also deprecates PeerUptime()
This commit is contained in:
Harshavardhana
2019-08-28 15:04:43 -07:00
committed by GitHub
parent c6f86d35d3
commit 83d4c5763c
16 changed files with 319 additions and 317 deletions
+3 -25
View File
@@ -349,8 +349,7 @@ func initTestXLObjLayer() (ObjectLayer, []string, error) {
type cmdType int
const (
statusCmd cmdType = iota
restartCmd
restartCmd cmdType = iota
stopCmd
)
@@ -358,14 +357,12 @@ const (
// value to its corresponding serviceSignal value.
func (c cmdType) toServiceSignal() serviceSignal {
switch c {
case statusCmd:
return serviceStatus
case restartCmd:
return serviceRestart
case stopCmd:
return serviceStop
}
return serviceStatus
return serviceRestart
}
func (c cmdType) toServiceAction() madmin.ServiceAction {
@@ -374,10 +371,8 @@ func (c cmdType) toServiceAction() madmin.ServiceAction {
return madmin.ServiceActionRestart
case stopCmd:
return madmin.ServiceActionStop
case statusCmd:
return madmin.ServiceActionStatus
}
return madmin.ServiceActionStatus
return madmin.ServiceActionRestart
}
// testServiceSignalReceiver - Helper function that simulates a
@@ -449,28 +444,11 @@ func testServicesCmdHandler(cmd cmdType, t *testing.T) {
t.Errorf("Expected to receive %d status code but received %d. Body (%s)",
http.StatusOK, rec.Code, string(resp))
}
if cmd == statusCmd {
expectedInfo := madmin.ServiceStatus{
ServerVersion: madmin.ServerVersion{Version: Version, CommitID: CommitID},
}
receivedInfo := madmin.ServiceStatus{}
if jsonErr := json.Unmarshal(rec.Body.Bytes(), &receivedInfo); jsonErr != nil {
t.Errorf("Failed to unmarshal StorageInfo - %v", jsonErr)
}
if expectedInfo.ServerVersion != receivedInfo.ServerVersion {
t.Errorf("Expected storage info and received storage info differ, %v %v", expectedInfo, receivedInfo)
}
}
// Wait until testServiceSignalReceiver() called in a goroutine quits.
wg.Wait()
}
// Test for service status management REST API.
func TestServiceStatusHandler(t *testing.T) {
testServicesCmdHandler(statusCmd, t)
}
// Test for service restart management REST API.
func TestServiceRestartHandler(t *testing.T) {
testServicesCmdHandler(restartCmd, t)