Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"all": true,
"include": ["bin/**/*.js", "lib/**/*.js"],
"exclude": ["tests/**/*.js"],
"temp-directory": "./coverage/tmp"
}
5 changes: 0 additions & 5 deletions .nycrc

This file was deleted.

2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ HA deployments.

- **Framework**: Mocha with Sinon for mocking
- **Timeout**: 40000ms global
- **Coverage**: NYC (Istanbul), 80% patch target
- **Coverage**: c8 (V8 native coverage), 80% patch target
- **Reporters**: mocha-multi-reporters (spec + junit XML)

Run a single test file:
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=24.21.0-bookworm-slim
ARG NODE_VERSION=24.21.0-trixie-slim
Comment thread
francoisferrand marked this conversation as resolved.

FROM node:${NODE_VERSION} AS builder

Expand Down Expand Up @@ -39,8 +39,6 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
jq \
tini \
python3-redis \
python3-requests \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app
Expand All @@ -58,6 +56,7 @@ CMD [ "yarn", "start" ]
################################################################################
FROM production AS testcoverage

RUN yarn global add nyc
# Same c8 version as the devDependency, without bringing the other dev deps
RUN yarn global add c8@$(node -p "require('./package.json').devDependencies.c8")
Comment thread
francoisferrand marked this conversation as resolved.

CMD [ "./docker-test-with-coverage.sh" ]
4 changes: 2 additions & 2 deletions docker-test-with-coverage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

nyc --clean --silent yarn start > /artifacts/s3.log 2> /artifacts/s3-stderr.log &
c8 --reporter=none yarn start > /artifacts/s3.log 2> /artifacts/s3-stderr.log &

PID=$!

Expand All @@ -9,7 +9,7 @@ generate_coverage() {
kill -TERM $PID 2>/dev/null || true
wait $PID
echo 'Generating coverage report...'
nyc report --report-dir /coverage/test --reporter=lcov --reporter=text-summary
c8 report --reports-dir /coverage/test --reporter=lcov --reporter=text-summary
}

trap generate_coverage SIGTERM
Expand Down
2 changes: 2 additions & 0 deletions images/federation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ FROM ghcr.io/scality/cloudserver:${CLOUDSERVER_VERSION}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
supervisor \
python3-redis \
python3-requests \
&& rm -rf /var/lib/apt/lists/*

# Prepare runtime environment
Expand Down
2 changes: 1 addition & 1 deletion lib/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const url = require('url');

const { v4: uuidv4 } = require('uuid');
const cronParser = require('cron-parser');
const joi = require('@hapi/joi');
const joi = require('joi');
const { s3routes, auth: arsenalAuth, s3middleware } = require('@scality/arsenal');
const { isValidBucketName } = s3routes.routesUtils;
const validateAuthConfig = arsenalAuth.inMemory.validateAuthConfig;
Expand Down
2 changes: 1 addition & 1 deletion lib/api/apiUtils/rateLimit/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const { errors, ArsenalError } = require('@scality/arsenal');

const { rateLimitDefaultConfigCacheTTL, rateLimitDefaultBurstCapacity } = require('../../../../constants');
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/routeBackbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const url = require('url');
const async = require('async');
const httpProxy = require('http-proxy');
const querystring = require('querystring');
const joi = require('@hapi/joi');
const joi = require('joi');

const backbeatProxy = httpProxy.createProxyServer({
ignorePath: true,
Expand Down
81 changes: 40 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
"@aws-sdk/s3-request-presigner": "^3.901.0",
"@aws-sdk/signature-v4": "^3.374.0",
"@azure/storage-blob": "^12.28.0",
"@hapi/joi": "^17.1.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/instrumentation-http": "~0.222.0",
"@opentelemetry/instrumentation-ioredis": "~0.70.0",
"@opentelemetry/instrumentation-mongodb": "~0.75.0",
"@scality/arsenal": "8.6.0-preview.5",
"@scality/arsenal": "^8.6.0",
"@scality/bucketclient": "scality/bucketclient#8.3.0",
"@scality/cloudserverclient": "1.0.13",
"@scality/scubaclient": "1.2.1",
"@scality/utapi": "github:scality/utapi#8.4.0",
"@scality/scubaclient": "1.2.2",
"@scality/utapi": "github:scality/utapi#8.4.1",
"@smithy/node-http-handler": "^3.0.0",
"agentkeepalive": "^4.6.0",
"async": "2.6.4",
"aws-crt": "^1.24.0",
"bufferutil": "^4.0.8",
Expand All @@ -48,6 +48,9 @@
"http-proxy": "npm:http-proxy-3@^1.21.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"ioredis": "^5.11.1",
"ipaddr.js": "^2.5.0",
"joi": "^18.0.1",
"moment": "^2.30.1",
"mongodb": "^6.11.0",
"node-fetch": "^2.6.0",
Expand All @@ -66,30 +69,26 @@
"@eslint/compat": "^1.2.2",
"@scality/cloudserverclient": "1.0.13",
"@scality/eslint-config-scality": "scality/Guidelines#8.3.3",
"c8": "^12.0.0",
"eslint": "^9.14.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-mocha": "^10.5.0",
"eslint-plugin-n": "^17.24.0",
"eslint-plugin-promise": "^7.2.1",
"express": "^4.21.1",
"ioredis": "^5.4.1",
"mocha": "^11.7.5",
"mocha-junit-reporter": "^2.2.1",
"mocha-multi-reporters": "^1.5.1",
"mocha": "^12.0.3",
"mocha-multi-reporters": "^1.5.2",
"node-mocks-http": "^1.16.1",
"nodemon": "^3.1.10",
"nyc": "^15.1.0",
"pino-pretty": "^13.1.3",
"prettier": "^3.4.2",
"sinon": "^13.0.1",
"ts-morph": "^28.0.0",
"tv4": "^1.3.0"
},
"resolutions": {
"jsonwebtoken": "^9.0.0",
"fast-xml-parser": "^5.5.6",
"express": "^4.22.3",
"**/request/form-data": "^2.5.6"
"express": "^4.22.3"
},
"countAsyncSourcePaths": [
"lib/**/*.js",
Expand All @@ -106,34 +105,34 @@
"scripts": {
"cloudserver": "S3METADATA=mongodb npm-run-all --parallel start_dataserver start_s3server",
"dev": "nodemon --exec \"yarn run start\" | pino-pretty -c -S -m message -i \"pid,hostname,name,authn,authz,address,clientPort,clientIP,elapsed_ms\"",
"ft_awssdk": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
"ft_awssdk_aws": "cd tests/functional/aws-node-sdk && AWS_ON_AIR=true mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
"ft_awssdk_buckets": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/bucket --exit",
"ft_awssdk_objects_misc": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/legacy test/object test/service test/support --exit",
"ft_awssdk_versioning": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/versioning/ --exit",
"ft_awssdk_external_backends": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/multipleBackend --exit",
"ft_checksums_disabled": "cd tests/functional/checksumsDisabled && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 120000 *.js --exit",
"ft_mixed_bucket_format_version": "cd tests/functional/metadata && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json MixedVersionFormat.js --exit",
"ft_awssdk": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js test/ --exit",
"ft_awssdk_aws": "cd tests/functional/aws-node-sdk && AWS_ON_AIR=true mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js test/ --exit",
"ft_awssdk_buckets": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js test/bucket --exit",
"ft_awssdk_objects_misc": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js test/legacy test/object test/service test/support --exit",
"ft_awssdk_versioning": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js test/versioning/ --exit",
"ft_awssdk_external_backends": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js test/multipleBackend --exit",
"ft_checksums_disabled": "cd tests/functional/checksumsDisabled && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 120000 *.js --exit",
"ft_mixed_bucket_format_version": "cd tests/functional/metadata && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js MixedVersionFormat.js --exit",
"ft_management": "cd tests/functional/report && yarn test",
"ft_backbeat": "cd tests/functional/backbeat && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js --exit",
"ft_backbeat": "cd tests/functional/backbeat && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 40000 *.js --exit",
"ft_node": "cd tests/functional/raw-node && yarn test",
"ft_node_routes": "cd tests/functional/raw-node && yarn run test-routes",
"ft_route_backbeat": "cd tests/multipleBackend/routes && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 routeBackbeat.js routeBackbeatForReplication.js --exit",
"ft_route_backbeat": "cd tests/multipleBackend/routes && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 40000 routeBackbeat.js routeBackbeatForReplication.js --exit",
"ft_gcp": "cd tests/functional/raw-node && yarn run test-gcp",
"cleanup_gcp_buckets": "node .github/scripts/cleanupOldGCPBuckets.js",
"ft_healthchecks": "cd tests/functional/healthchecks && yarn test",
"ft_s3cmd": "cd tests/functional/s3cmd && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js --exit",
"ft_s3curl": "cd tests/functional/s3curl && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js --exit",
"ft_scripts": "cd tests/functional/scripts && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js --exit",
"ft_util": "cd tests/functional/utilities && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js --exit",
"ft_s3cmd": "cd tests/functional/s3cmd && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 40000 *.js --exit",
"ft_s3curl": "cd tests/functional/s3curl && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 40000 *.js --exit",
"ft_scripts": "cd tests/functional/scripts && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 40000 *.js --exit",
"ft_util": "cd tests/functional/utilities && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 40000 *.js --exit",
"ft_test": "npm-run-all -s ft_awssdk ft_s3cmd ft_s3curl ft_node ft_healthchecks ft_management ft_util ft_backbeat",
"ft_search": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 90000 test/mdSearch --exit",
"ft_kmip": "cd tests/functional/kmip && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js --exit",
"ft_kmip_cluster": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 300000 load.js --exit",
"ft_sse_cleanup": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 10000 cleanup.js --exit",
"ft_sse_before_migration": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 10000 cleanup.js beforeMigration.js --exit",
"ft_sse_migration": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 10000 migration.js --exit",
"ft_sse_arn": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 10000 cleanup.js arnPrefix.js --exit",
"ft_search": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 90000 test/mdSearch --exit",
"ft_kmip": "cd tests/functional/kmip && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 40000 *.js --exit",
"ft_kmip_cluster": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 300000 load.js --exit",
"ft_sse_cleanup": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 10000 cleanup.js --exit",
"ft_sse_before_migration": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 10000 cleanup.js beforeMigration.js --exit",
"ft_sse_migration": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 10000 migration.js --exit",
"ft_sse_arn": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 10000 cleanup.js arnPrefix.js --exit",
"lint": "eslint $(git ls-files '*.js')",
"lint_md": "mdlint $(git ls-files '*.md')",
"mem_backend": "S3BACKEND=mem node index.js",
Expand All @@ -148,14 +147,14 @@
"start_metrics_server": "node bin/metrics_server.js",
"utapi_replay": "node lib/utapi/utapiReplay.js",
"utapi_reindex": "node lib/utapi/utapiReindex.js",
"test": "NO_PROXY=\"test.scality.com,scality.com\" CI=true S3BACKEND=mem S3QUOTA=scuba mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json --recursive tests/unit --exit",
"test_versionid_base62": "S3_VERSION_ID_ENCODING_TYPE=base62 CI=true S3BACKEND=mem mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json --recursive tests/unit/api --exit",
"test_legacy_location": "CI=true S3QUOTA=scuba S3_LOCATION_FILE=tests/locationConfig/locationConfigLegacy.json S3BACKEND=mem mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json --recursive tests/unit --exit",
"test_utapi_v2": "mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json --recursive tests/utapi --exit",
"test_sur": "mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json --recursive tests/sur --exit",
"multiple_backend_test": "CI=true S3BACKEND=mem S3METADATA=mem S3DATA=multiple mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 20000 --recursive tests/multipleBackend --exit",
"cover": "nyc --clean --silent yarn run",
"postcover": "nyc report --report-dir ./coverage/test --reporter=lcov",
"test": "NO_PROXY=\"test.scality.com,scality.com\" CI=true S3BACKEND=mem S3QUOTA=scuba mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js --recursive tests/unit --exit",
"test_versionid_base62": "S3_VERSION_ID_ENCODING_TYPE=base62 CI=true S3BACKEND=mem mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js --recursive tests/unit/api --exit",
"test_legacy_location": "CI=true S3QUOTA=scuba S3_LOCATION_FILE=tests/locationConfig/locationConfigLegacy.json S3BACKEND=mem mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js --recursive tests/unit --exit",
"test_utapi_v2": "mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js --recursive tests/utapi --exit",
"test_sur": "mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js --recursive tests/sur --exit",
"multiple_backend_test": "CI=true S3BACKEND=mem S3METADATA=mem S3DATA=multiple mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.js -t 20000 --recursive tests/multipleBackend --exit",
"cover": "c8 --reporter=none yarn run",
"postcover": "c8 report --reports-dir ./coverage/test --reporter=lcov",
"count-async": "node .github/scripts/count-async-functions.mjs",
"check-diff-async": "node .github/scripts/check-diff-async.mjs",
"prettier": "prettier",
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/healthchecks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"scripts": {
"test": "mocha -t 40000 test/ --exit",
"test-debug": "_mocha -t 40000 test/ --exit"
"test-debug": "mocha -t 40000 test/ --exit"
},
"author": ""
}
2 changes: 1 addition & 1 deletion tests/functional/raw-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test-gcp": "mocha -t 40000 test/GCP/ --exit",
"test-routes": "mocha -t 40000 test/routes/ --exit",
"test": "mocha -t 40000 test/ --exit",
"test-debug": "_mocha -t 40000 test/ --exit"
"test-debug": "mocha -t 40000 test/ --exit"
},
"author": "",
"mocha": {
Expand Down
11 changes: 11 additions & 0 deletions tests/reporter-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Name the report after the yarn script, so that runs sharing a directory
// (or copied to a single artifacts folder) do not overwrite each other.
const suite = process.env.npm_lifecycle_event || 'mocha';

module.exports = {
reporterEnabled: 'spec, xunit',
xunitReporterOptions: {
output: `junit/junit-${suite}.xml`,
suiteName: suite,
},
};
6 changes: 0 additions & 6 deletions tests/reporter-config.json

This file was deleted.

Loading
Loading