From 3a01d6a40aaa4bb1dec651bae5d475ce8e021941 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Tue, 5 Dec 2017 11:55:24 +0100 Subject: [PATCH] Fix e2e test (and add a comment that it's not the best fix) Signed-off-by: Vincent Demeester --- e2e/stack/remove_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/e2e/stack/remove_test.go b/e2e/stack/remove_test.go index 1e2d4798e1..e3f14061e5 100644 --- a/e2e/stack/remove_test.go +++ b/e2e/stack/remove_test.go @@ -39,11 +39,21 @@ func deployFullStack(t *testing.T, stackname string) { } func cleanupFullStack(t *testing.T, stackname string) { - result := icmd.RunCmd(shell(t, "docker stack rm %s", stackname)) - result.Assert(t, icmd.Success) + // FIXME(vdemeester) we shouldn't have to do that. it is hidding a race on docker stack rm + poll.WaitOn(t, stackRm(stackname), pollSettings) poll.WaitOn(t, taskCount(stackname, 0), pollSettings) } +func stackRm(stackname string) func(t poll.LogT) poll.Result { + return func(poll.LogT) poll.Result { + result := icmd.RunCommand("docker", "stack", "rm", stackname) + if result.Error != nil { + return poll.Continue("docker stack rm %s failed : %v", stackname, result.Error) + } + return poll.Success() + } +} + func taskCount(stackname string, expected int) func(t poll.LogT) poll.Result { return func(poll.LogT) poll.Result { result := icmd.RunCommand(