mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-16 23:24:47 +00:00
Update acceptance tests to reflect retry logic
This commit is contained in:
parent
0d46c3e2b3
commit
dc8d08c030
2 changed files with 8 additions and 7 deletions
|
@ -57,7 +57,7 @@ module.exports = (grunt) ->
|
|||
options:
|
||||
reporter: grunt.option('reporter') or 'spec'
|
||||
grep: grunt.option("grep")
|
||||
timeout: 10000
|
||||
timeout: 50000
|
||||
|
||||
shell:
|
||||
fullAcceptanceTests:
|
||||
|
|
|
@ -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()
|
||||
done()
|
||||
|
|
Loading…
Reference in a new issue