Handle error returned by GetClusterInfos() (#30919)
A recent change to the enterprise cluster code introduced a change to the enterprise API interface. GetClusterInfos() can now return an error. This commit introduces code to handle that error.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
dfe6478fd7
Коммит
4b64eb0e39
@@ -21,7 +21,7 @@ type ClusterInterface interface {
|
||||
// and zero means "totally healthy".
|
||||
HealthScore() int
|
||||
GetMyClusterInfo() *model.ClusterInfo
|
||||
GetClusterInfos() []*model.ClusterInfo
|
||||
GetClusterInfos() ([]*model.ClusterInfo, error)
|
||||
SendClusterMessage(msg *model.ClusterMessage)
|
||||
SendClusterMessageToNode(nodeID string, msg *model.ClusterMessage) error
|
||||
NotifyMsg(buf []byte)
|
||||
|
||||
@@ -87,7 +87,7 @@ func (_m *ClusterInterface) GetClusterId() string {
|
||||
}
|
||||
|
||||
// GetClusterInfos provides a mock function with given fields:
|
||||
func (_m *ClusterInterface) GetClusterInfos() []*model.ClusterInfo {
|
||||
func (_m *ClusterInterface) GetClusterInfos() ([]*model.ClusterInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
@@ -95,6 +95,10 @@ func (_m *ClusterInterface) GetClusterInfos() []*model.ClusterInfo {
|
||||
}
|
||||
|
||||
var r0 []*model.ClusterInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() ([]*model.ClusterInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() []*model.ClusterInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
@@ -103,7 +107,13 @@ func (_m *ClusterInterface) GetClusterInfos() []*model.ClusterInfo {
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetClusterStats provides a mock function with given fields: rctx
|
||||
|
||||
Ссылка в новой задаче
Block a user