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

Function TestAddGenericResources

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

Source from the content-addressed store, hash-verified

807}
808
809func TestAddGenericResources(t *testing.T) {
810 task := &swarm.TaskSpec{}
811 flags := newUpdateCommand(nil).Flags()
812
813 assert.Check(t, addGenericResources(flags, task))
814
815 flags.Set(flagGenericResourcesAdd, "foo=1")
816 assert.Check(t, addGenericResources(flags, task))
817 assert.Check(t, is.Len(task.Resources.Reservations.GenericResources, 1))
818
819 // Checks that foo isn't added a 2nd time
820 flags = newUpdateCommand(nil).Flags()
821 flags.Set(flagGenericResourcesAdd, "bar=1")
822 assert.Check(t, addGenericResources(flags, task))
823 assert.Check(t, is.Len(task.Resources.Reservations.GenericResources, 2))
824}
825
826func TestRemoveGenericResources(t *testing.T) {
827 task := &swarm.TaskSpec{}

Callers

nothing calls this directly

Calls 4

addGenericResourcesFunction · 0.85
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…