From 77e5d3f4bb12117b7abbcf0861bd4d2bdec191b4 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 19 Jan 2016 16:45:58 +0100 Subject: [PATCH] Retry checking for app start state in test --- src/routes/test/apps-test.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/routes/test/apps-test.js b/src/routes/test/apps-test.js index 2e31fdc28..11e7529a0 100644 --- a/src/routes/test/apps-test.js +++ b/src/routes/test/apps-test.js @@ -941,14 +941,17 @@ describe('App installation', function () { }); it('did start the app', function (done) { - setTimeout(function () { + var count = 0; + function checkStartState() { superagent.get('http://localhost:' + appEntry.httpPort + appResult.manifest.healthCheckPath) .end(function (err, res) { - expect(!err).to.be.ok(); - expect(res.statusCode).to.equal(200); - done(); + if (res && res.statusCode === 200) return done(); + if (++count > 50) return done(new Error('Timedout')); + setTimeout(checkStartState, 500); }); - }, 2000); // give some time for docker to settle + } + + checkStartState(); }); it('can uninstall app', function (done) {