diff --git a/services/track-changes/test/acceptance/coffee/ArchivingUpdatesTests.coffee b/services/track-changes/test/acceptance/coffee/ArchivingUpdatesTests.coffee index 25397cfa61..282aaec2f5 100644 --- a/services/track-changes/test/acceptance/coffee/ArchivingUpdatesTests.coffee +++ b/services/track-changes/test/acceptance/coffee/ArchivingUpdatesTests.coffee @@ -20,6 +20,9 @@ describe "Archiving updates", -> message = new Error("s3 keys not setup, this test setup will fail") return done(message) + TrackChangesClient.waitForS3 done + + before (done) -> @now = Date.now() @to = @now @user_id = ObjectId().toString() diff --git a/services/track-changes/test/acceptance/coffee/helpers/TrackChangesClient.coffee b/services/track-changes/test/acceptance/coffee/helpers/TrackChangesClient.coffee index 9f17939656..1ae07426b2 100644 --- a/services/track-changes/test/acceptance/coffee/helpers/TrackChangesClient.coffee +++ b/services/track-changes/test/acceptance/coffee/helpers/TrackChangesClient.coffee @@ -100,6 +100,21 @@ module.exports = TrackChangesClient = response.statusCode.should.equal 204 callback(error) + waitForS3: (done, retries=42) -> + if !Settings.trackchanges.s3.endpoint + return done() + + request.get "#{Settings.trackchanges.s3.endpoint}/", (err, res) -> + if res && res.statusCode < 500 + return done() + + if retries == 0 + return done(err or new Error("s3 returned #{res.statusCode}")) + + setTimeout () -> + TrackChangesClient.waitForS3(done, --retries) + , 1000 + getS3Doc: (project_id, doc_id, pack_id, callback = (error, body) ->) -> params = Bucket: S3_BUCKET