Skip to content

Commit

Permalink
fixups post reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Jan 7, 2025
1 parent a04735b commit 44ed300
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 22 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ jobs:
sudo sh -c "echo '127.0.0.1 testrequestbucket.localhost' >> /etc/hosts"
- name: test and coverage
run: yarn --silent coverage
env:
NODE_OPTIONS: "--tls-max-v1.2"
- name: run functional tests
run: yarn ft_test
- uses: codecov/codecov-action@v4
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ console.log(errors.AccessDenied);
## Build Status

![Public Build Status][badgepub]
![Private Build Status][badgepriv]

## Codecov Status

![codecov][codecov]

## Clustering

Expand Down Expand Up @@ -152,4 +155,4 @@ to the process (which results in an immediate termination, and this signal
can't be caught).

[badgepub]: https://circleci.com/gh/scality/Arsenal.svg?style=svg
[badgepriv]: http://ci.ironmann.io/gh/scality/Arsenal.svg?style=svg&circle-token=c3d2570682cba6763a97ea0bc87521941413d75c
[codecov]: https://codecov.io/gh/scality/Arsenal/branch/main/graph/badge.svg
2 changes: 1 addition & 1 deletion lib/network/kmip/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export default class Client {
KMIP.Structure('Template-Attribute', attributes),
], (err, response) => {
if (err) {
const error = arsenalErrorKMIP(JSON.stringify(err));
const error = arsenalErrorKMIP(err);
logger.error('KMIP::createBucketKey',
{ error,
serverInformation: this.serverInformation });
Expand Down
7 changes: 6 additions & 1 deletion lib/network/kmip/transport/TransportTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ export default class TransportTemplate {
readyCallback: (error: Error | null) => void,
) {
try {
const options = {
...this.options.tls,
host: '127.0.0.1',
family: 4,
};
const socket = this.channel.connect(
this.options.tls.port || DEFAULT_KMIP_PORT,
this.options.tls,
options,
() => {
if (this.handshakeFunction) {
this.handshakeFunction(logger, readyCallback);
Expand Down
2 changes: 0 additions & 2 deletions lib/network/rpc/sio-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ class SIOStreamSocket {
encodedObj = {};
// user objects are simple flat objects and we want to
// copy all their properties

for (const k in arg) {
encodedObj[k] = this.encodeStreams(arg[k]);
}
Expand Down Expand Up @@ -415,7 +414,6 @@ class SIOStreamSocket {
decodedObj = {};
// user objects are simple flat objects and we want to
// copy all their properties

for (const k in arg) {
decodedObj[k] = this.decodeStreams(arg[k]);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/policyEvaluator/requestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export function getClientIp(request: IncomingMessage, s3config?: S3Config): stri
const requestConfig = s3config?.requests;
const remoteAddress = request.socket.remoteAddress;
// TODO What to do if clientIp === undefined ?
const clientIp = (requestConfig ? remoteAddress : request.headers['x-forwarded-for'] ||
remoteAddress)?.toString() ?? '';
const clientIp = remoteAddress?.toString() ?? '';
if (requestConfig) {
const { trustedProxyCIDRs, extractClientIPFromHeader } = requestConfig;
/**
Expand Down
4 changes: 2 additions & 2 deletions lib/s3routes/routesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ export const XMLResponseBackend = {
xml.push(
'<?xml version="1.0" encoding="UTF-8"?>',
'<Error>',
`<Code>${errCode.message}</Code>`,
`<Message>${errCode.description}</Message>`,
`<Code>${error.message}</Code>`,
`<Message>${error.description}</Message>`,
);
const invalidArguments = error.metadata.get('invalidArguments') || [];
invalidArguments.forEach((invalidArgument, index) => {
Expand Down
1 change: 0 additions & 1 deletion lib/storage/metadata/mongoclient/LogConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class LogConsumer {
const client = new MongoClient(this._mongoUrl, {

Check warning on line 39 in lib/storage/metadata/mongoclient/LogConsumer.js

View check run for this annotation

Codecov / codecov/patch

lib/storage/metadata/mongoclient/LogConsumer.js#L39

Added line #L39 was not covered by tests
replicaSet: this._replicaSet,
useNewUrlParser: true,
useUnifiedTopology: true,
readPreference: this._readPreference,
});

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"diskusage": "^1.2.0",
"fcntl": "github:scality/node-fcntl#0.2.2",
"hdclient": "scality/hdclient#1.1.7",
"httpagent": "scality/httpagent#1.0.6",
"httpagent": "scality/httpagent#1.1.0",
"https-proxy-agent": "^7.0.5",
"ioredis": "^5.4.1",
"ipaddr.js": "^2.2.0",
Expand All @@ -52,7 +52,7 @@
"sproxydclient": "github:scality/sproxydclient#8.1.0",
"utf8": "^3.0.0",
"uuid": "^10.0.0",
"werelogs": "scality/werelogs#8.2.0",
"werelogs": "scality/werelogs#8.2.2",
"xml2js": "^0.6.2"
},
"optionalDependencies": {
Expand Down Expand Up @@ -85,11 +85,11 @@
"lint": "eslint $(git ls-files '*ts' ' *.js')",
"lint_md": "mdlint $(git ls-files '*.md')",
"lint_yml": "yamllint $(git ls-files '*.yml')",
"test": "jest tests/unit --detectOpenHandles",
"test": "export NODE_OPTIONS=\"--tls-max-v1.2\" && jest tests/unit --detectOpenHandles",
"build": "tsc",
"prepare": "yarn build",
"ft_test": "jest tests/functional --testTimeout=120000 --forceExit",
"coverage": "nyc --clean jest tests --coverage --testTimeout=120000 --forceExit",
"coverage": "export NODE_OPTIONS=\"--tls-max-v1.2\" && nyc --clean jest tests --coverage --testTimeout=120000 --forceExit",
"build_doc": "cd documentation/listingAlgos/pics; dot -Tsvg delimiterStateChart.dot > delimiterStateChart.svg; dot -Tsvg delimiterMasterV0StateChart.dot > delimiterMasterV0StateChart.svg; dot -Tsvg delimiterVersionsStateChart.dot > delimiterVersionsStateChart.svg"
},
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/policyEvaluator/RequestContext.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,4 @@ describe('RequestContext', () => {
const ssoRC = new RequestContext(...ssoParams);
assert.strictEqual(ssoRC.getResource(), 'arn:scality:sso:::general-resource/specific-resource');
});
});
});
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"declaration": true,
"noImplicitAny": false,
"noEmitOnError": false,
"sourceMap": true,
"skipLibCheck": true,
"sourceMap": true
},
"include": ["index.ts", "lib"],
"exclude": ["node_modules/*"],
Expand Down
11 changes: 9 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4519,13 +4519,13 @@ http-proxy-agent@^7.0.0:
agent-base "^7.1.0"
debug "^4.3.4"

"httpagent@github:scality/httpagent#1.0.6", httpagent@scality/httpagent#1.0.6:
"httpagent@github:scality/httpagent#1.0.6":
version "1.0.6"
resolved "https://codeload.github.com/scality/httpagent/tar.gz/66e97ab93532d79dbddcf6c4ea4df849b84c33c9"
dependencies:
agentkeepalive "^4.2.1"

"httpagent@github:scality/httpagent#1.1.0":
"httpagent@github:scality/httpagent#1.1.0", httpagent@scality/httpagent#1.1.0:
version "1.1.0"
resolved "https://codeload.github.com/scality/httpagent/tar.gz/8f9958eb9cde086db7819a86582fba640a5f8876"
dependencies:
Expand Down Expand Up @@ -7635,6 +7635,13 @@ werelogs@scality/werelogs#8.2.0:
fast-safe-stringify "^2.1.1"
safe-json-stringify "^1.2.0"

werelogs@scality/werelogs#8.2.2:
version "8.2.2"
resolved "https://codeload.github.com/scality/werelogs/tar.gz/e53bef5145697bf8af940dcbe59408988d64854f"
dependencies:
fast-safe-stringify "^2.1.1"
safe-json-stringify "^1.2.0"

whatwg-url@^11.0.0:
version "11.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018"
Expand Down

0 comments on commit 44ed300

Please sign in to comment.