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

Function TestUpdateEnvironment

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

Source from the content-addressed store, hash-verified

132}
133
134func TestUpdateEnvironment(t *testing.T) {
135 flags := newUpdateCommand(nil).Flags()
136 flags.Set("env-add", "toadd=newenv")
137 flags.Set("env-rm", "toremove")
138
139 envs := []string{"toremove=theenvtoremove", "tokeep=value"}
140
141 updateEnvironment(flags, &envs)
142 assert.Assert(t, is.Len(envs, 2))
143 // Order has been removed in updateEnvironment (map)
144 sort.Strings(envs)
145 assert.Check(t, is.Equal("toadd=newenv", envs[0]))
146 assert.Check(t, is.Equal("tokeep=value", envs[1]))
147}
148
149func TestUpdateEnvironmentWithDuplicateValues(t *testing.T) {
150 flags := newUpdateCommand(nil).Flags()

Callers

nothing calls this directly

Calls 4

newUpdateCommandFunction · 0.70
updateEnvironmentFunction · 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…