From 080b482e51965ef376388d7e251a01e1ef3a2daf Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 19 Jun 2019 10:25:54 +0100 Subject: [PATCH 1/3] Update logger, metrics, and redis Also fix acceptance tests, broken by a change in the redis driver behaviour. It now returns promises from most operations, which confuses mocha. --- services/document-updater/Jenkinsfile | 2 +- services/document-updater/Makefile | 6 +- services/document-updater/buildscript.txt | 2 +- .../document-updater/docker-compose.ci.yml | 5 +- services/document-updater/docker-compose.yml | 8 +- services/document-updater/npm-shrinkwrap.json | 406 ++++++++++-------- services/document-updater/package.json | 6 +- .../coffee/ApplyingUpdatesToADocTests.coffee | 22 + ...lyingUpdatesToProjectStructureTests.coffee | 14 + .../coffee/SettingADocumentTests.coffee | 10 + 10 files changed, 288 insertions(+), 193 deletions(-) diff --git a/services/document-updater/Jenkinsfile b/services/document-updater/Jenkinsfile index 9abbdc917b..2862de8f47 100644 --- a/services/document-updater/Jenkinsfile +++ b/services/document-updater/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { environment { GIT_PROJECT = "document-updater" - JENKINS_WORKFLOW = "document-updater-sharelatex-internal" + JENKINS_WORKFLOW = "document-updater-sharelatex" TARGET_URL = "${env.JENKINS_URL}blue/organizations/jenkins/${JENKINS_WORKFLOW}/detail/$BRANCH_NAME/$BUILD_NUMBER/pipeline" GIT_API_URL = "https://api.github.com/repos/overleaf/${GIT_PROJECT}/statuses/$GIT_COMMIT" } diff --git a/services/document-updater/Makefile b/services/document-updater/Makefile index 07216e7800..ce7210ccf3 100644 --- a/services/document-updater/Makefile +++ b/services/document-updater/Makefile @@ -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) @@ -26,7 +26,9 @@ test: test_unit test_acceptance test_unit: @[ ! -d test/unit ] && echo "document-updater 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 "document-updater has no acceptance tests" || $(DOCKER_COMPOSE) run --rm test_acceptance test_clean: diff --git a/services/document-updater/buildscript.txt b/services/document-updater/buildscript.txt index aa39cdc02f..ebef72a5cc 100644 --- a/services/document-updater/buildscript.txt +++ b/services/document-updater/buildscript.txt @@ -5,4 +5,4 @@ document-updater --dependencies=mongo,redis --docker-repos=gcr.io/overleaf-ops --build-target=docker ---script-version=1.1.12 +--script-version=1.1.21 diff --git a/services/document-updater/docker-compose.ci.yml b/services/document-updater/docker-compose.ci.yml index 36b52f8f8b..d2bcca9ec6 100644 --- a/services/document-updater/docker-compose.ci.yml +++ b/services/document-updater/docker-compose.ci.yml @@ -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: @@ -21,6 +23,7 @@ services: MONGO_HOST: mongo POSTGRES_HOST: postgres MOCHA_GREP: ${MOCHA_GREP} + NODE_ENV: test depends_on: - mongo - redis diff --git a/services/document-updater/docker-compose.yml b/services/document-updater/docker-compose.yml index 8bb7857cb6..02ccd930ba 100644 --- a/services/document-updater/docker-compose.yml +++ b/services/document-updater/docker-compose.yml @@ -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.9.5 volumes: - .:/app working_dir: /app environment: MOCHA_GREP: ${MOCHA_GREP} + NODE_ENV: test command: npm run test:unit user: node @@ -27,6 +28,8 @@ services: MONGO_HOST: mongo POSTGRES_HOST: postgres MOCHA_GREP: ${MOCHA_GREP} + LOG_LEVEL: ERROR + NODE_ENV: test user: node depends_on: - mongo @@ -49,3 +52,4 @@ services: mongo: image: mongo:3.4 + diff --git a/services/document-updater/npm-shrinkwrap.json b/services/document-updater/npm-shrinkwrap.json index f30ce4f581..794836656c 100644 --- a/services/document-updater/npm-shrinkwrap.json +++ b/services/document-updater/npm-shrinkwrap.json @@ -3,19 +3,31 @@ "version": "0.1.4", "dependencies": { "@google-cloud/common": { - "version": "0.27.0", - "from": "@google-cloud/common@>=0.27.0 <0.28.0", - "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.27.0.tgz" + "version": "0.32.1", + "from": "@google-cloud/common@>=0.32.0 <0.33.0", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.32.1.tgz", + "dependencies": { + "extend": { + "version": "3.0.2", + "from": "extend@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz" + } + } }, "@google-cloud/debug-agent": { - "version": "3.0.1", + "version": "3.2.0", "from": "@google-cloud/debug-agent@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/@google-cloud/debug-agent/-/debug-agent-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/@google-cloud/debug-agent/-/debug-agent-3.2.0.tgz", "dependencies": { "coffeescript": { - "version": "2.3.2", + "version": "2.4.1", "from": "coffeescript@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.3.2.tgz" + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.4.1.tgz" + }, + "semver": { + "version": "6.1.1", + "from": "semver@>=6.0.0 <7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz" } } }, @@ -29,43 +41,65 @@ "from": "@google-cloud/common@>=0.26.0 <0.27.0", "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.26.2.tgz" }, + "@google-cloud/promisify": { + "version": "0.3.1", + "from": "@google-cloud/promisify@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-0.3.1.tgz" + }, + "arrify": { + "version": "1.0.1", + "from": "arrify@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" + }, + "gcp-metadata": { + "version": "0.9.3", + "from": "gcp-metadata@>=0.9.0 <0.10.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.9.3.tgz" + }, + "google-auth-library": { + "version": "2.0.2", + "from": "google-auth-library@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-2.0.2.tgz", + "dependencies": { + "gcp-metadata": { + "version": "0.7.0", + "from": "gcp-metadata@>=0.7.0 <0.8.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.7.0.tgz" + } + } + }, "through2": { - "version": "3.0.0", + "version": "3.0.1", "from": "through2@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz" } } }, "@google-cloud/projectify": { - "version": "0.3.2", - "from": "@google-cloud/projectify@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-0.3.2.tgz" + "version": "0.3.3", + "from": "@google-cloud/projectify@>=0.3.3 <0.4.0", + "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-0.3.3.tgz" }, "@google-cloud/promisify": { - "version": "0.3.1", - "from": "@google-cloud/promisify@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-0.3.1.tgz" + "version": "0.4.0", + "from": "@google-cloud/promisify@>=0.4.0 <0.5.0", + "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-0.4.0.tgz" }, "@google-cloud/trace-agent": { - "version": "3.5.2", + "version": "3.6.1", "from": "@google-cloud/trace-agent@>=3.2.0 <4.0.0", - "resolved": "https://registry.npmjs.org/@google-cloud/trace-agent/-/trace-agent-3.5.2.tgz", + "resolved": "https://registry.npmjs.org/@google-cloud/trace-agent/-/trace-agent-3.6.1.tgz", "dependencies": { - "@google-cloud/common": { - "version": "0.30.2", - "from": "@google-cloud/common@>=0.30.0 <0.31.0", - "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.30.2.tgz" - }, - "google-auth-library": { - "version": "3.0.1", - "from": "google-auth-library@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-3.0.1.tgz" - }, "methods": { "version": "1.1.2", "from": "methods@>=1.1.1 <2.0.0", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz" }, + "semver": { + "version": "6.1.1", + "from": "semver@^6.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz" + }, "uuid": { "version": "3.3.2", "from": "uuid@^3.0.1", @@ -124,14 +158,14 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz" }, "@sindresorhus/is": { - "version": "0.13.0", - "from": "@sindresorhus/is@>=0.13.0 <0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.13.0.tgz" + "version": "0.15.0", + "from": "@sindresorhus/is@>=0.15.0 <0.16.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.15.0.tgz" }, "@types/caseless": { - "version": "0.12.1", + "version": "0.12.2", "from": "@types/caseless@*", - "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.1.tgz" + "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz" }, "@types/console-log-level": { "version": "1.4.0", @@ -154,9 +188,9 @@ "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz" }, "@types/node": { - "version": "10.12.20", + "version": "12.0.8", "from": "@types/node@*", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.20.tgz" + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.8.tgz" }, "@types/request": { "version": "2.48.1", @@ -173,15 +207,20 @@ "from": "@types/tough-cookie@*", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.5.tgz" }, + "abort-controller": { + "version": "3.0.0", + "from": "abort-controller@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz" + }, "acorn": { - "version": "5.7.3", - "from": "acorn@>=5.0.3 <6.0.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz" + "version": "6.1.1", + "from": "acorn@>=6.0.0 <7.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz" }, "agent-base": { - "version": "4.2.1", + "version": "4.3.0", "from": "agent-base@>=4.1.0 <5.0.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz" + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz" }, "ajv": { "version": "5.5.2", @@ -189,9 +228,9 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz" }, "arrify": { - "version": "1.0.1", - "from": "arrify@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" + "version": "2.0.1", + "from": "arrify@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz" }, "asn1": { "version": "0.1.11", @@ -240,9 +279,9 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz" }, "axios": { - "version": "0.18.0", + "version": "0.18.1", "from": "axios@>=0.18.0 <0.19.0", - "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz" + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz" }, "balanced-match": { "version": "1.0.0", @@ -266,9 +305,9 @@ "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz" }, "bindings": { - "version": "1.4.0", + "version": "1.5.0", "from": "bindings@>=1.2.1 <2.0.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.4.0.tgz" + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz" }, "bintrees": { "version": "1.0.1", @@ -312,9 +351,9 @@ "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz" }, "builtin-modules": { - "version": "3.0.0", + "version": "3.1.0", "from": "builtin-modules@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz" }, "bunyan": { "version": "0.22.3", @@ -398,9 +437,9 @@ "resolved": "https://registry.npmjs.org/connect/-/connect-2.8.4.tgz" }, "console-log-level": { - "version": "1.4.0", + "version": "1.4.1", "from": "console-log-level@>=1.4.0 <2.0.0", - "resolved": "https://registry.npmjs.org/console-log-level/-/console-log-level-1.4.0.tgz" + "resolved": "https://registry.npmjs.org/console-log-level/-/console-log-level-1.4.1.tgz" }, "continuation-local-storage": { "version": "3.2.1", @@ -469,9 +508,9 @@ } }, "delay": { - "version": "4.1.0", + "version": "4.3.0", "from": "delay@>=4.0.1 <5.0.0", - "resolved": "https://registry.npmjs.org/delay/-/delay-4.1.0.tgz" + "resolved": "https://registry.npmjs.org/delay/-/delay-4.3.0.tgz" }, "delayed-stream": { "version": "0.0.5", @@ -479,9 +518,9 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz" }, "denque": { - "version": "1.4.0", + "version": "1.4.1", "from": "denque@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.0.tgz" + "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz" }, "diff": { "version": "3.5.0", @@ -497,9 +536,9 @@ "optional": true }, "duplexify": { - "version": "3.6.1", + "version": "3.7.1", "from": "duplexify@>=3.6.0 <4.0.0", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz" + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz" }, "each-series": { "version": "1.0.0", @@ -513,9 +552,9 @@ "optional": true }, "ecdsa-sig-formatter": { - "version": "1.0.10", - "from": "ecdsa-sig-formatter@1.0.10", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz" + "version": "1.0.11", + "from": "ecdsa-sig-formatter@1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz" }, "emitter-listener": { "version": "1.1.2", @@ -533,9 +572,9 @@ "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz" }, "es6-promise": { - "version": "4.2.5", + "version": "4.2.8", "from": "es6-promise@>=4.0.3 <5.0.0", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz" + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz" }, "es6-promisify": { "version": "5.0.0", @@ -548,6 +587,11 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "dev": true }, + "event-target-shim": { + "version": "5.0.1", + "from": "event-target-shim@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" + }, "express": { "version": "3.3.4", "from": "express@3.3.4", @@ -588,15 +632,10 @@ "from": "findit2@>=2.2.3 <3.0.0", "resolved": "https://registry.npmjs.org/findit2/-/findit2-2.2.3.tgz" }, - "flexbuffer": { - "version": "0.0.6", - "from": "flexbuffer@0.0.6", - "resolved": "https://registry.npmjs.org/flexbuffer/-/flexbuffer-0.0.6.tgz" - }, "follow-redirects": { - "version": "1.6.1", - "from": "follow-redirects@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.6.1.tgz" + "version": "1.5.10", + "from": "follow-redirects@1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz" }, "forever-agent": { "version": "0.5.2", @@ -632,9 +671,9 @@ "dev": true }, "gaxios": { - "version": "1.2.7", - "from": "gaxios@>=1.0.4 <2.0.0", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-1.2.7.tgz", + "version": "1.8.4", + "from": "gaxios@>=1.2.1 <2.0.0", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-1.8.4.tgz", "dependencies": { "extend": { "version": "3.0.2", @@ -644,9 +683,9 @@ } }, "gcp-metadata": { - "version": "0.9.3", - "from": "gcp-metadata@>=0.9.0 <0.10.0", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.9.3.tgz" + "version": "1.0.0", + "from": "gcp-metadata@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-1.0.0.tgz" }, "getpass": { "version": "0.1.7", @@ -667,31 +706,24 @@ "optional": true }, "google-auth-library": { - "version": "2.0.2", - "from": "google-auth-library@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-2.0.2.tgz", - "dependencies": { - "gcp-metadata": { - "version": "0.7.0", - "from": "gcp-metadata@>=0.7.0 <0.8.0", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.7.0.tgz" - } - } + "version": "3.1.2", + "from": "google-auth-library@>=3.1.1 <4.0.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-3.1.2.tgz" }, "google-p12-pem": { - "version": "1.0.3", + "version": "1.0.4", "from": "google-p12-pem@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.4.tgz" }, "gtoken": { - "version": "2.3.2", - "from": "gtoken@>=2.3.0 <3.0.0", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-2.3.2.tgz", + "version": "2.3.3", + "from": "gtoken@>=2.3.2 <3.0.0", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-2.3.3.tgz", "dependencies": { "mime": { - "version": "2.4.0", + "version": "2.4.4", "from": "mime@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.0.tgz" + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz" } } }, @@ -747,9 +779,9 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" }, "ioredis": { - "version": "4.6.0", - "from": "ioredis@4.6.0", - "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.6.0.tgz" + "version": "4.9.5", + "from": "ioredis@>=4.9.1 <4.10.0", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.9.5.tgz" }, "is": { "version": "3.3.0", @@ -757,9 +789,9 @@ "resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz" }, "is-buffer": { - "version": "1.1.6", - "from": "is-buffer@>=1.1.5 <2.0.0", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" + "version": "2.0.3", + "from": "is-buffer@>=2.0.2 <3.0.0", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz" }, "is-typedarray": { "version": "1.0.0", @@ -815,14 +847,14 @@ } }, "jwa": { - "version": "1.2.0", - "from": "jwa@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.2.0.tgz" + "version": "1.4.1", + "from": "jwa@>=1.4.1 <2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz" }, "jws": { - "version": "3.2.1", + "version": "3.2.2", "from": "jws@>=3.1.5 <4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.1.tgz" + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz" }, "keypress": { "version": "0.1.0", @@ -850,14 +882,14 @@ "resolved": "https://registry.npmjs.org/lodash.pickby/-/lodash.pickby-4.6.0.tgz" }, "logger-sharelatex": { - "version": "1.6.0", - "from": "logger-sharelatex@1.6.0", - "resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-1.6.0.tgz", + "version": "1.7.0", + "from": "logger-sharelatex@1.7.0", + "resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-1.7.0.tgz", "dependencies": { "ajv": { - "version": "6.7.0", + "version": "6.10.0", "from": "ajv@>=6.5.5 <7.0.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz" + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz" }, "assert-plus": { "version": "1.0.0", @@ -870,19 +902,14 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz" }, "bunyan": { - "version": "1.5.1", - "from": "bunyan@1.5.1", - "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.5.1.tgz" - }, - "coffee-script": { - "version": "1.12.4", - "from": "coffee-script@1.12.4", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.4.tgz" + "version": "1.8.12", + "from": "bunyan@1.8.12", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz" }, "combined-stream": { - "version": "1.0.7", + "version": "1.0.8", "from": "combined-stream@>=1.0.6 <1.1.0", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz" + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" }, "delayed-stream": { "version": "1.0.0", @@ -890,9 +917,9 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" }, "dtrace-provider": { - "version": "0.6.0", - "from": "dtrace-provider@>=0.6.0 <0.7.0", - "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.6.0.tgz", + "version": "0.8.7", + "from": "dtrace-provider@>=0.8.0 <0.9.0", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.7.tgz", "optional": true }, "extend": { @@ -931,14 +958,14 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" }, "mime-db": { - "version": "1.37.0", - "from": "mime-db@>=1.37.0 <1.38.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz" + "version": "1.40.0", + "from": "mime-db@1.40.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz" }, "mime-types": { - "version": "2.1.21", + "version": "2.1.24", "from": "mime-types@>=2.1.19 <2.2.0", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz" + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz" }, "oauth-sign": { "version": "0.9.0", @@ -1008,9 +1035,9 @@ "resolved": "https://registry.npmjs.org/methods/-/methods-0.0.1.tgz" }, "metrics-sharelatex": { - "version": "2.1.1", - "from": "metrics-sharelatex@2.1.1", - "resolved": "https://registry.npmjs.org/metrics-sharelatex/-/metrics-sharelatex-2.1.1.tgz", + "version": "2.2.0", + "from": "metrics-sharelatex@2.2.0", + "resolved": "https://registry.npmjs.org/metrics-sharelatex/-/metrics-sharelatex-2.2.0.tgz", "dependencies": { "coffee-script": { "version": "1.6.0", @@ -1021,11 +1048,6 @@ "version": "0.1.1", "from": "lynx@>=0.1.1 <0.2.0", "resolved": "https://registry.npmjs.org/lynx/-/lynx-0.1.1.tgz" - }, - "underscore": { - "version": "1.6.0", - "from": "underscore@>=1.6.0 <1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz" } } }, @@ -1108,6 +1130,12 @@ "from": "module-details-from-path@>=1.0.3 <2.0.0", "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz" }, + "moment": { + "version": "2.24.0", + "from": "moment@>=2.10.6 <3.0.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", + "optional": true + }, "mongodb": { "version": "2.2.36", "from": "mongodb@^2.2.31", @@ -1176,14 +1204,14 @@ "optional": true }, "node-fetch": { - "version": "2.3.0", - "from": "node-fetch@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz" + "version": "2.6.0", + "from": "node-fetch@>=2.3.0 <3.0.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz" }, "node-forge": { - "version": "0.7.6", - "from": "node-forge@>=0.7.4 <0.8.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.6.tgz" + "version": "0.8.4", + "from": "node-forge@>=0.8.0 <0.9.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.8.4.tgz" }, "oauth-sign": { "version": "0.3.0", @@ -1196,14 +1224,14 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" }, "p-limit": { - "version": "2.1.0", - "from": "p-limit@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz" + "version": "2.2.0", + "from": "p-limit@>=2.2.0 <3.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz" }, "p-try": { - "version": "2.0.0", + "version": "2.2.0", "from": "p-try@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" }, "parse-duration": { "version": "0.1.1", @@ -1216,9 +1244,9 @@ "resolved": "https://registry.npmjs.org/parse-mongo-url/-/parse-mongo-url-1.1.1.tgz" }, "parse-ms": { - "version": "2.0.0", + "version": "2.1.0", "from": "parse-ms@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz" }, "path-is-absolute": { "version": "1.0.1", @@ -1256,19 +1284,26 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz" }, "prom-client": { - "version": "11.2.1", + "version": "11.5.1", "from": "prom-client@>=11.1.3 <12.0.0", - "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-11.2.1.tgz" + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-11.5.1.tgz" }, "protobufjs": { "version": "6.8.8", "from": "protobufjs@>=6.8.6 <6.9.0", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz" + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", + "dependencies": { + "@types/node": { + "version": "10.14.9", + "from": "@types/node@>=10.1.0 <11.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.9.tgz" + } + } }, "psl": { - "version": "1.1.31", + "version": "1.1.32", "from": "psl@>=1.1.24 <2.0.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz" + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.32.tgz" }, "punycode": { "version": "1.4.1", @@ -1291,9 +1326,9 @@ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz" }, "raven": { - "version": "1.2.1", - "from": "raven@>=1.1.3 <2.0.0", - "resolved": "https://registry.npmjs.org/raven/-/raven-1.2.1.tgz", + "version": "1.1.3", + "from": "raven@1.1.3", + "resolved": "https://registry.npmjs.org/raven/-/raven-1.1.3.tgz", "dependencies": { "cookie": { "version": "0.3.1", @@ -1308,9 +1343,9 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz" }, "redis": { - "version": "0.12.1", - "from": "redis@0.12.1", - "resolved": "https://registry.npmjs.org/redis/-/redis-0.12.1.tgz" + "version": "0.11.0", + "from": "redis@>=0.11.0 <0.12.0", + "resolved": "https://registry.npmjs.org/redis/-/redis-0.11.0.tgz" }, "redis-commands": { "version": "1.4.0", @@ -1330,19 +1365,12 @@ "redis-sentinel": { "version": "0.1.1", "from": "redis-sentinel@0.1.1", - "resolved": "https://registry.npmjs.org/redis-sentinel/-/redis-sentinel-0.1.1.tgz", - "dependencies": { - "redis": { - "version": "0.11.0", - "from": "redis@>=0.11.0 <0.12.0", - "resolved": "https://registry.npmjs.org/redis/-/redis-0.11.0.tgz" - } - } + "resolved": "https://registry.npmjs.org/redis-sentinel/-/redis-sentinel-0.1.1.tgz" }, "redis-sharelatex": { - "version": "1.0.5", - "from": "redis-sharelatex@latest", - "resolved": "https://registry.npmjs.org/redis-sharelatex/-/redis-sharelatex-1.0.5.tgz", + "version": "1.0.8", + "from": "redis-sharelatex@1.0.8", + "resolved": "https://registry.npmjs.org/redis-sharelatex/-/redis-sharelatex-1.0.8.tgz", "dependencies": { "coffee-script": { "version": "1.8.0", @@ -1468,9 +1496,21 @@ "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz" }, "require-in-the-middle": { - "version": "3.1.0", - "from": "require-in-the-middle@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-3.1.0.tgz" + "version": "4.0.0", + "from": "require-in-the-middle@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-4.0.0.tgz", + "dependencies": { + "debug": { + "version": "4.1.1", + "from": "debug@>=4.1.1 <5.0.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz" + }, + "ms": { + "version": "2.1.2", + "from": "ms@>=2.1.1 <3.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + } + } }, "require-like": { "version": "0.1.2", @@ -1478,9 +1518,9 @@ "resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz" }, "resolve": { - "version": "1.10.0", - "from": "resolve@>=1.5.0 <2.0.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz" + "version": "1.11.0", + "from": "resolve@>=1.10.0 <2.0.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz" }, "resolve-from": { "version": "2.0.0", @@ -1596,9 +1636,9 @@ "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz" }, "standard-as-callback": { - "version": "1.0.1", - "from": "standard-as-callback@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-1.0.1.tgz" + "version": "2.0.1", + "from": "standard-as-callback@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.0.1.tgz" }, "statsd-parser": { "version": "0.0.4", @@ -1620,11 +1660,6 @@ "from": "stringstream@>=0.0.5 <0.1.0", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" }, - "symbol-observable": { - "version": "1.2.0", - "from": "symbol-observable@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz" - }, "tdigest": { "version": "0.1.1", "from": "tdigest@>=0.1.1 <0.2.0", @@ -1689,6 +1724,11 @@ "from": "uid2@0.0.2", "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.2.tgz" }, + "underscore": { + "version": "1.6.0", + "from": "underscore@>=1.6.0 <1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz" + }, "uri-js": { "version": "4.2.2", "from": "uri-js@>=4.2.2 <5.0.0", diff --git a/services/document-updater/package.json b/services/document-updater/package.json index 386f48e7ba..a08f300865 100644 --- a/services/document-updater/package.json +++ b/services/document-updater/package.json @@ -24,11 +24,11 @@ "coffee-script": "~1.7.0", "express": "3.3.4", "lodash": "^4.17.4", - "logger-sharelatex": "^1.6.0", + "logger-sharelatex": "^1.7.0", "lynx": "0.0.11", - "metrics-sharelatex": "^2.1.1", + "metrics-sharelatex": "^2.2.0", "mongojs": "^2.6.0", - "redis-sharelatex": "^1.0.5", + "redis-sharelatex": "^1.0.8", "request": "2.25.0", "requestretry": "^1.12.0", "sandboxed-module": "~0.2.0", diff --git a/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee b/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee index d0d40ba08e..879d0fe371 100644 --- a/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee +++ b/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee @@ -38,6 +38,7 @@ describe "Applying updates to a doc", -> DocUpdaterClient.sendUpdate @project_id, @doc_id, @update, (error) -> throw error if error? setTimeout done, 200 + return null after -> MockWebApi.getDocument.restore() @@ -51,6 +52,7 @@ describe "Applying updates to a doc", -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @result done() + return null it "should push the applied updates to the track changes api", (done) -> rclient_history.lrange HistoryKeys.uncompressedHistoryOps({@doc_id}), 0, -1, (error, updates) => @@ -60,12 +62,14 @@ describe "Applying updates to a doc", -> throw error if error? result.should.equal 1 done() + return null it "should push the applied updates to the project history changes api", (done) -> rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) => throw error if error? JSON.parse(updates[0]).op.should.deep.equal @update.op done() + return null it "should set the first op timestamp", (done) -> rclient_history.get ProjectHistoryKeys.projectHistoryFirstOpTimestamp({@project_id}), (error, result) => @@ -73,6 +77,7 @@ describe "Applying updates to a doc", -> result.should.be.within(@startTime, Date.now()) @firstOpTimestamp = result done() + return null describe "when sending another update", -> before (done) -> @@ -81,12 +86,14 @@ describe "Applying updates to a doc", -> DocUpdaterClient.sendUpdate @project_id, @doc_id, @second_update, (error) -> throw error if error? setTimeout done, 200 + return null it "should not change the first op timestamp", (done) -> rclient_history.get ProjectHistoryKeys.projectHistoryFirstOpTimestamp({@project_id}), (error, result) => throw error if error? result.should.equal @firstOpTimestamp done() + return null describe "when the document is loaded", -> before (done) -> @@ -99,6 +106,7 @@ describe "Applying updates to a doc", -> DocUpdaterClient.sendUpdate @project_id, @doc_id, @update, (error) -> throw error if error? setTimeout done, 200 + return null after -> MockWebApi.getDocument.restore() @@ -110,6 +118,7 @@ describe "Applying updates to a doc", -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @result done() + return null it "should push the applied updates to the track changes api", (done) -> rclient_history.lrange HistoryKeys.uncompressedHistoryOps({@doc_id}), 0, -1, (error, updates) => @@ -117,11 +126,13 @@ describe "Applying updates to a doc", -> rclient_history.sismember HistoryKeys.docsWithHistoryOps({@project_id}), @doc_id, (error, result) => result.should.equal 1 done() + return null it "should push the applied updates to the project history changes api", (done) -> rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) => JSON.parse(updates[0]).op.should.deep.equal @update.op done() + return null describe "when the document has been deleted", -> @@ -161,6 +172,7 @@ describe "Applying updates to a doc", -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @my_result done() + return null it "should push the applied updates to the track changes api", (done) -> rclient_history.lrange HistoryKeys.uncompressedHistoryOps({@doc_id}), 0, -1, (error, updates) => @@ -171,6 +183,7 @@ describe "Applying updates to a doc", -> rclient_history.sismember HistoryKeys.docsWithHistoryOps({@project_id}), @doc_id, (error, result) => result.should.equal 1 done() + return null it "should store the doc ops in the correct order", (done) -> rclient_du.lrange Keys.docOps({doc_id: @doc_id}), 0, -1, (error, updates) => @@ -178,6 +191,7 @@ describe "Applying updates to a doc", -> for appliedUpdate, i in @updates appliedUpdate.op.should.deep.equal updates[i].op done() + return null describe "when older ops come in after the delete", -> before (done) -> @@ -210,6 +224,7 @@ describe "Applying updates to a doc", -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @my_result done() + return null describe "with a broken update", -> before (done) -> @@ -222,11 +237,13 @@ describe "Applying updates to a doc", -> DocUpdaterClient.sendUpdate @project_id, @doc_id, @broken_update, (error) -> throw error if error? setTimeout done, 200 + return null it "should not update the doc", (done) -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @lines done() + return null it "should send a message with an error", -> @messageCallback.called.should.equal true @@ -261,6 +278,7 @@ describe "Applying updates to a doc", -> async.series actions, (error) => throw error if error? setTimeout done, 2000 + return null after -> MockTrackChangesApi.flushDoc.restore() @@ -282,11 +300,13 @@ describe "Applying updates to a doc", -> DocUpdaterClient.sendUpdate @project_id, @doc_id, update, (error) -> throw error if error? setTimeout done, 200 + return null it "should update the doc (using version = 0)", (done) -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @result done() + return null describe "when the sending duplicate ops", -> before (done) -> @@ -322,11 +342,13 @@ describe "Applying updates to a doc", -> throw error if error? setTimeout done, 200 , 200 + return null it "should update the doc", (done) -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @result done() + return null it "should return a message about duplicate ops", -> @messageCallback.calledTwice.should.equal true diff --git a/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToProjectStructureTests.coffee b/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToProjectStructureTests.coffee index 5fdf2a9b4d..cbb9fd9ea5 100644 --- a/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToProjectStructureTests.coffee +++ b/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToProjectStructureTests.coffee @@ -42,6 +42,7 @@ describe "Applying updates to a project's structure", -> update.version.should.equal "#{@version}.0" done() + return null describe "renaming a document", -> before -> @@ -57,6 +58,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.sendProjectUpdate @project_id, @user_id, @docUpdates, [], @version, (error) -> throw error if error? setTimeout done, 200 + return null it "should push the applied doc renames to the project history api", (done) -> rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) => @@ -71,6 +73,7 @@ describe "Applying updates to a project's structure", -> update.version.should.equal "#{@version}.0" done() + return null describe "when the document is loaded", -> before (done) -> @@ -82,6 +85,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.sendProjectUpdate @project_id, @user_id, @docUpdates, [], @version, (error) -> throw error if error? setTimeout done, 200 + return null after -> MockWebApi.getDocument.restore() @@ -90,6 +94,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.getDoc @project_id, @docUpdate.id, (error, res, doc) => doc.pathname.should.equal @docUpdate.newPathname done() + return null it "should push the applied doc renames to the project history api", (done) -> rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) => @@ -104,6 +109,7 @@ describe "Applying updates to a project's structure", -> update.version.should.equal "#{@version}.0" done() + return null describe "renaming multiple documents and files", -> before -> @@ -132,6 +138,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.sendProjectUpdate @project_id, @user_id, @docUpdates, @fileUpdates, @version, (error) -> throw error if error? setTimeout done, 200 + return null it "should push the applied doc renames to the project history api", (done) -> rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) => @@ -170,6 +177,7 @@ describe "Applying updates to a project's structure", -> update.version.should.equal "#{@version}.3" done() + return null describe "adding a file", -> @@ -183,6 +191,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.sendProjectUpdate @project_id, @user_id, [], @fileUpdates, @version, (error) -> throw error if error? setTimeout done, 200 + return null it "should push the file addition to the project history api", (done) -> rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) => @@ -197,6 +206,7 @@ describe "Applying updates to a project's structure", -> update.version.should.equal "#{@version}.0" done() + return null describe "adding a doc", -> before (done) -> @@ -209,6 +219,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.sendProjectUpdate @project_id, @user_id, @docUpdates, [], @version, (error) -> throw error if error? setTimeout done, 200 + return null it "should push the doc addition to the project history api", (done) -> rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) => @@ -223,6 +234,7 @@ describe "Applying updates to a project's structure", -> update.version.should.equal "#{@version}.0" done() + return null describe "with enough updates to flush to the history service", -> before (done) -> @@ -247,6 +259,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.sendProjectUpdate projectId, userId, updates.slice(250), [], @version1, (error) -> throw error if error? setTimeout done, 2000 + return null after -> MockProjectHistoryApi.flushProject.restore() @@ -278,6 +291,7 @@ describe "Applying updates to a project's structure", -> DocUpdaterClient.sendProjectUpdate projectId, userId, updates.slice(10), [], @version1, (error) -> throw error if error? setTimeout done, 2000 + return null after -> MockProjectHistoryApi.flushProject.restore() diff --git a/services/document-updater/test/acceptance/coffee/SettingADocumentTests.coffee b/services/document-updater/test/acceptance/coffee/SettingADocumentTests.coffee index eb71179b3b..f5ec74cbd8 100644 --- a/services/document-updater/test/acceptance/coffee/SettingADocumentTests.coffee +++ b/services/document-updater/test/acceptance/coffee/SettingADocumentTests.coffee @@ -51,6 +51,7 @@ describe "Setting a document", -> @statusCode = res.statusCode done() , 200 + return null it "should return a 204 status code", -> @statusCode.should.equal 204 @@ -64,17 +65,20 @@ describe "Setting a document", -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.lines.should.deep.equal @newLines done() + return null it "should bump the version in the doc updater", (done) -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, doc) => doc.version.should.equal @version + 2 done() + return null it "should leave the document in redis", (done) -> rclient_du.get Keys.docLines({doc_id: @doc_id}), (error, lines) => throw error if error? expect(JSON.parse(lines)).to.deep.equal @newLines done() + return null describe "when the updated doc does not exist in the doc updater", -> before (done) -> @@ -83,6 +87,7 @@ describe "Setting a document", -> DocUpdaterClient.setDocLines @project_id, @doc_id, @newLines, @source, @user_id, false, (error, res, body) => @statusCode = res.statusCode setTimeout done, 200 + return null it "should return a 204 status code", -> @statusCode.should.equal 204 @@ -103,6 +108,7 @@ describe "Setting a document", -> throw error if error? expect(lines).to.not.exist done() + return null describe "with track changes", -> before -> @@ -131,6 +137,7 @@ describe "Setting a document", -> DocUpdaterClient.setDocLines @project_id, @doc_id, @lines, @source, @user_id, true, (error, res, body) => @statusCode = res.statusCode setTimeout done, 200 + return null it "should undo the tracked changes", (done) -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, data) => @@ -138,6 +145,7 @@ describe "Setting a document", -> ranges = data.ranges expect(ranges.changes).to.be.undefined done() + return null describe "without the undo flag", -> before (done) -> @@ -151,6 +159,7 @@ describe "Setting a document", -> DocUpdaterClient.setDocLines @project_id, @doc_id, @lines, @source, @user_id, false, (error, res, body) => @statusCode = res.statusCode setTimeout done, 200 + return null it "should not undo the tracked changes", (done) -> DocUpdaterClient.getDoc @project_id, @doc_id, (error, res, data) => @@ -158,5 +167,6 @@ describe "Setting a document", -> ranges = data.ranges expect(ranges.changes.length).to.equal 1 done() + return null From e8a8c446ed071967d0228f10614674491799c4ed Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 19 Jun 2019 11:34:38 +0100 Subject: [PATCH 2/3] Increase timeout on test? --- .../test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee b/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee index 879d0fe371..51b9cf08a9 100644 --- a/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee +++ b/services/document-updater/test/acceptance/coffee/ApplyingUpdatesToADocTests.coffee @@ -81,6 +81,7 @@ describe "Applying updates to a doc", -> describe "when sending another update", -> before (done) -> + @timeout = 10000 @second_update = Object.create(@update) @second_update.v = @version + 1 DocUpdaterClient.sendUpdate @project_id, @doc_id, @second_update, (error) -> From eed8e215d7e8704a2d53a29c7f79bc49f60c3201 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 2 Jul 2019 16:58:30 +0100 Subject: [PATCH 3/3] bump redis-sharelatex (and io redis) to 1.0.9 --- services/document-updater/npm-shrinkwrap.json | 30 +++++++++++++------ services/document-updater/package.json | 2 +- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/services/document-updater/npm-shrinkwrap.json b/services/document-updater/npm-shrinkwrap.json index 794836656c..3809c8746c 100644 --- a/services/document-updater/npm-shrinkwrap.json +++ b/services/document-updater/npm-shrinkwrap.json @@ -779,9 +779,21 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" }, "ioredis": { - "version": "4.9.5", - "from": "ioredis@>=4.9.1 <4.10.0", - "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.9.5.tgz" + "version": "4.11.1", + "from": "ioredis@>=4.11.1 <4.12.0", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.11.1.tgz", + "dependencies": { + "debug": { + "version": "4.1.1", + "from": "debug@>=4.1.1 <5.0.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz" + }, + "ms": { + "version": "2.1.2", + "from": "ms@>=2.1.1 <3.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + } + } }, "is": { "version": "3.3.0", @@ -1348,9 +1360,9 @@ "resolved": "https://registry.npmjs.org/redis/-/redis-0.11.0.tgz" }, "redis-commands": { - "version": "1.4.0", - "from": "redis-commands@1.4.0", - "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.4.0.tgz" + "version": "1.5.0", + "from": "redis-commands@1.5.0", + "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.5.0.tgz" }, "redis-errors": { "version": "1.2.0", @@ -1368,9 +1380,9 @@ "resolved": "https://registry.npmjs.org/redis-sentinel/-/redis-sentinel-0.1.1.tgz" }, "redis-sharelatex": { - "version": "1.0.8", - "from": "redis-sharelatex@1.0.8", - "resolved": "https://registry.npmjs.org/redis-sharelatex/-/redis-sharelatex-1.0.8.tgz", + "version": "1.0.9", + "from": "redis-sharelatex@1.0.9", + "resolved": "https://registry.npmjs.org/redis-sharelatex/-/redis-sharelatex-1.0.9.tgz", "dependencies": { "coffee-script": { "version": "1.8.0", diff --git a/services/document-updater/package.json b/services/document-updater/package.json index a08f300865..635e23ab74 100644 --- a/services/document-updater/package.json +++ b/services/document-updater/package.json @@ -28,7 +28,7 @@ "lynx": "0.0.11", "metrics-sharelatex": "^2.2.0", "mongojs": "^2.6.0", - "redis-sharelatex": "^1.0.8", + "redis-sharelatex": "^1.0.9", "request": "2.25.0", "requestretry": "^1.12.0", "sandboxed-module": "~0.2.0",