mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
waitAndAssert -> poll.WaitOn
go get -d golang.org/x/tools/cmd/eg && \ dir=$(go env GOPATH)/src/golang.org/x/tools && \ git -C "$dir" fetch https://github.com/tiborvass/tools handle-variadic && \ git -C "$dir" checkout 61a94b82347c29b3289e83190aa3dda74d47abbb && \ go install golang.org/x/tools/cmd/eg eg -w -t template.waitAndAssert.go ./integration-cli 2>&1 \ | awk '{print $2}' | while read file; do # removing vendor/ in import paths # not sure why eg adds them sed -E -i 's#^([\t]+").*/vendor/([^"]+)#\1\2#g' "$file" sed -E -i 's#\.\(eg_compareFunc\)##g' "$file" goimports -w "$file" done Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
42599f1cad
commit
ac2f24e72a
12 changed files with 223 additions and 224 deletions
|
@ -17,6 +17,7 @@ import (
|
|||
"github.com/docker/docker/integration-cli/daemon"
|
||||
"gotest.tools/assert"
|
||||
"gotest.tools/icmd"
|
||||
"gotest.tools/poll"
|
||||
)
|
||||
|
||||
func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string) {
|
||||
|
@ -24,19 +25,21 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string
|
|||
assert.NilError(c, err)
|
||||
|
||||
for _, s := range kept {
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
||||
poll.WaitOn(c, pollCheck(c, func(*testing.T) (interface{}, string) {
|
||||
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
||||
assert.NilError(c, err)
|
||||
return out, ""
|
||||
}, checker.Contains, s)
|
||||
}, checker.Contains(s)), poll.WithTimeout(defaultReconciliationTimeout))
|
||||
|
||||
}
|
||||
|
||||
for _, s := range pruned {
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
||||
poll.WaitOn(c, pollCheck(c, func(*testing.T) (interface{}, string) {
|
||||
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
||||
assert.NilError(c, err)
|
||||
return out, ""
|
||||
}, checker.Not(checker.Contains(s)))
|
||||
}, checker.Not(checker.Contains(s))()), poll.WithTimeout(defaultReconciliationTimeout))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +67,7 @@ func (s *DockerSwarmSuite) TestPruneNetwork(c *testing.T) {
|
|||
"busybox", "top")
|
||||
assert.NilError(c, err)
|
||||
assert.Assert(c, strings.TrimSpace(out) != "")
|
||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, replicas+1)
|
||||
poll.WaitOn(c, pollCheck(c, d.CheckActiveContainerCount, checker.Equals(replicas+1)), poll.WithTimeout(defaultReconciliationTimeout))
|
||||
|
||||
// prune and verify
|
||||
pruneNetworkAndVerify(c, d, []string{"n1", "n3"}, []string{"n2", "n4"})
|
||||
|
@ -74,7 +77,7 @@ func (s *DockerSwarmSuite) TestPruneNetwork(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
_, err = d.Cmd("service", "rm", serviceName)
|
||||
assert.NilError(c, err)
|
||||
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 0)
|
||||
poll.WaitOn(c, pollCheck(c, d.CheckActiveContainerCount, checker.Equals(0)), poll.WithTimeout(defaultReconciliationTimeout))
|
||||
|
||||
pruneNetworkAndVerify(c, d, []string{}, []string{"n1", "n3"})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue