From 1b6e685d7013d388309ddd04139b2b050df00c2f Mon Sep 17 00:00:00 2001 From: Dimitrios Vasilas Date: Fri, 13 Nov 2026 14:11:23 +0200 Subject: [PATCH 1/2] CLDSRV-1035: Apply the configured KMIP cluster retries The value was checked but never assigned: a non-zero value gave no retry, and 0 gave a retry on every other host. --- lib/Config.js | 7 +++-- tests/unit/testConfigs/parseKmsKmip.js | 41 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 tests/unit/testConfigs/parseKmsKmip.js diff --git a/lib/Config.js b/lib/Config.js index 9faea9e96a..bf7732b2bc 100644 --- a/lib/Config.js +++ b/lib/Config.js @@ -834,11 +834,12 @@ class Config extends EventEmitter { if (Array.isArray(config.kmip.transport)) { this.kmip.transport = config.kmip.transport.map(t => this._parseKmipTransport(t)); - if (config.kmip.retries) { - assert(typeof config.kmip.retries === 'number', - 'bad config: KMIP Cluster retries must be a number'); + if (config.kmip.retries !== undefined) { + assert(Number.isInteger(config.kmip.retries) && config.kmip.retries >= 0, + 'bad config: KMIP Cluster retries must be a non-negative integer'); assert(config.kmip.retries <= this.kmip.transport.length - 1, 'bad config: KMIP Cluster retries must be lower or equal to the number of hosts - 1'); + this.kmip.retries = config.kmip.retries; } else { this.kmip.retries = this.kmip.transport.length - 1; } diff --git a/tests/unit/testConfigs/parseKmsKmip.js b/tests/unit/testConfigs/parseKmsKmip.js new file mode 100644 index 0000000000..eea2359c77 --- /dev/null +++ b/tests/unit/testConfigs/parseKmsKmip.js @@ -0,0 +1,41 @@ +const assert = require('assert'); + +const { ConfigObject: Config } = require('../../../lib/Config'); + +function kmipCluster(retries) { + return { + providerName: 'thales', + transport: [{ tls: { host: 'kmip1' } }, { tls: { host: 'kmip2' } }, { tls: { host: 'kmip3' } }], + retries, + }; +} + +describe('parseKmsKmip Function', () => { + let configInstance; + + beforeEach(() => { + configInstance = new Config(); + }); + + it('should default cluster retries to the number of hosts - 1', () => { + configInstance._parseKmsKmip({ kmip: kmipCluster(undefined) }); + assert.strictEqual(configInstance.kmip.retries, 2); + }); + + it('should use the configured cluster retries', () => { + configInstance._parseKmsKmip({ kmip: kmipCluster(1) }); + assert.strictEqual(configInstance.kmip.retries, 1); + }); + + it('should use cluster retries configured to 0', () => { + configInstance._parseKmsKmip({ kmip: kmipCluster(0) }); + assert.strictEqual(configInstance.kmip.retries, 0); + }); + + it('should reject cluster retries above the number of hosts - 1', () => { + assert.throws( + () => configInstance._parseKmsKmip({ kmip: kmipCluster(3) }), + /KMIP Cluster retries must be lower or equal to the number of hosts - 1/, + ); + }); +}); From 17373d345c7ce98ffd344d6a8a55e2538af28dac Mon Sep 17 00:00:00 2001 From: Dimitrios Vasilas Date: Fri, 13 Nov 2026 14:11:23 +0200 Subject: [PATCH 2/2] CLDSRV-1035: Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8402da7932..599c6d613c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zenko/cloudserver", - "version": "9.2.43", + "version": "9.2.44", "description": "Zenko CloudServer, an open-source Node.js implementation of a server handling the Amazon S3 protocol", "main": "index.js", "engines": {