mirror of https://github.com/docker/cli.git
Support the "order" key in "update_config" for compose
Signed-off-by: Antonis Kalipetis <akalipetis@gmail.com>
This commit is contained in:
parent
286216dbc3
commit
2950667f07
|
@ -454,6 +454,7 @@ func convertUpdateConfig(source *composetypes.UpdateConfig) *swarm.UpdateConfig
|
||||||
FailureAction: source.FailureAction,
|
FailureAction: source.FailureAction,
|
||||||
Monitor: source.Monitor,
|
Monitor: source.Monitor,
|
||||||
MaxFailureRatio: source.MaxFailureRatio,
|
MaxFailureRatio: source.MaxFailureRatio,
|
||||||
|
Order: source.Order,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,3 +343,21 @@ func TestConvertCredentialSpec(t *testing.T) {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
assert.Nil(t, swarmSpec)
|
assert.Nil(t, swarmSpec)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConvertUpdateConfigOrder(t *testing.T) {
|
||||||
|
// test default behavior
|
||||||
|
updateConfig := convertUpdateConfig(&composetypes.UpdateConfig{})
|
||||||
|
assert.Equal(t, "", updateConfig.Order)
|
||||||
|
|
||||||
|
// test start-first
|
||||||
|
updateConfig = convertUpdateConfig(&composetypes.UpdateConfig{
|
||||||
|
Order: "start-first",
|
||||||
|
})
|
||||||
|
assert.Equal(t, updateConfig.Order, "start-first")
|
||||||
|
|
||||||
|
// test stop-first
|
||||||
|
updateConfig = convertUpdateConfig(&composetypes.UpdateConfig{
|
||||||
|
Order: "stop-first",
|
||||||
|
})
|
||||||
|
assert.Equal(t, updateConfig.Order, "stop-first")
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ services:
|
||||||
failure_action: continue
|
failure_action: continue
|
||||||
monitor: 60s
|
monitor: 60s
|
||||||
max_failure_ratio: 0.3
|
max_failure_ratio: 0.3
|
||||||
|
order: start-first
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '0.001'
|
cpus: '0.001'
|
||||||
|
|
|
@ -687,6 +687,7 @@ func TestFullExample(t *testing.T) {
|
||||||
FailureAction: "continue",
|
FailureAction: "continue",
|
||||||
Monitor: time.Duration(60 * time.Second),
|
Monitor: time.Duration(60 * time.Second),
|
||||||
MaxFailureRatio: 0.3,
|
MaxFailureRatio: 0.3,
|
||||||
|
Order: "start-first",
|
||||||
},
|
},
|
||||||
Resources: types.Resources{
|
Resources: types.Resources{
|
||||||
Limits: &types.Resource{
|
Limits: &types.Resource{
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -339,7 +339,10 @@
|
||||||
"delay": {"type": "string", "format": "duration"},
|
"delay": {"type": "string", "format": "duration"},
|
||||||
"failure_action": {"type": "string"},
|
"failure_action": {"type": "string"},
|
||||||
"monitor": {"type": "string", "format": "duration"},
|
"monitor": {"type": "string", "format": "duration"},
|
||||||
"max_failure_ratio": {"type": "number"}
|
"max_failure_ratio": {"type": "number"},
|
||||||
|
"order": {"type": "string", "enum": [
|
||||||
|
"start-first", "stop-first"
|
||||||
|
]}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
|
|
|
@ -187,6 +187,7 @@ type UpdateConfig struct {
|
||||||
FailureAction string `mapstructure:"failure_action"`
|
FailureAction string `mapstructure:"failure_action"`
|
||||||
Monitor time.Duration
|
Monitor time.Duration
|
||||||
MaxFailureRatio float32 `mapstructure:"max_failure_ratio"`
|
MaxFailureRatio float32 `mapstructure:"max_failure_ratio"`
|
||||||
|
Order string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resources the resource limits and reservations
|
// Resources the resource limits and reservations
|
||||||
|
|
Loading…
Reference in New Issue