mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fix acceptence tests, add them back into jenkins, upgrade express
This commit is contained in:
parent
df6b5203a1
commit
fda6cb0084
6 changed files with 48 additions and 12 deletions
6
services/filestore/Jenkinsfile
vendored
6
services/filestore/Jenkinsfile
vendored
|
@ -21,7 +21,11 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
stage('Acceptance Tests') {
|
||||
steps {
|
||||
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Package and publish build') {
|
||||
steps {
|
||||
|
|
|
@ -110,9 +110,8 @@ app.get "/health_check", healthCheckController.check
|
|||
app.get '*', (req, res)->
|
||||
res.send 404
|
||||
|
||||
server = require('http').createServer(app)
|
||||
port = settings.internal.filestore.port or 3009
|
||||
host = "0.0.0.0"
|
||||
|
||||
|
||||
|
||||
beginShutdown = () ->
|
||||
if appIsOk
|
||||
|
@ -122,15 +121,23 @@ beginShutdown = () ->
|
|||
process.exit 1
|
||||
, 120*1000
|
||||
killTimer.unref?() # prevent timer from keeping process alive
|
||||
server.close () ->
|
||||
app.close () ->
|
||||
logger.log "closed all connections"
|
||||
Metrics.close()
|
||||
process.disconnect?()
|
||||
logger.log "server will stop accepting connections"
|
||||
|
||||
server.listen port, ->
|
||||
|
||||
port = settings.internal.filestore.port or 3009
|
||||
host = "0.0.0.0"
|
||||
|
||||
if !module.parent # Called directly
|
||||
app.listen port, host, (error) ->
|
||||
logger.info "Filestore starting up, listening on #{host}:#{port}"
|
||||
|
||||
|
||||
module.exports = app
|
||||
|
||||
process.on 'SIGTERM', () ->
|
||||
logger.log("filestore got SIGTERM, shutting down gracefully")
|
||||
beginShutdown()
|
||||
|
|
|
@ -34,11 +34,11 @@ module.exports =
|
|||
callback(err, destPath)
|
||||
|
||||
thumbnail: (sourcePath, callback)->
|
||||
logger.log sourcePath:sourcePath, "thumbnail convert file"
|
||||
destPath = "#{sourcePath}.png"
|
||||
sourcePath = "#{sourcePath}[0]"
|
||||
width = "260x"
|
||||
command = ["convert", "-flatten", "-background", "white", "-density", "300", "-define", "pdf:fit-page=#{width}", sourcePath, "-resize", width, destPath]
|
||||
logger.log sourcePath:sourcePath, destPath:destPath, command:command, "thumbnail convert file"
|
||||
command = Settings.commands.convertCommandPrefix.concat(command)
|
||||
safe_exec command, childProcessOpts, (err, stdout, stderr)->
|
||||
if err?
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"async": "~0.2.10",
|
||||
"aws-sdk": "^2.1.39",
|
||||
"coffee-script": "~1.7.1",
|
||||
"express": "~3.4.8",
|
||||
"express": "^4.2.0",
|
||||
"fs-extra": "^1.0.0",
|
||||
"heapdump": "^0.3.2",
|
||||
"knox": "~0.9.1",
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
app = require('../../../app')
|
||||
require("logger-sharelatex").logger.level("info")
|
||||
logger = require("logger-sharelatex")
|
||||
Settings = require("settings-sharelatex")
|
||||
|
||||
module.exports =
|
||||
running: false
|
||||
initing: false
|
||||
callbacks: []
|
||||
ensureRunning: (callback = (error) ->) ->
|
||||
if @running
|
||||
return callback()
|
||||
else if @initing
|
||||
@callbacks.push callback
|
||||
else
|
||||
@initing = true
|
||||
@callbacks.push callback
|
||||
app.listen Settings.internal?.filestore?.port, "localhost", (error) =>
|
||||
throw error if error?
|
||||
@running = true
|
||||
logger.log("filestore running in dev mode")
|
||||
|
||||
for callback in @callbacks
|
||||
callback()
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
assert = require("chai").assert
|
||||
sinon = require('sinon')
|
||||
chai = require('chai')
|
||||
|
@ -9,6 +8,7 @@ SandboxedModule = require('sandboxed-module')
|
|||
fs = require("fs")
|
||||
request = require("request")
|
||||
settings = require("settings-sharelatex")
|
||||
FilestoreApp = require "./FilestoreApp"
|
||||
|
||||
describe "Filestore", ->
|
||||
|
||||
|
@ -26,7 +26,8 @@ describe "Filestore", ->
|
|||
@filestoreUrl = "http://localhost:#{settings.internal.filestore.port}"
|
||||
|
||||
beforeEach (done)->
|
||||
fs.unlink @localFileWritePath, =>
|
||||
FilestoreApp.ensureRunning =>
|
||||
fs.unlink @localFileWritePath, ->
|
||||
done()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue