From dc8d08c030fcb3a6436e9ca5bc7575b0fde4d181 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 17 Jul 2017 11:13:21 +0100 Subject: [PATCH] Update acceptance tests to reflect retry logic --- services/document-updater/Gruntfile.coffee | 2 +- .../test/acceptance/coffee/FlushingDocsTests.coffee | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/services/document-updater/Gruntfile.coffee b/services/document-updater/Gruntfile.coffee index 2e0e12dd66..698ee9c733 100644 --- a/services/document-updater/Gruntfile.coffee +++ b/services/document-updater/Gruntfile.coffee @@ -57,7 +57,7 @@ module.exports = (grunt) -> options: reporter: grunt.option('reporter') or 'spec' grep: grunt.option("grep") - timeout: 10000 + timeout: 50000 shell: fullAcceptanceTests: diff --git a/services/document-updater/test/acceptance/coffee/FlushingDocsTests.coffee b/services/document-updater/test/acceptance/coffee/FlushingDocsTests.coffee index f732d69bb6..4c9c893e44 100644 --- a/services/document-updater/test/acceptance/coffee/FlushingDocsTests.coffee +++ b/services/document-updater/test/acceptance/coffee/FlushingDocsTests.coffee @@ -55,25 +55,26 @@ describe "Flushing a doc to Mongo", -> it "should not flush the doc to the web api", -> MockWebApi.setDocument.called.should.equal false - describe "when the web api http request takes a long time", -> + describe "when the web api http request takes a long time on first request", -> before (done) -> [@project_id, @doc_id] = [DocUpdaterClient.randomId(), DocUpdaterClient.randomId()] - @timeout = 10000 MockWebApi.insertDoc @project_id, @doc_id, { lines: @lines version: @version } + t = 30000 sinon.stub MockWebApi, "setDocument", (project_id, doc_id, lines, version, ranges, callback = (error) ->) -> - setTimeout callback, 30000 + setTimeout callback, t + t = 0 DocUpdaterClient.preloadDoc @project_id, @doc_id, done after -> MockWebApi.setDocument.restore() - it "should return quickly(ish)", (done) -> + it "should still work", (done) -> start = Date.now() DocUpdaterClient.flushDoc @project_id, @doc_id, (error, res, doc) => - res.statusCode.should.equal 500 + res.statusCode.should.equal 204 delta = Date.now() - start expect(delta).to.be.below 20000 - done() \ No newline at end of file + done()