MCPcopy Create free account
hub / github.com/docker/cli / TestUpdateLabels

Function TestUpdateLabels

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

Source from the content-addressed store, hash-verified

35}
36
37func TestUpdateLabels(t *testing.T) {
38 flags := newUpdateCommand(nil).Flags()
39 flags.Set("label-add", "add-beats-remove=value")
40 flags.Set("label-add", "to-add=value")
41 flags.Set("label-add", "to-update=new-value")
42 flags.Set("label-add", "to-replace=new-value")
43 flags.Set("label-rm", "add-beats-remove")
44 flags.Set("label-rm", "to-remove")
45 flags.Set("label-rm", "to-replace")
46 flags.Set("label-rm", "no-such-label")
47
48 labels := map[string]string{
49 "to-keep": "value",
50 "to-remove": "value",
51 "to-replace": "value",
52 "to-update": "value",
53 }
54
55 updateLabels(flags, &labels)
56 assert.DeepEqual(t, labels, map[string]string{
57 "add-beats-remove": "value",
58 "to-add": "value",
59 "to-keep": "value",
60 "to-replace": "new-value",
61 "to-update": "new-value",
62 })
63}
64
65func TestUpdateContainerLabels(t *testing.T) {
66 flags := newUpdateCommand(nil).Flags()

Callers

nothing calls this directly

Calls 3

updateLabelsFunction · 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…