Fix e2e test (and add a comment that it's not the best fix)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2017-12-05 11:55:24 +01:00 committed by Silvin Lubecki
parent f5073f81d2
commit 3a01d6a40a
1 changed files with 12 additions and 2 deletions

View File

@ -39,11 +39,21 @@ func deployFullStack(t *testing.T, stackname string) {
} }
func cleanupFullStack(t *testing.T, stackname string) { func cleanupFullStack(t *testing.T, stackname string) {
result := icmd.RunCmd(shell(t, "docker stack rm %s", stackname)) // FIXME(vdemeester) we shouldn't have to do that. it is hidding a race on docker stack rm
result.Assert(t, icmd.Success) poll.WaitOn(t, stackRm(stackname), pollSettings)
poll.WaitOn(t, taskCount(stackname, 0), 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 { func taskCount(stackname string, expected int) func(t poll.LogT) poll.Result {
return func(poll.LogT) poll.Result { return func(poll.LogT) poll.Result {
result := icmd.RunCommand( result := icmd.RunCommand(