MCPcopy
hub / github.com/moby/moby / pruneNetworkAndVerify

Function pruneNetworkAndVerify

integration-cli/docker_cli_prune_unix_test.go:33–52  ·  view source on GitHub ↗
(t *testing.T, d *daemon.Daemon, kept, pruned []string)

Source from the content-addressed store, hash-verified

31}
32
33func pruneNetworkAndVerify(t *testing.T, d *daemon.Daemon, kept, pruned []string) {
34 _, err := d.Cmd("network", "prune", "--force")
35 assert.NilError(t, err)
36
37 for _, s := range kept {
38 poll.WaitOn(t, pollCheck(t, func(*testing.T) (any, string) {
39 out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
40 assert.NilError(t, err)
41 return out, ""
42 }, checker.Contains(s)), poll.WithTimeout(defaultReconciliationTimeout))
43 }
44
45 for _, s := range pruned {
46 poll.WaitOn(t, pollCheck(t, func(*testing.T) (any, string) {
47 out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
48 assert.NilError(t, err)
49 return out, ""
50 }, checker.Not(checker.Contains(s))), poll.WithTimeout(defaultReconciliationTimeout))
51 }
52}
53
54func (s *DockerSwarmSuite) TestPruneNetwork(c *testing.T) {
55 ctx := testutil.GetContext(c)

Callers 1

TestPruneNetworkMethod · 0.85

Calls 5

ContainsFunction · 0.92
NotFunction · 0.92
pollCheckFunction · 0.85
WithTimeoutMethod · 0.80
CmdMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…