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

Function TestUpdateHostsRemoveHost

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

Source from the content-addressed store, hash-verified

436}
437
438func TestUpdateHostsRemoveHost(t *testing.T) {
439 flags := newUpdateCommand(nil).Flags()
440 flags.Set("host-rm", "host1")
441
442 hosts := []string{"127.0.0.2 host3 host1 host2 host4", "127.0.0.1 host1 host4", "127.0.0.3 host1"}
443
444 err := updateHosts(flags, &hosts)
445 assert.NilError(t, err)
446
447 // Removing host `host1` should remove the entry from each line it appears in.
448 // If there are no other hosts in the entry, the entry itself should be removed.
449 assert.Check(t, is.DeepEqual([]string{"127.0.0.2 host3 host2 host4", "127.0.0.1 host4"}, hosts))
450}
451
452func TestUpdateHostsRemoveHostIP(t *testing.T) {
453 flags := newUpdateCommand(nil).Flags()

Callers

nothing calls this directly

Calls 3

updateHostsFunction · 0.85
newUpdateCommandFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…