mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: rename NodeUpdateOptions.Node to NodeUpdateOptions.Spec
Align with the other swarm-types, which use `Spec` for updates. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
// NodeUpdateOptions holds parameters to update nodes with.
|
||||
type NodeUpdateOptions struct {
|
||||
Version swarm.Version
|
||||
Node swarm.NodeSpec
|
||||
Spec swarm.NodeSpec
|
||||
}
|
||||
|
||||
type NodeUpdateResult struct{}
|
||||
@@ -24,7 +24,7 @@ func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUp
|
||||
|
||||
query := url.Values{}
|
||||
query.Set("version", options.Version.String())
|
||||
resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, options.Node, nil)
|
||||
resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, options.Spec, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
return NodeUpdateResult{}, err
|
||||
}
|
||||
|
||||
@@ -17,20 +17,20 @@ func TestNodeUpdateError(t *testing.T) {
|
||||
|
||||
_, err = client.NodeUpdate(context.Background(), "node_id", NodeUpdateOptions{
|
||||
Version: swarm.Version{},
|
||||
Node: swarm.NodeSpec{},
|
||||
Spec: swarm.NodeSpec{},
|
||||
})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
|
||||
_, err = client.NodeUpdate(context.Background(), "", NodeUpdateOptions{
|
||||
Version: swarm.Version{},
|
||||
Node: swarm.NodeSpec{},
|
||||
Spec: swarm.NodeSpec{},
|
||||
})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
|
||||
_, err = client.NodeUpdate(context.Background(), " ", NodeUpdateOptions{
|
||||
Version: swarm.Version{},
|
||||
Node: swarm.NodeSpec{},
|
||||
Spec: swarm.NodeSpec{},
|
||||
})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
@@ -49,7 +49,7 @@ func TestNodeUpdate(t *testing.T) {
|
||||
|
||||
_, err = client.NodeUpdate(context.Background(), "node_id", NodeUpdateOptions{
|
||||
Version: swarm.Version{},
|
||||
Node: swarm.NodeSpec{},
|
||||
Spec: swarm.NodeSpec{},
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func (d *Daemon) UpdateNode(ctx context.Context, t testing.TB, id string, f ...N
|
||||
|
||||
_, err := cli.NodeUpdate(ctx, node.ID, client.NodeUpdateOptions{
|
||||
Version: node.Version,
|
||||
Node: node.Spec,
|
||||
Spec: node.Spec,
|
||||
})
|
||||
if i < 10 && err != nil && strings.Contains(err.Error(), "update out of sequence") {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
4
vendor/github.com/moby/moby/client/node_update.go
generated
vendored
4
vendor/github.com/moby/moby/client/node_update.go
generated
vendored
@@ -10,7 +10,7 @@ import (
|
||||
// NodeUpdateOptions holds parameters to update nodes with.
|
||||
type NodeUpdateOptions struct {
|
||||
Version swarm.Version
|
||||
Node swarm.NodeSpec
|
||||
Spec swarm.NodeSpec
|
||||
}
|
||||
|
||||
type NodeUpdateResult struct{}
|
||||
@@ -24,7 +24,7 @@ func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUp
|
||||
|
||||
query := url.Values{}
|
||||
query.Set("version", options.Version.String())
|
||||
resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, options.Node, nil)
|
||||
resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, options.Spec, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
return NodeUpdateResult{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user