Merge pull request #2132 from overleaf/spd-collabratec-tests

Make collabratec tests not depend on previous run state

GitOrigin-RevId: 264f946e05b848fa253b6fbdd8e97a4998e4158e
This commit is contained in:
Hugh O'Brien 2019-09-10 10:52:41 +01:00 committed by sharelatex
parent 4defd2b6b5
commit a319073a08
3 changed files with 28 additions and 5 deletions

View file

@ -20,6 +20,9 @@ const RollingRateLimiter = require('rolling-rate-limiter')
module.exports = RateLimiter = {
addCount(opts, callback) {
if (settings.disableRateLimits) {
return callback(null, true)
}
if (callback == null) {
callback = function(err, shouldProcess) {}
}

View file

@ -411,10 +411,14 @@ class User {
}
if ((body != null ? body.project_id : undefined) == null) {
error = new Error(
'SOMETHING WENT WRONG CREATING PROJECT',
response.statusCode,
response.headers['location'],
body
JSON.stringify([
'SOMETHING WENT WRONG CREATING PROJECT',
name,
options,
response.statusCode,
response.headers['location'],
body
])
)
return callback(error)
} else {

View file

@ -1,7 +1,23 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
const BASE_URL = `http://${process.env['HTTP_TEST_HOST'] || 'localhost'}:3000`
module.exports = require('request').defaults({
const request = require('request').defaults({
baseUrl: BASE_URL,
followRedirect: false
})
module.exports = request
module.exports.promises = {
request: function(options) {
return new Promise((resolve, reject) => {
request(options, (err, response) => {
if (err) {
reject(err)
} else {
resolve(response)
}
})
})
}
}