mirror of https://github.com/docker/cli.git
Merge pull request #2927 from jimlinntu/fix_update_rollback_order
fix --update-order and --rollback-order flags
This commit is contained in:
commit
a49d70ca7f
|
@ -165,7 +165,7 @@ func updateConfigFromDefaults(defaultUpdateConfig *api.UpdateConfig) *swarm.Upda
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opts updateOptions) updateConfig(flags *pflag.FlagSet) *swarm.UpdateConfig {
|
func (opts updateOptions) updateConfig(flags *pflag.FlagSet) *swarm.UpdateConfig {
|
||||||
if !anyChanged(flags, flagUpdateParallelism, flagUpdateDelay, flagUpdateMonitor, flagUpdateFailureAction, flagUpdateMaxFailureRatio) {
|
if !anyChanged(flags, flagUpdateParallelism, flagUpdateDelay, flagUpdateMonitor, flagUpdateFailureAction, flagUpdateMaxFailureRatio, flagUpdateOrder) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ func (opts updateOptions) updateConfig(flags *pflag.FlagSet) *swarm.UpdateConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opts updateOptions) rollbackConfig(flags *pflag.FlagSet) *swarm.UpdateConfig {
|
func (opts updateOptions) rollbackConfig(flags *pflag.FlagSet) *swarm.UpdateConfig {
|
||||||
if !anyChanged(flags, flagRollbackParallelism, flagRollbackDelay, flagRollbackMonitor, flagRollbackFailureAction, flagRollbackMaxFailureRatio) {
|
if !anyChanged(flags, flagRollbackParallelism, flagRollbackDelay, flagRollbackMonitor, flagRollbackFailureAction, flagRollbackMaxFailureRatio, flagRollbackOrder) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,22 @@ func TestToServiceUpdateRollback(t *testing.T) {
|
||||||
assert.Check(t, is.DeepEqual(service.RollbackConfig, expected.RollbackConfig))
|
assert.Check(t, is.DeepEqual(service.RollbackConfig, expected.RollbackConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestToServiceUpdateRollbackOrder(t *testing.T) {
|
||||||
|
flags := newCreateCommand(nil).Flags()
|
||||||
|
flags.Set("update-order", "start-first")
|
||||||
|
flags.Set("rollback-order", "start-first")
|
||||||
|
|
||||||
|
o := newServiceOptions()
|
||||||
|
o.mode = "replicated"
|
||||||
|
o.update = updateOptions{order: "start-first"}
|
||||||
|
o.rollback = updateOptions{order: "start-first"}
|
||||||
|
|
||||||
|
service, err := o.ToService(context.Background(), &fakeClient{}, flags)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Check(t, is.Equal(service.UpdateConfig.Order, o.update.order))
|
||||||
|
assert.Check(t, is.Equal(service.RollbackConfig.Order, o.rollback.order))
|
||||||
|
}
|
||||||
|
|
||||||
func TestToServiceMaxReplicasGlobalModeConflict(t *testing.T) {
|
func TestToServiceMaxReplicasGlobalModeConflict(t *testing.T) {
|
||||||
opt := serviceOptions{
|
opt := serviceOptions{
|
||||||
mode: "global",
|
mode: "global",
|
||||||
|
|
Loading…
Reference in New Issue