mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-08 21:00:45 +00:00
update logger and metrics
This commit is contained in:
parent
6ff1ca3967
commit
61450bb125
13 changed files with 560 additions and 195 deletions
|
@ -1,7 +1,7 @@
|
|||
# This file was auto-generated, do not edit it directly.
|
||||
# Instead run bin/update_build_scripts from
|
||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||
# Version: 1.1.12
|
||||
# Version: 1.1.21
|
||||
|
||||
BUILD_NUMBER ?= local
|
||||
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
|
@ -29,7 +29,9 @@ test: test_unit test_acceptance
|
|||
test_unit:
|
||||
@[ ! -d test/unit ] && echo "track-changes has no unit tests" || $(DOCKER_COMPOSE) run --rm test_unit
|
||||
|
||||
test_acceptance: test_clean test_acceptance_pre_run # clear the database before each acceptance test run
|
||||
test_acceptance: test_clean test_acceptance_pre_run test_acceptance_run
|
||||
|
||||
test_acceptance_run:
|
||||
@[ ! -d test/acceptance ] && echo "track-changes has no acceptance tests" || $(DOCKER_COMPOSE) run --rm test_acceptance
|
||||
|
||||
test_clean:
|
||||
|
|
|
@ -5,4 +5,4 @@ track-changes
|
|||
--dependencies=mongo,redis
|
||||
--docker-repos=gcr.io/overleaf-ops
|
||||
--build-target=docker
|
||||
--script-version=1.1.12
|
||||
--script-version=1.1.21
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This file was auto-generated, do not edit it directly.
|
||||
# Instead run bin/update_build_scripts from
|
||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||
# Version: 1.1.12
|
||||
# Version: 1.1.21
|
||||
|
||||
version: "2"
|
||||
|
||||
|
@ -10,6 +10,8 @@ services:
|
|||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
user: node
|
||||
command: npm run test:unit:_run
|
||||
environment:
|
||||
NODE_ENV: test
|
||||
|
||||
|
||||
test_acceptance:
|
||||
|
@ -24,6 +26,7 @@ services:
|
|||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||
AWS_BUCKET: ${AWS_BUCKET}
|
||||
MOCHA_GREP: ${MOCHA_GREP}
|
||||
NODE_ENV: test
|
||||
depends_on:
|
||||
- mongo
|
||||
- redis
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
# This file was auto-generated, do not edit it directly.
|
||||
# Instead run bin/update_build_scripts from
|
||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||
# Version: 1.1.12
|
||||
# Version: 1.1.21
|
||||
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
test_unit:
|
||||
build: .
|
||||
image: node:6.11.2
|
||||
volumes:
|
||||
- .:/app
|
||||
working_dir: /app
|
||||
environment:
|
||||
MOCHA_GREP: ${MOCHA_GREP}
|
||||
NODE_ENV: test
|
||||
command: npm run test:unit
|
||||
user: node
|
||||
|
||||
|
@ -30,6 +31,8 @@ services:
|
|||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||
AWS_BUCKET: ${AWS_BUCKET}
|
||||
MOCHA_GREP: ${MOCHA_GREP}
|
||||
LOG_LEVEL: ERROR
|
||||
NODE_ENV: test
|
||||
user: node
|
||||
depends_on:
|
||||
- mongo
|
||||
|
@ -52,3 +55,4 @@ services:
|
|||
mongo:
|
||||
image: mongo:3.4
|
||||
|
||||
|
||||
|
|
688
services/track-changes/npm-shrinkwrap.json
generated
688
services/track-changes/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load diff
|
@ -29,12 +29,12 @@
|
|||
"express": "3.3.5",
|
||||
"heap": "^0.2.6",
|
||||
"line-reader": "^0.2.4",
|
||||
"logger-sharelatex": "^1.6.0",
|
||||
"metrics-sharelatex": "^2.1.1",
|
||||
"logger-sharelatex": "^1.7.0",
|
||||
"metrics-sharelatex": "^2.2.0",
|
||||
"mongo-uri": "^0.1.2",
|
||||
"mongojs": "2.4.0",
|
||||
"redis": "~0.10.1",
|
||||
"redis-sharelatex": "^1.0.5",
|
||||
"redis-sharelatex": "^1.0.8",
|
||||
"request": "~2.33.0",
|
||||
"requestretry": "^1.12.0",
|
||||
"s3-streams": "^0.3.0",
|
||||
|
|
|
@ -39,6 +39,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should insert the compressed op into mongo", ->
|
||||
expect(@updates[0].pack[0].op).to.deep.equal [{
|
||||
|
@ -58,6 +59,7 @@ describe "Appending doc ops to the history", ->
|
|||
rclient.sismember "DocsWithHistoryOps:#{@project_id}", @doc_id, (error, member) ->
|
||||
member.should.equal 0
|
||||
done()
|
||||
return null
|
||||
|
||||
describe "when the history has already been started", ->
|
||||
beforeEach (done) ->
|
||||
|
@ -82,6 +84,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
describe "when the updates are recent and from the same user", ->
|
||||
beforeEach (done) ->
|
||||
|
@ -102,6 +105,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should combine all the updates into one pack", ->
|
||||
expect(@updates[0].pack[1].op).to.deep.equal [{
|
||||
|
@ -132,6 +136,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should combine the updates into one pack", ->
|
||||
expect(@updates[0].pack[0].op).to.deep.equal [{
|
||||
|
@ -162,6 +167,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should concat the compressed op into mongo", ->
|
||||
expect(@updates[0].pack.length).to.deep.equal 3 # batch size is 100
|
||||
|
@ -190,6 +196,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should insert the compressed ops into mongo", ->
|
||||
expect(@updates[0].pack[0].op).to.deep.equal [{
|
||||
|
@ -223,6 +230,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should insert the compressed no-op into mongo", ->
|
||||
expect(@updates[0].pack[0].op).to.deep.equal []
|
||||
|
@ -252,6 +260,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should ignore the comment op", ->
|
||||
expect(@updates[0].pack[0].op).to.deep.equal [{d: "bar", p: 6}]
|
||||
|
@ -275,6 +284,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should not add a expiresAt entry in the update in mongo", ->
|
||||
expect(@updates[0].expiresAt).to.be.undefined
|
||||
|
@ -295,6 +305,7 @@ describe "Appending doc ops to the history", ->
|
|||
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should add a expiresAt entry in the update in mongo", ->
|
||||
expect(@updates[0].expiresAt).to.exist
|
||||
|
|
|
@ -64,6 +64,7 @@ describe "Archiving updates", ->
|
|||
TrackChangesClient.flushDoc @project_id, @doc_id, (error) ->
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
after (done) ->
|
||||
MockWebApi.getUserInfo.restore()
|
||||
|
@ -76,6 +77,7 @@ describe "Archiving updates", ->
|
|||
TrackChangesClient.pushDocHistory @project_id, @doc_id, (error) ->
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should have one cached pack", (done) ->
|
||||
db.docHistory.count { doc_id: ObjectId(@doc_id), expiresAt:{$exists:true}}, (error, count) ->
|
||||
|
@ -120,6 +122,7 @@ describe "Archiving updates", ->
|
|||
TrackChangesClient.pullDocHistory @project_id, @doc_id, (error) ->
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should restore both packs", (done) ->
|
||||
db.docHistory.count { doc_id: ObjectId(@doc_id) }, (error, count) ->
|
||||
|
|
|
@ -15,7 +15,7 @@ MockWebApi = require "./helpers/MockWebApi"
|
|||
describe "Flushing updates", ->
|
||||
before (done)->
|
||||
TrackChangesApp.ensureRunning done
|
||||
|
||||
|
||||
describe "flushing a doc's updates", ->
|
||||
before (done) ->
|
||||
@project_id = ObjectId().toString()
|
||||
|
@ -32,6 +32,7 @@ describe "Flushing updates", ->
|
|||
TrackChangesClient.flushDoc @project_id, @doc_id, (error) ->
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should flush the op into mongo", (done) ->
|
||||
TrackChangesClient.getCompressedUpdates @doc_id, (error, updates) ->
|
||||
|
@ -39,6 +40,7 @@ describe "Flushing updates", ->
|
|||
p: 3, i: "f"
|
||||
}]
|
||||
done()
|
||||
return null
|
||||
|
||||
describe "flushing a project's updates", ->
|
||||
describe "with versioning enabled", ->
|
||||
|
@ -66,16 +68,19 @@ describe "Flushing updates", ->
|
|||
TrackChangesClient.flushProject @project_id, (error) ->
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should not mark the updates for deletion", (done) ->
|
||||
TrackChangesClient.getCompressedUpdates @doc_id, (error, updates) ->
|
||||
expect(updates[0].expiresAt).to.not.exist
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should preserve history forever", (done) ->
|
||||
TrackChangesClient.getProjectMetaData @project_id, (error, project) ->
|
||||
expect(project.preserveHistory).to.equal true
|
||||
done()
|
||||
return null
|
||||
|
||||
describe "without versioning enabled", ->
|
||||
before (done) ->
|
||||
|
@ -102,11 +107,13 @@ describe "Flushing updates", ->
|
|||
TrackChangesClient.flushProject @project_id, (error) ->
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should mark the updates for deletion", (done) ->
|
||||
TrackChangesClient.getCompressedUpdates @doc_id, (error, updates) ->
|
||||
expect(updates[0].expiresAt).to.exist
|
||||
done()
|
||||
return null
|
||||
|
||||
describe "without versioning enabled but with preserveHistory set to true", ->
|
||||
before (done) ->
|
||||
|
@ -135,8 +142,10 @@ describe "Flushing updates", ->
|
|||
TrackChangesClient.flushProject @project_id, (error) ->
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should not mark the updates for deletion", (done) ->
|
||||
TrackChangesClient.getCompressedUpdates @doc_id, (error, updates) ->
|
||||
expect(updates[0].expiresAt).to.not.exist
|
||||
done()
|
||||
return null
|
||||
|
|
|
@ -67,10 +67,12 @@ describe "Getting a diff", ->
|
|||
throw error if error?
|
||||
@diff = diff.diff
|
||||
done()
|
||||
return null
|
||||
|
||||
afterEach () ->
|
||||
MockDocUpdaterApi.getDoc.restore()
|
||||
MockWebApi.getUserInfo.restore()
|
||||
return null
|
||||
|
||||
it "should return the diff", ->
|
||||
expect(@diff).to.deep.equal @expected_diff
|
||||
|
@ -79,3 +81,4 @@ describe "Getting a diff", ->
|
|||
MockDocUpdaterApi.getDoc
|
||||
.calledWith(@project_id, @doc_id)
|
||||
.should.equal true
|
||||
return null
|
||||
|
|
|
@ -47,14 +47,16 @@ describe "Getting updates", ->
|
|||
v: 2 * i + 2
|
||||
}
|
||||
@updates[0].meta.user_id = @deleted_user_id
|
||||
|
||||
|
||||
TrackChangesApp.ensureRunning =>
|
||||
TrackChangesClient.pushRawUpdates @project_id, @doc_id, @updates, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
after: () ->
|
||||
MockWebApi.getUserInfo.restore()
|
||||
return null
|
||||
|
||||
describe "getting updates up to the limit", ->
|
||||
before (done) ->
|
||||
|
@ -62,6 +64,7 @@ describe "Getting updates", ->
|
|||
throw error if error?
|
||||
@updates = body.updates
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should fetch the user details from the web api", ->
|
||||
MockWebApi.getUserInfo
|
||||
|
@ -101,6 +104,7 @@ describe "Getting updates", ->
|
|||
throw error if error?
|
||||
@updates = body.updates
|
||||
done()
|
||||
return null
|
||||
|
||||
it "should return as many updates as it can", ->
|
||||
docs1 = {}
|
||||
|
|
|
@ -13,6 +13,7 @@ describe "Locking document", ->
|
|||
|
||||
before (done)->
|
||||
TrackChangesApp.ensureRunning done
|
||||
return null
|
||||
|
||||
describe "when the lock has expired in redis", ->
|
||||
before (done) ->
|
||||
|
@ -29,8 +30,10 @@ describe "Locking document", ->
|
|||
, (error) ->
|
||||
# we get here after trying to release lock A
|
||||
done()
|
||||
return null
|
||||
|
||||
it "the new lock should not be removed by the expired locker", (done) ->
|
||||
LockManager.checkLock "doc123", (err, isFree) ->
|
||||
expect(isFree).to.equal false
|
||||
done()
|
||||
return null
|
||||
|
|
|
@ -61,11 +61,14 @@ describe "Restoring a version", ->
|
|||
TrackChangesClient.restoreDoc @project_id, @doc_id, @beforeVersion, @user_id, (error) =>
|
||||
throw error if error?
|
||||
done()
|
||||
return null
|
||||
|
||||
after () ->
|
||||
MockDocUpdaterApi.setDoc.restore()
|
||||
return null
|
||||
|
||||
it "should set the doc in the doc updater", ->
|
||||
MockDocUpdaterApi.setDoc
|
||||
.calledWith(@project_id, @doc_id, @restored_lines, @user_id, true)
|
||||
.should.equal true
|
||||
return null
|
||||
|
|
Loading…
Add table
Reference in a new issue