summaryrefslogtreecommitdiff
path: root/internal/test
diff options
context:
space:
mode:
authorTonis Tiigi <tonistiigi@gmail.com>2019-07-15 17:23:55 -0700
committerTonis Tiigi <tonistiigi@gmail.com>2019-07-17 11:52:58 -0700
commit3df1095bbdc331d4effa5452d8aafd5aaead5789 (patch)
treef377d047c8abdd32039a1dc98e1dab5fe0e757cc /internal/test
parent42a054473bc650755e0db66eb5d17895946e20f6 (diff)
downloaddocker-3df1095bbdc331d4effa5452d8aafd5aaead5789.tar.gz
integration-cli: allow temporary errors on leader switch
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Diffstat (limited to 'internal/test')
-rw-r--r--internal/test/daemon/node.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/test/daemon/node.go b/internal/test/daemon/node.go
index 33dd365429..d5f6f15263 100644
--- a/internal/test/daemon/node.go
+++ b/internal/test/daemon/node.go
@@ -15,7 +15,7 @@ import (
type NodeConstructor func(*swarm.Node)
// GetNode returns a swarm node identified by the specified id
-func (d *Daemon) GetNode(t assert.TestingT, id string) *swarm.Node {
+func (d *Daemon) GetNode(t assert.TestingT, id string, errCheck ...func(error) bool) *swarm.Node {
if ht, ok := t.(test.HelperT); ok {
ht.Helper()
}
@@ -23,6 +23,13 @@ func (d *Daemon) GetNode(t assert.TestingT, id string) *swarm.Node {
defer cli.Close()
node, _, err := cli.NodeInspectWithRaw(context.Background(), id)
+ if err != nil {
+ for _, f := range errCheck {
+ if f(err) {
+ return nil
+ }
+ }
+ }
assert.NilError(t, err, "[%s] (*Daemon).GetNode: NodeInspectWithRaw(%q) failed", d.id, id)
assert.Check(t, node.ID == id)
return &node