mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-17 09:01:53 +00:00
Wrap smoke test in domain to catch errors
This commit is contained in:
parent
c28e09076b
commit
d4af0fe36d
1 changed files with 11 additions and 8 deletions
|
@ -3,23 +3,26 @@ Base = require("mocha/lib/reporters/base")
|
|||
redis = require("redis-sharelatex")
|
||||
settings = require("settings-sharelatex")
|
||||
redisCheck = redis.activeHealthCheckRedis(settings.redis.web)
|
||||
logger = require "logger-sharelatex"
|
||||
domain = require "domain"
|
||||
|
||||
module.exports = HealthCheckController =
|
||||
check: (req, res, next = (error) ->) ->
|
||||
mocha = new Mocha(reporter: Reporter(res), timeout: 10000)
|
||||
mocha.addFile("test/smoke/js/SmokeTests.js")
|
||||
mocha.run () ->
|
||||
path = require.resolve(__dirname + "/../../../../test/smoke/js/SmokeTests.js")
|
||||
delete require.cache[path]
|
||||
d = domain.create()
|
||||
d.on "error", (error) ->
|
||||
logger.err err: error, "error in mocha"
|
||||
d.run () ->
|
||||
mocha = new Mocha(reporter: Reporter(res), timeout: 10000)
|
||||
mocha.addFile("test/smoke/js/SmokeTests.js")
|
||||
mocha.run () ->
|
||||
path = require.resolve(__dirname + "/../../../../test/smoke/js/SmokeTests.js")
|
||||
delete require.cache[path]
|
||||
|
||||
checkRedis: (req, res, next)->
|
||||
if redisCheck.isAlive()
|
||||
res.send 200
|
||||
else
|
||||
res.send 500
|
||||
|
||||
|
||||
|
||||
|
||||
Reporter = (res) ->
|
||||
(runner) ->
|
||||
|
|
Loading…
Reference in a new issue