Skip to content

Commit c7d9599

Browse files
committed
Reverts the change to swarmkit that made all updates set UpdateStatus to Completed Signed-off-by: Drew Erny <drew.erny@docker.com>
1 parent 8d76028 commit c7d9599

File tree

3 files changed

+32
-39
lines changed

3 files changed

+32
-39
lines changed

integration/service/update_test.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,37 @@ func TestServiceUpdateLabel(t *testing.T) {
3333
service.Spec.Labels["foo"] = "bar"
3434
_, err := cli.ServiceUpdate(ctx, serviceID, service.Version, service.Spec, types.ServiceUpdateOptions{})
3535
assert.NilError(t, err)
36-
poll.WaitOn(t, serviceIsUpdated(cli, serviceID), swarm.ServicePoll)
36+
poll.WaitOn(t, serviceSpecIsUpdated(cli, serviceID, service.Version.Index), swarm.ServicePoll)
3737
service = getService(t, cli, serviceID)
3838
assert.Check(t, is.DeepEqual(service.Spec.Labels, map[string]string{"foo": "bar"}))
3939

4040
// add label to non-empty set
4141
service.Spec.Labels["foo2"] = "bar"
4242
_, err = cli.ServiceUpdate(ctx, serviceID, service.Version, service.Spec, types.ServiceUpdateOptions{})
4343
assert.NilError(t, err)
44-
poll.WaitOn(t, serviceIsUpdated(cli, serviceID), swarm.ServicePoll)
44+
poll.WaitOn(t, serviceSpecIsUpdated(cli, serviceID, service.Version.Index), swarm.ServicePoll)
4545
service = getService(t, cli, serviceID)
4646
assert.Check(t, is.DeepEqual(service.Spec.Labels, map[string]string{"foo": "bar", "foo2": "bar"}))
4747

4848
delete(service.Spec.Labels, "foo2")
4949
_, err = cli.ServiceUpdate(ctx, serviceID, service.Version, service.Spec, types.ServiceUpdateOptions{})
5050
assert.NilError(t, err)
51-
poll.WaitOn(t, serviceIsUpdated(cli, serviceID), swarm.ServicePoll)
51+
poll.WaitOn(t, serviceSpecIsUpdated(cli, serviceID, service.Version.Index), swarm.ServicePoll)
5252
service = getService(t, cli, serviceID)
5353
assert.Check(t, is.DeepEqual(service.Spec.Labels, map[string]string{"foo": "bar"}))
5454

5555
delete(service.Spec.Labels, "foo")
5656
_, err = cli.ServiceUpdate(ctx, serviceID, service.Version, service.Spec, types.ServiceUpdateOptions{})
5757
assert.NilError(t, err)
58-
poll.WaitOn(t, serviceIsUpdated(cli, serviceID), swarm.ServicePoll)
58+
poll.WaitOn(t, serviceSpecIsUpdated(cli, serviceID, service.Version.Index), swarm.ServicePoll)
5959
service = getService(t, cli, serviceID)
6060
assert.Check(t, is.DeepEqual(service.Spec.Labels, map[string]string{}))
6161

6262
// now make sure we can add again
6363
service.Spec.Labels["foo"] = "bar"
6464
_, err = cli.ServiceUpdate(ctx, serviceID, service.Version, service.Spec, types.ServiceUpdateOptions{})
6565
assert.NilError(t, err)
66-
poll.WaitOn(t, serviceIsUpdated(cli, serviceID), swarm.ServicePoll)
66+
poll.WaitOn(t, serviceSpecIsUpdated(cli, serviceID, service.Version.Index), swarm.ServicePoll)
6767
service = getService(t, cli, serviceID)
6868
assert.Check(t, is.DeepEqual(service.Spec.Labels, map[string]string{"foo": "bar"}))
6969

@@ -271,3 +271,17 @@ func serviceIsUpdated(client client.ServiceAPIClient, serviceID string) func(log
271271
}
272272
}
273273
}
274+
275+
func serviceSpecIsUpdated(client client.ServiceAPIClient, serviceID string, serviceOldVersion uint64) func(log poll.LogT) poll.Result {
276+
return func(log poll.LogT) poll.Result {
277+
service, _, err := client.ServiceInspectWithRaw(context.Background(), serviceID, types.ServiceInspectOptions{})
278+
switch {
279+
case err != nil:
280+
return poll.Error(err)
281+
case service.Version.Index > serviceOldVersion:
282+
return poll.Success()
283+
default:
284+
return poll.Continue("waiting for service %s to be updated", serviceID)
285+
}
286+
}
287+
}

vendor.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ github.com/containerd/ttrpc f02858b1457c5ca3aaec3a0803eb
130130
github.com/gogo/googleapis d31c731455cb061f42baff3bda55bad0118b126b # v1.2.0
131131

132132
# cluster
133-
github.com/docker/swarmkit 1e20cbf4caaeaba79c75af00bce5f41085db4082
133+
github.com/docker/swarmkit fb584e7b501ec4683b5c3e62476d76b8a7e7d9f6
134134
github.com/gogo/protobuf ba06b47c162d49f2af050fb4c75bcbc86a159d5c # v1.2.1
135135
github.com/cloudflare/cfssl 5d63dbd981b5c408effbb58c442d54761ff94fbd # 1.3.2
136136
github.com/fernet/fernet-go 9eac43b88a5efb8651d24de9b68e87567e029736

vendor/github.com/docker/swarmkit/manager/orchestrator/update/updater.go

Lines changed: 12 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)