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

Function TestUpdatePlacementPrefs

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

Source from the content-addressed store, hash-verified

106}
107
108func TestUpdatePlacementPrefs(t *testing.T) {
109 flags := newUpdateCommand(nil).Flags()
110 flags.Set("placement-pref-add", "spread=node.labels.dc")
111 flags.Set("placement-pref-rm", "spread=node.labels.rack")
112
113 placement := &swarm.Placement{
114 Preferences: []swarm.PlacementPreference{
115 {
116 Spread: &swarm.SpreadOver{
117 SpreadDescriptor: "node.labels.rack",
118 },
119 },
120 {
121 Spread: &swarm.SpreadOver{
122 SpreadDescriptor: "node.labels.row",
123 },
124 },
125 },
126 }
127
128 updatePlacementPreferences(flags, placement)
129 assert.Assert(t, is.Len(placement.Preferences, 2))
130 assert.Check(t, is.Equal("node.labels.row", placement.Preferences[0].Spread.SpreadDescriptor))
131 assert.Check(t, is.Equal("node.labels.dc", placement.Preferences[1].Spread.SpreadDescriptor))
132}
133
134func TestUpdateEnvironment(t *testing.T) {
135 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…