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

Function TestUpdatePlacementConstraints

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

Source from the content-addressed store, hash-verified

91}
92
93func TestUpdatePlacementConstraints(t *testing.T) {
94 flags := newUpdateCommand(nil).Flags()
95 flags.Set("constraint-add", "node=toadd")
96 flags.Set("constraint-rm", "node!=toremove")
97
98 placement := &swarm.Placement{
99 Constraints: []string{"node!=toremove", "container=tokeep"},
100 }
101
102 updatePlacementConstraints(flags, placement)
103 assert.Assert(t, is.Len(placement.Constraints, 2))
104 assert.Check(t, is.Equal("container=tokeep", placement.Constraints[0]))
105 assert.Check(t, is.Equal("node=toadd", placement.Constraints[1]))
106}
107
108func TestUpdatePlacementPrefs(t *testing.T) {
109 flags := newUpdateCommand(nil).Flags()

Callers

nothing calls this directly

Calls 4

newUpdateCommandFunction · 0.70
SetMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…