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

Function TestUpdateMounts

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

Source from the content-addressed store, hash-verified

235}
236
237func TestUpdateMounts(t *testing.T) {
238 flags := newUpdateCommand(nil).Flags()
239 flags.Set("mount-add", "type=volume,source=vol2,target=/toadd")
240 flags.Set("mount-rm", "/toremove")
241
242 mounts := []mount.Mount{
243 {Target: "/toremove", Source: "vol1", Type: mount.TypeBind},
244 {Target: "/tokeep", Source: "vol3", Type: mount.TypeBind},
245 }
246
247 updateMounts(flags, &mounts)
248 assert.Assert(t, is.Len(mounts, 2))
249 assert.Check(t, is.Equal("/toadd", mounts[0].Target))
250 assert.Check(t, is.Equal("/tokeep", mounts[1].Target))
251}
252
253func TestUpdateMountsWithDuplicateMounts(t *testing.T) {
254 flags := newUpdateCommand(nil).Flags()

Callers

nothing calls this directly

Calls 4

updateMountsFunction · 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…