mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client/node: Wrap options and output
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -159,13 +159,13 @@ func JobComplete(ctx context.Context, apiClient client.ServiceAPIClient, service
|
||||
|
||||
func HasLeader(ctx context.Context, apiClient client.NodeAPIClient) func(log poll.LogT) poll.Result {
|
||||
return func(log poll.LogT) poll.Result {
|
||||
nodes, err := apiClient.NodeList(ctx, client.NodeListOptions{
|
||||
result, err := apiClient.NodeList(ctx, client.NodeListOptions{
|
||||
Filters: make(client.Filters).Add("role", "manager"),
|
||||
})
|
||||
if err != nil {
|
||||
return poll.Error(err)
|
||||
}
|
||||
for _, node := range nodes {
|
||||
for _, node := range result.Items {
|
||||
if node.ManagerStatus != nil && node.ManagerStatus.Leader {
|
||||
return poll.Success()
|
||||
}
|
||||
|
||||
@@ -165,11 +165,11 @@ func TestInspectNetwork(t *testing.T) {
|
||||
t.Run("BeforeLeaderChange", checkNetworkInspect)
|
||||
|
||||
leaderID := func() string {
|
||||
ls, err := c1.NodeList(ctx, client.NodeListOptions{
|
||||
result, err := c1.NodeList(ctx, client.NodeListOptions{
|
||||
Filters: make(client.Filters).Add("role", "manager"),
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
for _, node := range ls {
|
||||
for _, node := range result.Items {
|
||||
if node.ManagerStatus != nil && node.ManagerStatus.Leader {
|
||||
return node.ID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user