Merge pull request #360 from akalipetis/compose-update-order
Add support for update order in compose deployments
This commit is contained in:
@ -455,6 +455,7 @@ func convertUpdateConfig(source *composetypes.UpdateConfig) *swarm.UpdateConfig
|
||||
FailureAction: source.FailureAction,
|
||||
Monitor: source.Monitor,
|
||||
MaxFailureRatio: source.MaxFailureRatio,
|
||||
Order: source.Order,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -343,3 +343,21 @@ func TestConvertCredentialSpec(t *testing.T) {
|
||||
assert.Error(t, err)
|
||||
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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user