mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[misc] migrate acceptance tests to the native mongo driver, drop mongojs
This commit is contained in:
parent
f80a92ce46
commit
1d57706d44
5 changed files with 115 additions and 621 deletions
|
@ -1,27 +0,0 @@
|
||||||
// TODO: This file was created by bulk-decaffeinate.
|
|
||||||
// Sanity-check the conversion and remove this comment.
|
|
||||||
/*
|
|
||||||
* decaffeinate suggestions:
|
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
|
||||||
* DS207: Consider shorter variations of null checks
|
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
||||||
*/
|
|
||||||
const Settings = require('settings-sharelatex')
|
|
||||||
const mongojs = require('mongojs')
|
|
||||||
const db = mongojs(Settings.mongo.url, ['docSnapshots'])
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
db,
|
|
||||||
ObjectId: mongojs.ObjectId,
|
|
||||||
healthCheck(callback) {
|
|
||||||
return db.runCommand({ ping: 1 }, function (err, res) {
|
|
||||||
if (err != null) {
|
|
||||||
return callback(err)
|
|
||||||
}
|
|
||||||
if (!res.ok) {
|
|
||||||
return callback(new Error('failed mongo ping'))
|
|
||||||
}
|
|
||||||
return callback()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
685
services/document-updater/package-lock.json
generated
685
services/document-updater/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,6 @@
|
||||||
"logger-sharelatex": "^2.2.0",
|
"logger-sharelatex": "^2.2.0",
|
||||||
"metrics-sharelatex": "^2.6.2",
|
"metrics-sharelatex": "^2.6.2",
|
||||||
"mongodb": "^3.6.0",
|
"mongodb": "^3.6.0",
|
||||||
"mongojs": "^3.1.0",
|
|
||||||
"redis-sharelatex": "^1.0.13",
|
"redis-sharelatex": "^1.0.13",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"requestretry": "^4.1.0",
|
"requestretry": "^4.1.0",
|
||||||
|
|
|
@ -17,7 +17,7 @@ chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const async = require('async')
|
const async = require('async')
|
||||||
|
|
||||||
const { db, ObjectId } = require('../../../app/js/mongojs')
|
const { db, ObjectId } = require('../../../app/js/mongodb')
|
||||||
const MockWebApi = require('./helpers/MockWebApi')
|
const MockWebApi = require('./helpers/MockWebApi')
|
||||||
const DocUpdaterClient = require('./helpers/DocUpdaterClient')
|
const DocUpdaterClient = require('./helpers/DocUpdaterClient')
|
||||||
const DocUpdaterApp = require('./helpers/DocUpdaterApp')
|
const DocUpdaterApp = require('./helpers/DocUpdaterApp')
|
||||||
|
@ -668,12 +668,12 @@ describe('Ranges', function () {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
return done(error)
|
return done(error)
|
||||||
}
|
}
|
||||||
return db.docSnapshots.find(
|
db.docSnapshots
|
||||||
{
|
.find({
|
||||||
project_id: ObjectId(this.project_id),
|
project_id: ObjectId(this.project_id),
|
||||||
doc_id: ObjectId(this.doc_id)
|
doc_id: ObjectId(this.doc_id)
|
||||||
},
|
})
|
||||||
(error, docSnapshots) => {
|
.toArray((error, docSnapshots) => {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
return done(error)
|
return done(error)
|
||||||
}
|
}
|
||||||
|
@ -686,8 +686,7 @@ describe('Ranges', function () {
|
||||||
tid: this.tid
|
tid: this.tid
|
||||||
})
|
})
|
||||||
return done()
|
return done()
|
||||||
}
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||||
*/
|
*/
|
||||||
const app = require('../../../../app')
|
const app = require('../../../../app')
|
||||||
|
const { waitForDb } = require('../../../../app/js/mongodb')
|
||||||
require('logger-sharelatex').logger.level('fatal')
|
require('logger-sharelatex').logger.level('fatal')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -26,9 +27,10 @@ module.exports = {
|
||||||
return callback()
|
return callback()
|
||||||
} else if (this.initing) {
|
} else if (this.initing) {
|
||||||
return this.callbacks.push(callback)
|
return this.callbacks.push(callback)
|
||||||
} else {
|
}
|
||||||
this.initing = true
|
this.initing = true
|
||||||
this.callbacks.push(callback)
|
this.callbacks.push(callback)
|
||||||
|
waitForDb().then(() => {
|
||||||
return app.listen(3003, 'localhost', (error) => {
|
return app.listen(3003, 'localhost', (error) => {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
throw error
|
throw error
|
||||||
|
@ -42,6 +44,6 @@ module.exports = {
|
||||||
return result
|
return result
|
||||||
})()
|
})()
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue