dockerise app, 1.1.3 build scripts
This commit is contained in:
@@ -6,11 +6,15 @@ async = require "async"
|
||||
Settings = require("settings-sharelatex")
|
||||
DocArchiveManager = require("../../../app/js/DocArchiveManager.js")
|
||||
request = require "request"
|
||||
|
||||
DocstoreApp = require "./helpers/DocstoreApp"
|
||||
DocstoreClient = require "./helpers/DocstoreClient"
|
||||
|
||||
|
||||
describe "Archiving", ->
|
||||
|
||||
before (done)->
|
||||
DocstoreApp.ensureRunning(done)
|
||||
|
||||
describe "multiple docs in a project", ->
|
||||
before (done) ->
|
||||
@project_id = ObjectId()
|
||||
@@ -29,6 +33,7 @@ describe "Archiving", ->
|
||||
do (doc) =>
|
||||
(callback) =>
|
||||
DocstoreClient.createDoc @project_id, doc._id, doc.lines, doc.version, doc.ranges, callback
|
||||
|
||||
async.series jobs, (error) =>
|
||||
throw error if error?
|
||||
DocstoreClient.archiveAllDoc @project_id, (error, @res) =>
|
||||
|
||||
@@ -2,6 +2,7 @@ sinon = require "sinon"
|
||||
chai = require("chai")
|
||||
chai.should()
|
||||
{db, ObjectId} = require "../../../app/js/mongojs"
|
||||
DocstoreApp = require "./helpers/DocstoreApp"
|
||||
|
||||
DocstoreClient = require "./helpers/DocstoreClient"
|
||||
|
||||
@@ -12,9 +13,10 @@ describe "Deleting a doc", ->
|
||||
@lines = ["original", "lines"]
|
||||
@version = 42
|
||||
@ranges = []
|
||||
DocstoreClient.createDoc @project_id, @doc_id, @lines, @version, @ranges, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
DocstoreApp.ensureRunning =>
|
||||
DocstoreClient.createDoc @project_id, @doc_id, @lines, @version, @ranges, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
|
||||
describe "when the doc exists", ->
|
||||
beforeEach (done) ->
|
||||
|
||||
@@ -3,6 +3,7 @@ chai = require("chai")
|
||||
chai.should()
|
||||
{ObjectId} = require "mongojs"
|
||||
async = require "async"
|
||||
DocstoreApp = require "./helpers/DocstoreApp"
|
||||
|
||||
DocstoreClient = require "./helpers/DocstoreClient"
|
||||
|
||||
@@ -39,6 +40,8 @@ describe "Getting all docs", ->
|
||||
jobs.push (cb) =>
|
||||
DocstoreClient.createDoc @project_id, @deleted_doc._id, @deleted_doc.lines, version, @deleted_doc.ranges, (err)=>
|
||||
DocstoreClient.deleteDoc @project_id, @deleted_doc._id, cb
|
||||
jobs.unshift (cb)->
|
||||
DocstoreApp.ensureRunning cb
|
||||
async.series jobs, done
|
||||
|
||||
it "getAllDocs should return all the (non-deleted) docs", (done) ->
|
||||
|
||||
@@ -2,6 +2,7 @@ sinon = require "sinon"
|
||||
chai = require("chai")
|
||||
chai.should()
|
||||
{ObjectId} = require "mongojs"
|
||||
DocstoreApp = require "./helpers/DocstoreApp"
|
||||
|
||||
DocstoreClient = require "./helpers/DocstoreClient"
|
||||
|
||||
@@ -20,9 +21,10 @@ describe "Getting a doc", ->
|
||||
ts: new Date().toString()
|
||||
}]
|
||||
}
|
||||
DocstoreClient.createDoc @project_id, @doc_id, @lines, @version, @ranges, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
DocstoreApp.ensureRunning =>
|
||||
DocstoreClient.createDoc @project_id, @doc_id, @lines, @version, @ranges, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
|
||||
describe "when the doc exists", ->
|
||||
it "should get the doc lines and version", (done) ->
|
||||
|
||||
@@ -2,6 +2,7 @@ sinon = require "sinon"
|
||||
chai = require("chai")
|
||||
chai.should()
|
||||
{ObjectId} = require "mongojs"
|
||||
DocstoreApp = require "./helpers/DocstoreApp"
|
||||
|
||||
DocstoreClient = require "./helpers/DocstoreClient"
|
||||
|
||||
@@ -30,9 +31,10 @@ describe "Applying updates to a doc", ->
|
||||
}]
|
||||
}
|
||||
@version = 42
|
||||
DocstoreClient.createDoc @project_id, @doc_id, @originalLines, @version, @originalRanges, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
DocstoreApp.ensureRunning =>
|
||||
DocstoreClient.createDoc @project_id, @doc_id, @originalLines, @version, @originalRanges, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
|
||||
describe "when nothing has been updated", ->
|
||||
beforeEach (done) ->
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
app = require('../../../../app')
|
||||
require("logger-sharelatex").logger.level("error")
|
||||
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.docstore.port, "localhost", (error) =>
|
||||
throw error if error?
|
||||
@running = true
|
||||
for callback in @callbacks
|
||||
callback()
|
||||
Reference in New Issue
Block a user