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

Function TestRemoveGenericResources

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

Source from the content-addressed store, hash-verified

824}
825
826func TestRemoveGenericResources(t *testing.T) {
827 task := &swarm.TaskSpec{}
828 flags := newUpdateCommand(nil).Flags()
829
830 assert.Check(t, removeGenericResources(flags, task))
831
832 flags.Set(flagGenericResourcesRemove, "foo")
833 assert.Check(t, is.ErrorContains(removeGenericResources(flags, task), ""))
834
835 flags = newUpdateCommand(nil).Flags()
836 flags.Set(flagGenericResourcesAdd, "foo=1")
837 addGenericResources(flags, task)
838 flags = newUpdateCommand(nil).Flags()
839 flags.Set(flagGenericResourcesAdd, "bar=1")
840 addGenericResources(flags, task)
841
842 flags = newUpdateCommand(nil).Flags()
843 flags.Set(flagGenericResourcesRemove, "foo")
844 assert.Check(t, removeGenericResources(flags, task))
845 assert.Check(t, is.Len(task.Resources.Reservations.GenericResources, 1))
846}
847
848func TestUpdateNetworks(t *testing.T) {
849 ctx := context.Background()

Callers

nothing calls this directly

Calls 5

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