mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
Retry service updates on out of sequence errors
Code retrying service update operations when receiving "update out of sequence" errors was removed because of a misunderstanding, which has made tests flaky. This re-adds the "CmdRetryOutOfSequence" method, and uses it in TestSwarmPublishAdd to avoid flaky behavior. Signed-off-by: Drew Erny <drew.erny@docker.com>
This commit is contained in:
@ -277,19 +277,23 @@ func (s *DockerSwarmSuite) TestSwarmPublishAdd(c *check.C) {
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "top"
|
||||
// this first command does not have to be retried because service creates
|
||||
// don't return out of sequence errors.
|
||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "--label", "x=y", "busybox", "top")
|
||||
assert.NilError(c, err, out)
|
||||
assert.Assert(c, strings.TrimSpace(out) != "")
|
||||
|
||||
out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
|
||||
out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "--publish-add", "80:80", name)
|
||||
assert.NilError(c, err, out)
|
||||
|
||||
out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
|
||||
out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "--publish-add", "80:80", name)
|
||||
assert.NilError(c, err, out)
|
||||
|
||||
_, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
|
||||
_, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
|
||||
assert.ErrorContains(c, err, "")
|
||||
|
||||
// this last command does not have to be retried because service inspect
|
||||
// does not return out of sequence errors.
|
||||
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.EndpointSpec.Ports }}", name)
|
||||
assert.NilError(c, err, out)
|
||||
assert.Equal(c, strings.TrimSpace(out), "[{ tcp 80 80 ingress}]")
|
||||
|
Reference in New Issue
Block a user