MCPcopy Index your code
hub / github.com/docker/cli / TestUpdateContainerLabels

Function TestUpdateContainerLabels

cli/command/service/update_test.go:65–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestUpdateContainerLabels(t *testing.T) {
66 flags := newUpdateCommand(nil).Flags()
67 flags.Set("container-label-add", "add-beats-remove=value")
68 flags.Set("container-label-add", "to-add=value")
69 flags.Set("container-label-add", "to-update=new-value")
70 flags.Set("container-label-add", "to-replace=new-value")
71 flags.Set("container-label-rm", "add-beats-remove")
72 flags.Set("container-label-rm", "to-remove")
73 flags.Set("container-label-rm", "to-replace")
74 flags.Set("container-label-rm", "no-such-label")
75
76 labels := map[string]string{
77 "to-keep": "value",
78 "to-remove": "value",
79 "to-replace": "value",
80 "to-update": "value",
81 }
82
83 updateContainerLabels(flags, &labels)
84 assert.DeepEqual(t, labels, map[string]string{
85 "add-beats-remove": "value",
86 "to-add": "value",
87 "to-keep": "value",
88 "to-replace": "new-value",
89 "to-update": "new-value",
90 })
91}
92
93func TestUpdatePlacementConstraints(t *testing.T) {
94 flags := newUpdateCommand(nil).Flags()

Callers

nothing calls this directly

Calls 3

updateContainerLabelsFunction · 0.85
newUpdateCommandFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…