Merge pull request #130 from overleaf/jpa-bump-dev-env-3-3-2-testing

[misc] bump the dev-env to 3.3.2
This commit is contained in:
Christopher Hoskin 2020-08-13 15:35:51 +01:00 committed by GitHub
commit 773c9df99c
28 changed files with 566 additions and 625 deletions

View file

@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
pull-request-branch-name:
# Separate sections of the branch name with a hyphen
# Docker images use the branch name and do not support slashes in tags
# https://github.com/overleaf/google-ops/issues/822
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#pull-request-branch-nameseparator
separator: "-"
# Block informal upgrades -- security upgrades use a separate queue.
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#open-pull-requests-limit
open-pull-requests-limit: 0

View file

@ -49,3 +49,6 @@ template_files/*
/log.json
hash_folder
# managed by dev-environment$ bin/update_build_scripts
.npmrc

View file

@ -17,8 +17,6 @@ RUN npm ci --quiet
COPY . /app
FROM base
COPY --from=app /app /app

View file

@ -1,131 +0,0 @@
String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
pipeline {
agent any
environment {
GIT_PROJECT = "filestore"
JENKINS_WORKFLOW = "filestore-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"
}
triggers {
pollSCM('* * * * *')
cron(cron_string)
}
stages {
stage('Install') {
steps {
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"pending\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build is underway\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
}
stage('Build') {
steps {
sh 'make build'
}
}
stage('Linting') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make format'
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make lint'
}
}
stage('Unit Tests') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
}
}
stage('Acceptance Tests') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
}
}
stage('Package and docker push') {
steps {
sh 'echo ${BUILD_NUMBER} > build_number.txt'
sh 'touch build.tar.gz' // Avoid tar warning about files changing during read
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make tar'
withCredentials([file(credentialsId: 'gcr.io_overleaf-ops', variable: 'DOCKER_REPO_KEY_PATH')]) {
sh 'docker login -u _json_key --password-stdin https://gcr.io/overleaf-ops < ${DOCKER_REPO_KEY_PATH}'
}
sh 'DOCKER_REPO=gcr.io/overleaf-ops make publish'
sh 'docker logout https://gcr.io/overleaf-ops'
}
}
stage('Publish to s3') {
steps {
sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt'
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz")
}
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
// The deployment process uses this file to figure out the latest build
s3Upload(file:'build_number.txt', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/latest")
}
}
}
}
post {
always {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_clean'
sh 'make clean'
}
success {
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"success\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build succeeded!\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
failure {
mail(from: "${EMAIL_ALERT_FROM}",
to: "${EMAIL_ALERT_TO}",
subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
body: "Build: ${BUILD_URL}")
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"failure\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build failed\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
}
// The options directive is for configuration that applies to the whole job.
options {
// we'd like to make sure remove old builds, so we don't fill up our storage!
buildDiscarder(logRotator(numToKeepStr:'50'))
// And we'd really like to be sure that this build doesn't hang forever, so let's time it out after:
timeout(time: 30, unit: 'MINUTES')
}
}

View file

@ -25,13 +25,13 @@ clean:
docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
format:
$(DOCKER_COMPOSE) run --rm test_unit npm run format
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format
format_fix:
$(DOCKER_COMPOSE) run --rm test_unit npm run format:fix
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format:fix
lint:
$(DOCKER_COMPOSE) run --rm test_unit npm run lint
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent lint
test: format lint test_unit test_acceptance

View file

@ -140,7 +140,7 @@ const host = '0.0.0.0'
if (!module.parent) {
// Called directly
app.listen(port, host, error => {
app.listen(port, host, (error) => {
if (error) {
logger.error('Error starting Filestore', error)
throw error
@ -153,7 +153,7 @@ process
.on('unhandledRejection', (reason, p) => {
logger.err(reason, 'Unhandled Rejection at Promise', p)
})
.on('uncaughtException', err => {
.on('uncaughtException', (err) => {
logger.err(err, 'Uncaught Exception thrown')
process.exit(1)
})

View file

@ -70,7 +70,7 @@ function getFile(req, res, next) {
return res.sendStatus(200).end()
}
pipeline(fileStream, res, err => {
pipeline(fileStream, res, (err) => {
if (err && err.code === 'ERR_STREAM_PREMATURE_CLOSE') {
res.end()
} else if (err) {
@ -140,7 +140,7 @@ function copyFile(req, res, next) {
PersistorManager.copyObject(bucket, `${oldProjectId}/${oldFileId}`, key)
.then(() => res.sendStatus(200))
.catch(err => {
.catch((err) => {
if (err) {
if (err instanceof Errors.NotFoundError) {
res.sendStatus(404)

View file

@ -62,7 +62,7 @@ module.exports = {
check(req, res, next) {
Promise.all([checkCanGetFiles(), checkFileConvert()])
.then(() => res.sendStatus(200))
.catch(err => {
.catch((err) => {
next(err)
})
}

View file

@ -38,10 +38,7 @@ class RequestLogger {
metrics.timing('http_request', responseTime, null, {
method: req.method,
status_code: res.statusCode,
path: routePath
.replace(/\//g, '_')
.replace(/:/g, '')
.slice(1)
path: routePath.replace(/\//g, '_').replace(/:/g, '').slice(1)
})
}

View file

@ -62,13 +62,13 @@ function safeExec(command, options, callback) {
cleanup()
})
child.on('error', err => {
child.on('error', (err) => {
cleanup(err)
})
child.stdout.on('data', chunk => {
child.stdout.on('data', (chunk) => {
stdout += chunk
})
child.stderr.on('data', chunk => {
child.stderr.on('data', (chunk) => {
stderr += chunk
})
}

View file

@ -1,11 +1,9 @@
filestore
--acceptance-creds=
--data-dirs=uploads,user_files,template_files
--dependencies=s3,gcs
--docker-repos=gcr.io/overleaf-ops
--env-add=ENABLE_CONVERSIONS="true",USE_PROM_METRICS="true",AWS_S3_USER_FILES_BUCKET_NAME=fake_user_files,AWS_S3_TEMPLATE_FILES_BUCKET_NAME=fake_template_files,AWS_S3_PUBLIC_FILES_BUCKET_NAME=fake_public_files
--env-add=ENABLE_CONVERSIONS="true",USE_PROM_METRICS="true",AWS_S3_USER_FILES_BUCKET_NAME=fake_user_files,AWS_S3_TEMPLATE_FILES_BUCKET_NAME=fake_template_files,AWS_S3_PUBLIC_FILES_BUCKET_NAME=fake_public_files,GCS_USER_FILES_BUCKET_NAME=fake_userfiles,GCS_TEMPLATE_FILES_BUCKET_NAME=fake_templatefiles,GCS_PUBLIC_FILES_BUCKET_NAME=fake_publicfiles
--env-pass-through=
--language=es
--node-version=12.18.0
--public-repo=True
--script-version=2.2.0
--script-version=3.3.2

View file

@ -11,6 +11,7 @@ services:
command: npm run test:unit:_run
environment:
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
test_acceptance:
@ -21,23 +22,25 @@ services:
REDIS_HOST: redis
MONGO_HOST: mongo
POSTGRES_HOST: postgres
AWS_S3_ENDPOINT: http://s3:9090
AWS_S3_PATH_STYLE: 'true'
AWS_ACCESS_KEY_ID: fake
AWS_SECRET_ACCESS_KEY: fake
GCS_API_ENDPOINT: gcs:9090
GCS_API_SCHEME: http
GCS_PROJECT_ID: fake
STORAGE_EMULATOR_HOST: http://gcs:9090/storage/v1
MOCHA_GREP: ${MOCHA_GREP}
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
ENABLE_CONVERSIONS: "true"
USE_PROM_METRICS: "true"
AWS_S3_USER_FILES_BUCKET_NAME: fake_user_files
AWS_S3_TEMPLATE_FILES_BUCKET_NAME: fake_template_files
AWS_S3_PUBLIC_FILES_BUCKET_NAME: fake_public_files
AWS_S3_ENDPOINT: http://s3:9090
AWS_ACCESS_KEY_ID: fake
AWS_SECRET_ACCESS_KEY: fake
AWS_S3_PATH_STYLE: 'true'
GCS_API_ENDPOINT: gcs:9090
GCS_API_SCHEME: http
GCS_USER_FILES_BUCKET_NAME: fake_userfiles
GCS_TEMPLATE_FILES_BUCKET_NAME: fake_templatefiles
GCS_PUBLIC_FILES_BUCKET_NAME: fake_publicfiles
STORAGE_EMULATOR_HOST: http://gcs:9090/storage/v1
depends_on:
s3:
condition: service_healthy
@ -59,8 +62,7 @@ services:
context: test/acceptance/deps
dockerfile: Dockerfile.s3mock
environment:
- initialBuckets=fake_user_files,fake_template_files,fake_public_files
- initialBuckets=fake_user_files,fake_template_files,fake_public_files,bucket
gcs:
build:
context: test/acceptance/deps

View file

@ -15,7 +15,8 @@ services:
environment:
MOCHA_GREP: ${MOCHA_GREP}
NODE_ENV: test
command: npm run test:unit
NODE_OPTIONS: "--unhandled-rejections=strict"
command: npm run --silent test:unit
user: node
test_acceptance:
@ -30,39 +31,40 @@ services:
REDIS_HOST: redis
MONGO_HOST: mongo
POSTGRES_HOST: postgres
MOCHA_GREP: ${MOCHA_GREP}
LOG_LEVEL: ERROR
NODE_ENV: test
ENABLE_CONVERSIONS: "true"
USE_PROM_METRICS: "true"
AWS_S3_USER_FILES_BUCKET_NAME: fake_user_files
AWS_S3_TEMPLATE_FILES_BUCKET_NAME: fake_template_files
AWS_S3_PUBLIC_FILES_BUCKET_NAME: fake_public_files
AWS_S3_ENDPOINT: http://s3:9090
AWS_S3_PATH_STYLE: 'true'
AWS_ACCESS_KEY_ID: fake
AWS_SECRET_ACCESS_KEY: fake
GCS_API_ENDPOINT: gcs:9090
GCS_API_SCHEME: http
GCS_PROJECT_ID: fake
STORAGE_EMULATOR_HOST: http://gcs:9090/storage/v1
MOCHA_GREP: ${MOCHA_GREP}
LOG_LEVEL: ERROR
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
ENABLE_CONVERSIONS: "true"
USE_PROM_METRICS: "true"
AWS_S3_USER_FILES_BUCKET_NAME: fake_user_files
AWS_S3_TEMPLATE_FILES_BUCKET_NAME: fake_template_files
AWS_S3_PUBLIC_FILES_BUCKET_NAME: fake_public_files
GCS_USER_FILES_BUCKET_NAME: fake_userfiles
GCS_TEMPLATE_FILES_BUCKET_NAME: fake_templatefiles
GCS_PUBLIC_FILES_BUCKET_NAME: fake_publicfiles
STORAGE_EMULATOR_HOST: http://gcs:9090/storage/v1
user: node
depends_on:
s3:
condition: service_healthy
gcs:
condition: service_healthy
command: npm run test:acceptance
command: npm run --silent test:acceptance
s3:
build:
context: test/acceptance/deps
dockerfile: Dockerfile.s3mock
environment:
- initialBuckets=fake_user_files,fake_template_files,fake_public_files
- initialBuckets=fake_user_files,fake_template_files,fake_public_files,bucket
gcs:
build:
context: test/acceptance/deps

View file

@ -8,7 +8,6 @@
"execMap": {
"js": "npm run start"
},
"watch": [
"app/js/",
"app.js",

View file

@ -149,6 +149,24 @@
"google-auth-library": "^5.5.0",
"retry-request": "^4.0.0",
"teeny-request": "^6.0.0"
},
"dependencies": {
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
}
}
}
},
"@google-cloud/debug-agent": {
@ -369,6 +387,24 @@
"stream-events": "^1.0.4",
"through2": "^3.0.0",
"type-fest": "^0.12.0"
},
"dependencies": {
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
}
}
}
},
"@google-cloud/logging-bunyan": {
@ -378,69 +414,6 @@
"requires": {
"@google-cloud/logging": "^7.0.0",
"google-auth-library": "^6.0.0"
},
"dependencies": {
"gaxios": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-3.0.3.tgz",
"integrity": "sha512-PkzQludeIFhd535/yucALT/Wxyj/y2zLyrMwPcJmnLHDugmV49NvAi/vb+VUq/eWztATZCNcb8ue+ywPG+oLuw==",
"requires": {
"abort-controller": "^3.0.0",
"extend": "^3.0.2",
"https-proxy-agent": "^5.0.0",
"is-stream": "^2.0.0",
"node-fetch": "^2.3.0"
}
},
"gcp-metadata": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.1.0.tgz",
"integrity": "sha512-r57SV28+olVsflPlKyVig3Muo/VDlcsObMtvDGOEtEJXj+DDE8bEl0coIkXh//hbkSDTvo+f5lbihZOndYXQQQ==",
"requires": {
"gaxios": "^3.0.0",
"json-bigint": "^0.3.0"
}
},
"google-auth-library": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.3.tgz",
"integrity": "sha512-2Np6ojPmaJGXHSMsBhtTQEKfSMdLc8hefoihv7N2cwEr8E5bq39fhoat6TcXHwa0XoGO5Guh9sp3nxHFPmibMw==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^3.0.0",
"gcp-metadata": "^4.1.0",
"gtoken": "^5.0.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
}
},
"google-p12-pem": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.1.tgz",
"integrity": "sha512-VlQgtozgNVVVcYTXS36eQz4PXPt9gIPqLOhHN0QiV6W6h4qSCNVKPtKC5INtJsaHHF2r7+nOIa26MJeJMTaZEQ==",
"requires": {
"node-forge": "^0.9.0"
}
},
"gtoken": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.1.tgz",
"integrity": "sha512-33w4FNDkUcyIOq/TqyC+drnKdI4PdXmWp9lZzssyEQKuvu9ZFN3KttaSnDKo52U3E51oujVGop93mKxmqO8HHg==",
"requires": {
"gaxios": "^3.0.0",
"google-p12-pem": "^3.0.0",
"jws": "^4.0.0",
"mime": "^2.2.0"
}
},
"mime": {
"version": "2.4.6",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz",
"integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA=="
}
}
},
"@google-cloud/paginator": {
@ -1097,9 +1070,9 @@
}
},
"@grpc/proto-loader": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.4.tgz",
"integrity": "sha512-HTM4QpI9B2XFkPz7pjwMyMgZchJ93TVkL3kWPW8GDMDKYxsMnmf4w2TNMJK7+KNiYHS5cJrCEAFlF+AwtXWVPA==",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz",
"integrity": "sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ==",
"requires": {
"lodash.camelcase": "^4.3.0",
"protobufjs": "^6.8.6"
@ -1821,7 +1794,6 @@
"version": "1.8.14",
"resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
"integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
"dev": true,
"requires": {
"dtrace-provider": "~0.8",
"moment": "^2.19.3",
@ -1905,7 +1877,7 @@
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA=="
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
},
"check-error": {
"version": "1.0.2",
@ -2141,7 +2113,7 @@
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow=="
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
},
"crypto-random-string": {
"version": "2.0.0",
@ -2151,7 +2123,7 @@
"d64": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/d64/-/d64-1.0.0.tgz",
"integrity": "sha512-5eNy3WZziVYnrogqgXhcdEmqcDB2IHurTqLcrgssJsfkMVCUoUaZpK6cJjxxvLV2dUm5SuJMNcYfVGoin9UIRw=="
"integrity": "sha1-QAKofoUMv8n52XBrYPymE6MzbpA="
},
"dashdash": {
"version": "1.14.1",
@ -2521,9 +2493,9 @@
"dev": true
},
"eslint-plugin-chai-friendly": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.6.0.tgz",
"integrity": "sha512-Uvvv1gkbRGp/qfN15B0kQyQWg+oFA8buDSqrwmW3egNSk/FpqH2MjQqKOuKwmEL6w4QIQrIjDp+gg6kGGmD3oQ==",
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.5.0.tgz",
"integrity": "sha512-Pxe6z8C9fP0pn2X2nGFU/b3GBOCM/5FVus1hsMwJsXP3R7RiXFl7g0ksJbsc0GxiLyidTW4mEFk77qsNn7Tk7g==",
"dev": true
},
"eslint-plugin-es": {
@ -3037,9 +3009,9 @@
"dev": true
},
"gaxios": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.3.1.tgz",
"integrity": "sha512-DQOesWEx59/bm63lTX0uHDDXpGTW9oKqNsoigwCoRe2lOb5rFqxzHjLTa6aqEBecLcz69dHLw7rbS068z1fvIQ==",
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.3.4.tgz",
"integrity": "sha512-US8UMj8C5pRnao3Zykc4AAVr+cffoNKRTg9Rsf2GiuZCW69vgJj38VK2PzlPuQU73FZ/nTk9/Av6/JGcE1N9vA==",
"requires": {
"abort-controller": "^3.0.0",
"extend": "^3.0.2",
@ -3049,9 +3021,9 @@
}
},
"gcp-metadata": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-3.4.0.tgz",
"integrity": "sha512-fizmBtCXHp8b7FZuzbgKaixO8DzsSYoEVmMgZIna7x8t6cfBF3eqirODWYxVbgmasA5qudCAKiszfB7yVwroIQ==",
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-3.5.0.tgz",
"integrity": "sha512-ZQf+DLZ5aKcRpLzYUyBS3yo3N0JSa82lNDO8rj3nMSlovLcz2riKFBsYgDzeXcv75oo5eqB2lx+B14UvPoCRnA==",
"requires": {
"gaxios": "^2.1.0",
"json-bigint": "^0.3.0"
@ -3215,19 +3187,92 @@
"dev": true
},
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"version": "6.0.6",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.6.tgz",
"integrity": "sha512-fWYdRdg55HSJoRq9k568jJA1lrhg9i2xgfhVIMJbskUmbDpJGHsbv9l41DGhCDXM21F9Kn4kUwdysgxSYBYJUw==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"gaxios": "^3.0.0",
"gcp-metadata": "^4.1.0",
"gtoken": "^5.0.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
"lru-cache": "^6.0.0"
},
"dependencies": {
"bignumber.js": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
},
"gaxios": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-3.1.0.tgz",
"integrity": "sha512-DDTn3KXVJJigtz+g0J3vhcfbDbKtAroSTxauWsdnP57sM5KZ3d2c/3D9RKFJ86s43hfw6WULg6TXYw/AYiBlpA==",
"requires": {
"abort-controller": "^3.0.0",
"extend": "^3.0.2",
"https-proxy-agent": "^5.0.0",
"is-stream": "^2.0.0",
"node-fetch": "^2.3.0"
}
},
"gcp-metadata": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.1.4.tgz",
"integrity": "sha512-5J/GIH0yWt/56R3dNaNWPGQ/zXsZOddYECfJaqxFWgrZ9HC2Kvc5vl9upOgUUHKzURjAVf2N+f6tEJiojqXUuA==",
"requires": {
"gaxios": "^3.0.0",
"json-bigint": "^1.0.0"
}
},
"google-p12-pem": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.2.tgz",
"integrity": "sha512-tbjzndQvSIHGBLzHnhDs3cL4RBjLbLXc2pYvGH+imGVu5b4RMAttUTdnmW2UH0t11QeBTXZ7wlXPS7hrypO/tg==",
"requires": {
"node-forge": "^0.9.0"
}
},
"gtoken": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.3.tgz",
"integrity": "sha512-Nyd1wZCMRc2dj/mAD0LlfQLcAO06uKdpKJXvK85SGrF5+5+Bpfil9u/2aw35ltvEHjvl0h5FMKN5knEU+9JrOg==",
"requires": {
"gaxios": "^3.0.0",
"google-p12-pem": "^3.0.0",
"jws": "^4.0.0",
"mime": "^2.2.0"
}
},
"json-bigint": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
"integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
"requires": {
"bignumber.js": "^9.0.0"
}
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"mime": {
"version": "2.4.6",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz",
"integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
},
"google-gax": {
@ -3250,6 +3295,24 @@
"retry-request": "^4.0.0",
"semver": "^6.0.0",
"walkdir": "^0.4.0"
},
"dependencies": {
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
}
}
}
},
"google-p12-pem": {
@ -3283,9 +3346,9 @@
},
"dependencies": {
"mime": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
"integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA=="
"version": "2.4.6",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz",
"integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA=="
}
}
},
@ -3812,12 +3875,12 @@
"lodash.at": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.at/-/lodash.at-4.6.0.tgz",
"integrity": "sha512-GOTh0SEp+Yosnlpjic+8cl2WM9MykorogkGA9xyIFkkObQ3H3kNZqZ+ohuq4K3FrSVo7hMcZBMataJemrxC3BA=="
"integrity": "sha1-k83OZk8KGZTqM9181A4jr9EbD/g="
},
"lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
},
"lodash.get": {
"version": "4.4.2",
@ -3828,7 +3891,7 @@
"lodash.has": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz",
"integrity": "sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g=="
"integrity": "sha1-0Z9NwQlQWMzL4rDN9O4P5Ko3yGI="
},
"lodash.memoize": {
"version": "4.1.2",
@ -3873,28 +3936,16 @@
}
},
"logger-sharelatex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.1.1.tgz",
"integrity": "sha512-qqSrBqUgHWnStxtTZ/fSsqPxj9Ju9onok7Vfm3bv5MS702jH+hRsCSA9oXOMvOLcWJrZFnhCZaLGeOvXToUaxw==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.2.0.tgz",
"integrity": "sha512-ko+OmE25XHJJCiz1R9EgwlfM7J/5olpunUfR3WcfuqOQrcUqsdBrDA2sOytngT0ViwjCR0Fh4qZVPwEWfmrvwA==",
"requires": {
"@google-cloud/logging-bunyan": "^3.0.0",
"@overleaf/o-error": "^3.0.0",
"bunyan": "^1.8.14",
"node-fetch": "^2.6.0",
"raven": "^2.6.4",
"yn": "^4.0.0"
},
"dependencies": {
"bunyan": {
"version": "1.8.14",
"resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
"integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
"requires": {
"dtrace-provider": "~0.8",
"moment": "^2.19.3",
"mv": "~2",
"safe-json-stringify": "~1"
}
}
}
},
"loglevel": {
@ -4009,13 +4060,13 @@
"integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g=="
},
"md5": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
"integrity": "sha512-PlGG4z5mBANDGCKsYQe0CaUYHdZYZt8ZPZLmEt+Urf0W4GlpTX4HescwHU+dc9+Z/G/vZKYZYFrwgm9VxK6QOQ==",
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
"integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
"requires": {
"charenc": "~0.0.1",
"crypt": "~0.0.1",
"is-buffer": "~1.1.1"
"charenc": "0.0.2",
"crypt": "0.0.2",
"is-buffer": "~1.1.6"
},
"dependencies": {
"is-buffer": {
@ -4737,9 +4788,9 @@
"dev": true
},
"prettier": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
"integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
"dev": true
},
"prettier-eslint": {
@ -4938,6 +4989,12 @@
"mimic-fn": "^1.0.0"
}
},
"prettier": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
"dev": true
},
"restore-cursor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
@ -5333,9 +5390,9 @@
}
},
"protobufjs": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.9.0.tgz",
"integrity": "sha512-LlGVfEWDXoI/STstRDdZZKb/qusoAWUnmLg9R8OLSO473mBLWHowx8clbX5/+mKDEI+v7GzjoK9tRPZMMcoTrg==",
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.1.tgz",
"integrity": "sha512-pb8kTchL+1Ceg4lFd5XUpK8PdWacbvV5SK2ULH2ebrYtl4GjJmS24m6CKME67jzV53tbJxHlnNOSqQHbTsR9JQ==",
"requires": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
@ -5455,12 +5512,12 @@
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha512-+IJOX0OqlHCszo2mBUq+SrEbCj6w7Kpffqx60zYbPTFaO4+yYgRjHwcZNpWvaTylDHaV7PPmBHzSecZiMhtPgw=="
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
},
"stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg=="
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
},
"uuid": {
"version": "3.3.2",
@ -6221,22 +6278,15 @@
}
},
"teeny-request": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.2.tgz",
"integrity": "sha512-B6fxA0fSnY/bul06NggdN1nywtr5U5Uvt96pHfTi8pi4MNe6++VUWcAAFBrcMeha94s+gULwA5WvagoSZ+AcYg==",
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.3.tgz",
"integrity": "sha512-TZG/dfd2r6yeji19es1cUIwAlVD8y+/svB1kAC2Y0bjEyysrfbO8EZvJBRwIE6WkwmUoB7uvWLwTIhJbMXZ1Dw==",
"requires": {
"http-proxy-agent": "^4.0.0",
"https-proxy-agent": "^5.0.0",
"node-fetch": "^2.2.0",
"stream-events": "^1.0.5",
"uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
}
"uuid": "^7.0.0"
}
},
"text-table": {
@ -6261,7 +6311,7 @@
"timed-out": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
"integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA=="
"integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8="
},
"timekeeper": {
"version": "2.2.0",
@ -6303,7 +6353,7 @@
"to-no-case": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/to-no-case/-/to-no-case-1.0.2.tgz",
"integrity": "sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg=="
"integrity": "sha1-xyKQcWTvaxeBMsjmmTAhLRtKoWo="
},
"to-regex-range": {
"version": "5.0.1",
@ -6317,7 +6367,7 @@
"to-snake-case": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/to-snake-case/-/to-snake-case-1.0.0.tgz",
"integrity": "sha512-joRpzBAk1Bhi2eGEYBjukEWHOe/IvclOkiJl3DtA91jV6NwQ3MwXA4FHYeqk8BNp/D8bmi9tcNbRu/SozP0jbQ==",
"integrity": "sha1-znRpE4l5RgGah+Yu366upMYIq4w=",
"requires": {
"to-space-case": "^1.0.0"
}
@ -6325,7 +6375,7 @@
"to-space-case": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/to-space-case/-/to-space-case-1.0.0.tgz",
"integrity": "sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==",
"integrity": "sha1-sFLar7Gysp3HcM6gFj5ewOvJ/Bc=",
"requires": {
"to-no-case": "^1.0.0"
}
@ -6482,6 +6532,11 @@
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA=="
},
"uuid": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg=="
},
"v8-compile-cache": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz",

View file

@ -13,7 +13,7 @@
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"start": "node $NODE_APP_OPTIONS app.js",
"nodemon": "nodemon --config nodemon.json",
"lint": "node_modules/.bin/eslint app test *.js",
"lint": "node_modules/.bin/eslint --max-warnings 0 .",
"format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
"format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
@ -27,7 +27,7 @@
"fast-crc32c": "^2.0.0",
"glob": "^7.1.6",
"lodash.once": "^4.1.1",
"logger-sharelatex": "^2.1.1",
"logger-sharelatex": "^2.2.0",
"metrics-sharelatex": "^2.7.0",
"node-uuid": "~1.4.8",
"range-parser": "^1.2.1",
@ -46,18 +46,19 @@
"chai-as-promised": "^7.1.1",
"disrequire": "^1.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-config-prettier": "^6.10.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-chai-expect": "^2.1.0",
"eslint-plugin-chai-friendly": "^0.6.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-chai-friendly": "^0.5.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-mocha": "^6.3.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"mocha": "7.2.0",
"mongodb": "^3.5.9",
"prettier": "^2.0.0",
"prettier-eslint": "^9.0.2",
"prettier-eslint-cli": "^5.0.0",
"sandboxed-module": "2.0.4",

View file

@ -33,7 +33,7 @@ class FilestoreApp {
this.server = this.app.listen(
Settings.internal.filestore.port,
'localhost',
err => {
(err) => {
if (err) {
return reject(err)
}
@ -110,7 +110,7 @@ class FilestoreApp {
// unload the app, as we may be doing this on multiple runs with
// different settings, which affect startup in some cases
const files = await fsReaddir(Path.resolve(__dirname, '../../../app/js'))
files.forEach(file => {
files.forEach((file) => {
disrequire(Path.resolve(__dirname, '../../../app/js', file))
})
disrequire(Path.resolve(__dirname, '../../../app'))

View file

@ -29,7 +29,7 @@ if (!process.env.AWS_ACCESS_KEY_ID) {
throw new Error('please provide credentials for the AWS S3 test server')
}
process.on('unhandledRejection', e => {
process.on('unhandledRejection', (e) => {
// eslint-disable-next-line no-console
console.log('** Unhandled Promise Rejection **\n', e)
throw e
@ -51,7 +51,7 @@ describe('Filestore', function() {
const badSockets = []
for (const socket of stdout.split('\n')) {
const fields = socket.split(' ').filter(part => part !== '')
const fields = socket.split(' ').filter((part) => part !== '')
if (
fields.length > 2 &&
parseInt(fields[1]) &&
@ -79,7 +79,7 @@ describe('Filestore', function() {
}
// redefine the test suite for every available backend
Object.keys(BackendSettings).forEach(backend => {
Object.keys(BackendSettings).forEach((backend) => {
describe(backend, function () {
let app, previousEgress, previousIngress, metricPrefix, projectId
@ -433,7 +433,7 @@ describe('Filestore', function() {
for (let i = 0; i < 5; i++) {
// test is not 100% reliable, so repeat
// create a new connection and have it time out before reading any data
await new Promise(resolve => {
await new Promise((resolve) => {
const streamThatHangs = new Stream.PassThrough()
const stream = request({ url: fileUrl, timeout: 1000 })
stream.pipe(streamThatHangs)

View file

@ -25,7 +25,7 @@ async function getMetric(filestoreUrl, metric) {
function streamToString(stream) {
const chunks = []
return new Promise((resolve, reject) => {
stream.on('data', chunk => chunks.push(chunk))
stream.on('data', (chunk) => chunks.push(chunk))
stream.on('error', reject)
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')))
stream.resume()

View file

@ -104,7 +104,7 @@ describe('FileController', function() {
it('should send a 200 if the cacheWarm param is true', function (done) {
req.query.cacheWarm = true
res.sendStatus = statusCode => {
res.sendStatus = (statusCode) => {
statusCode.should.equal(200)
done()
}
@ -220,7 +220,7 @@ describe('FileController', function() {
new Errors.NotFoundError({ message: 'not found', info: {} })
)
res.sendStatus = code => {
res.sendStatus = (code) => {
expect(code).to.equal(404)
done()
}
@ -238,7 +238,7 @@ describe('FileController', function() {
describe('insertFile', function () {
it('should send bucket name key and res to PersistorManager', function (done) {
res.sendStatus = code => {
res.sendStatus = (code) => {
expect(FileHandler.insertFile).to.have.been.calledWith(bucket, key, req)
expect(code).to.equal(200)
done()
@ -262,7 +262,7 @@ describe('FileController', function() {
})
it('should send bucket name and both keys to PersistorManager', function (done) {
res.sendStatus = code => {
res.sendStatus = (code) => {
code.should.equal(200)
expect(PersistorManager.copyObject).to.have.been.calledWith(
bucket,
@ -278,7 +278,7 @@ describe('FileController', function() {
PersistorManager.copyObject.rejects(
new Errors.NotFoundError({ message: 'not found', info: {} })
)
res.sendStatus = code => {
res.sendStatus = (code) => {
code.should.equal(404)
done()
}
@ -287,7 +287,7 @@ describe('FileController', function() {
it('should send an error if there was an error', function (done) {
PersistorManager.copyObject.rejects(error)
FileController.copyFile(req, res, err => {
FileController.copyFile(req, res, (err) => {
expect(err).to.equal(error)
done()
})
@ -296,7 +296,7 @@ describe('FileController', function() {
describe('delete file', function () {
it('should tell the file handler', function (done) {
res.sendStatus = code => {
res.sendStatus = (code) => {
code.should.equal(204)
expect(FileHandler.deleteFile).to.have.been.calledWith(bucket, key)
done()
@ -313,7 +313,7 @@ describe('FileController', function() {
describe('delete project', function () {
it('should tell the file handler', function (done) {
res.sendStatus = code => {
res.sendStatus = (code) => {
code.should.equal(204)
expect(FileHandler.deleteProject).to.have.been.calledWith(bucket, key)
done()
@ -331,7 +331,7 @@ describe('FileController', function() {
describe('directorySize', function () {
it('should return total directory size bytes', function (done) {
FileController.directorySize(req, {
json: result => {
json: (result) => {
expect(result['total bytes']).to.equal(fileSize)
done()
}

View file

@ -93,7 +93,7 @@ describe('FileHandler', function() {
const stream = 'stream'
it('should send file to the filestore', function (done) {
FileHandler.insertFile(bucket, key, stream, err => {
FileHandler.insertFile(bucket, key, stream, (err) => {
expect(err).not.to.exist
expect(PersistorManager.sendStream).to.have.been.calledWith(
bucket,
@ -105,7 +105,7 @@ describe('FileHandler', function() {
})
it('should not make a delete request for the convertedKey folder', function (done) {
FileHandler.insertFile(bucket, key, stream, err => {
FileHandler.insertFile(bucket, key, stream, (err) => {
expect(err).not.to.exist
expect(PersistorManager.deleteDirectory).not.to.have.been.called
done()
@ -116,7 +116,7 @@ describe('FileHandler', function() {
KeyBuilder.getConvertedFolderKey.returns(
'5ecba29f1a294e007d0bccb4/v/0/pdf'
)
FileHandler.insertFile(bucket, key, stream, err => {
FileHandler.insertFile(bucket, key, stream, (err) => {
expect(err).not.to.exist
done()
})
@ -124,7 +124,7 @@ describe('FileHandler', function() {
it('should throw an error when the key is in the wrong format', function (done) {
KeyBuilder.getConvertedFolderKey.returns('wombat')
FileHandler.insertFile(bucket, key, stream, err => {
FileHandler.insertFile(bucket, key, stream, (err) => {
expect(err).to.exist
done()
})
@ -136,7 +136,7 @@ describe('FileHandler', function() {
})
it('should delete the convertedKey folder', function (done) {
FileHandler.insertFile(bucket, key, stream, err => {
FileHandler.insertFile(bucket, key, stream, (err) => {
expect(err).not.to.exist
expect(PersistorManager.deleteDirectory).to.have.been.calledWith(
bucket,
@ -150,7 +150,7 @@ describe('FileHandler', function() {
describe('deleteFile', function () {
it('should tell the filestore manager to delete the file', function (done) {
FileHandler.deleteFile(bucket, key, err => {
FileHandler.deleteFile(bucket, key, (err) => {
expect(err).not.to.exist
expect(PersistorManager.deleteObject).to.have.been.calledWith(
bucket,
@ -161,7 +161,7 @@ describe('FileHandler', function() {
})
it('should not tell the filestore manager to delete the cached folder', function (done) {
FileHandler.deleteFile(bucket, key, err => {
FileHandler.deleteFile(bucket, key, (err) => {
expect(err).not.to.exist
expect(PersistorManager.deleteDirectory).not.to.have.been.called
done()
@ -172,7 +172,7 @@ describe('FileHandler', function() {
KeyBuilder.getConvertedFolderKey.returns(
'5ecba29f1a294e007d0bccb4/v/0/pdf'
)
FileHandler.deleteFile(bucket, key, err => {
FileHandler.deleteFile(bucket, key, (err) => {
expect(err).not.to.exist
done()
})
@ -180,7 +180,7 @@ describe('FileHandler', function() {
it('should throw an error when the key is in the wrong format', function (done) {
KeyBuilder.getConvertedFolderKey.returns('wombat')
FileHandler.deleteFile(bucket, key, err => {
FileHandler.deleteFile(bucket, key, (err) => {
expect(err).to.exist
done()
})
@ -192,7 +192,7 @@ describe('FileHandler', function() {
})
it('should delete the convertedKey folder', function (done) {
FileHandler.deleteFile(bucket, key, err => {
FileHandler.deleteFile(bucket, key, (err) => {
expect(err).not.to.exist
expect(PersistorManager.deleteDirectory).to.have.been.calledWith(
bucket,
@ -206,7 +206,7 @@ describe('FileHandler', function() {
describe('deleteProject', function () {
it('should tell the filestore manager to delete the folder', function (done) {
FileHandler.deleteProject(bucket, projectKey, err => {
FileHandler.deleteProject(bucket, projectKey, (err) => {
expect(err).not.to.exist
expect(PersistorManager.deleteDirectory).to.have.been.calledWith(
bucket,
@ -217,7 +217,7 @@ describe('FileHandler', function() {
})
it('should throw an error when the key is in the wrong format', function (done) {
FileHandler.deleteProject(bucket, 'wombat', err => {
FileHandler.deleteProject(bucket, 'wombat', (err) => {
expect(err).to.exist
done()
})
@ -235,7 +235,7 @@ describe('FileHandler', function() {
it('should pass options through to PersistorManager', function (done) {
const options = { start: 0, end: 8 }
FileHandler.getFile(bucket, key, options, err => {
FileHandler.getFile(bucket, key, options, (err) => {
expect(err).not.to.exist
expect(PersistorManager.getObjectStream).to.have.been.calledWith(
bucket,
@ -305,7 +305,7 @@ describe('FileHandler', function() {
describe('when a style is defined', function () {
it('generates a thumbnail when requested', function (done) {
FileHandler.getFile(bucket, key, { style: 'thumbnail' }, err => {
FileHandler.getFile(bucket, key, { style: 'thumbnail' }, (err) => {
expect(err).not.to.exist
expect(FileConverter.promises.thumbnail).to.have.been.called
expect(FileConverter.promises.preview).not.to.have.been.called
@ -314,7 +314,7 @@ describe('FileHandler', function() {
})
it('generates a preview when requested', function (done) {
FileHandler.getFile(bucket, key, { style: 'preview' }, err => {
FileHandler.getFile(bucket, key, { style: 'preview' }, (err) => {
expect(err).not.to.exist
expect(FileConverter.promises.thumbnail).not.to.have.been.called
expect(FileConverter.promises.preview).to.have.been.called
@ -385,7 +385,7 @@ describe('FileHandler', function() {
describe('getDirectorySize', function () {
it('should call the filestore manager to get directory size', function (done) {
FileHandler.getDirectorySize(bucket, key, err => {
FileHandler.getDirectorySize(bucket, key, (err) => {
expect(err).not.to.exist
expect(PersistorManager.directorySize).to.have.been.calledWith(
bucket,

View file

@ -29,7 +29,7 @@ describe('ImageOptimiser', function() {
describe('compressPng', function () {
it('should convert the file', function (done) {
ImageOptimiser.compressPng(sourcePath, err => {
ImageOptimiser.compressPng(sourcePath, (err) => {
expect(err).not.to.exist
expect(SafeExec.promises).to.have.been.calledWith([
'optipng',
@ -41,7 +41,7 @@ describe('ImageOptimiser', function() {
it('should return the error', function (done) {
SafeExec.promises.rejects('wombat herding failure')
ImageOptimiser.compressPng(sourcePath, err => {
ImageOptimiser.compressPng(sourcePath, (err) => {
expect(err.toString()).to.equal('wombat herding failure')
done()
})
@ -54,7 +54,7 @@ describe('ImageOptimiser', function() {
beforeEach(function (done) {
SafeExec.promises.rejects(expectedError)
ImageOptimiser.compressPng(sourcePath, err => {
ImageOptimiser.compressPng(sourcePath, (err) => {
error = err
done()
})

View file

@ -57,7 +57,7 @@ describe('LocalFileWriter', function() {
})
it('should wrap the error', function () {
LocalFileWriter.writeStream(readStream, filename, err => {
LocalFileWriter.writeStream(readStream, filename, (err) => {
expect(err).to.exist
expect(err.cause).to.equal(error)
})
@ -73,7 +73,7 @@ describe('LocalFileWriter', function() {
describe('deleteFile', function () {
it('should unlink the file', function (done) {
LocalFileWriter.deleteFile(fsPath, err => {
LocalFileWriter.deleteFile(fsPath, (err) => {
expect(err).not.to.exist
expect(fs.unlink).to.have.been.calledWith(fsPath)
done()
@ -81,7 +81,7 @@ describe('LocalFileWriter', function() {
})
it('should not call unlink with an empty path', function (done) {
LocalFileWriter.deleteFile('', err => {
LocalFileWriter.deleteFile('', (err) => {
expect(err).not.to.exist
expect(fs.unlink).not.to.have.been.called
done()
@ -92,7 +92,7 @@ describe('LocalFileWriter', function() {
const error = new Error('file not found')
error.code = 'ENOENT'
fs.unlink = sinon.stub().yields(error)
LocalFileWriter.deleteFile(fsPath, err => {
LocalFileWriter.deleteFile(fsPath, (err) => {
expect(err).not.to.exist
done()
})
@ -101,7 +101,7 @@ describe('LocalFileWriter', function() {
it('should wrap the error', function (done) {
const error = new Error('failed to reticulate splines')
fs.unlink = sinon.stub().yields(error)
LocalFileWriter.deleteFile(fsPath, err => {
LocalFileWriter.deleteFile(fsPath, (err) => {
expect(err).to.exist
expect(err.cause).to.equal(error)
done()

View file

@ -35,14 +35,14 @@ describe('SafeExec', function() {
it('should error when conversions are disabled', function (done) {
settings.enableConversions = false
safeExec(['/bin/echo', 'hello'], options, err => {
safeExec(['/bin/echo', 'hello'], options, (err) => {
expect(err).to.exist
done()
})
})
it('should execute a command with non-zero exit status', function (done) {
safeExec(['/usr/bin/env', 'false'], options, err => {
safeExec(['/usr/bin/env', 'false'], options, (err) => {
expect(err).to.exist
expect(err.name).to.equal('FailedCommandError')
expect(err.code).to.equal(1)
@ -53,7 +53,7 @@ describe('SafeExec', function() {
})
it('should handle an invalid command', function (done) {
safeExec(['/bin/foobar'], options, err => {
safeExec(['/bin/foobar'], options, (err) => {
err.code.should.equal('ENOENT')
done()
})
@ -63,7 +63,7 @@ describe('SafeExec', function() {
safeExec(
['/bin/sleep', '10'],
{ timeout: 500, killSignal: 'SIGTERM' },
err => {
(err) => {
expect(err).to.exist
expect(err.name).to.equal('FailedCommandError')
expect(err.code).to.equal('SIGTERM')