Skip to content

Commit

Permalink
Disable utapi
Browse files Browse the repository at this point in the history
To be re-enabled when utapi is compatible with node 22

Issue: CLDSRV-553
  • Loading branch information
williamlardier committed Feb 13, 2025
1 parent 43f284c commit 7b1565b
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ jobs:
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: /tmp/artifacts
if: always()
if: false

quota-tests:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion lib/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ const {
allowedUtapiEventFilterStates,
supportedLifecycleRules,
} = require('../constants');
const { utapiVersion } = require('utapi');

// TODO CLDSRV-610: re-enable utapi
// const { utapiVersion } = require('utapi');
const utapiVersion = null;

const { scaleMsPerDay } = s3middleware.objectUtils;

const constants = require('../constants');
Expand Down
7 changes: 5 additions & 2 deletions lib/utapi/utapi.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
require('werelogs').stderrUtils.catchAndTimestampStderr();
const _config = require('../Config').config;
const { utapiVersion, UtapiServer: utapiServer } = require('utapi');
// TODO CLDSRV-610 re-enable utapi
/* eslint-disable */
// const { utapiVersion, UtapiServer: utapiServer } = require('utapi');

// start utapi server
if (utapiVersion === 1 && _config.utapi) {
// TODO CLDSRV-610 re-enable utapi
if (utapiVersion === 1 && _config.utapi && false) {

Check warning on line 9 in lib/utapi/utapi.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utapi.js#L9

Added line #L9 was not covered by tests
const fullConfig = Object.assign({}, _config.utapi,
{ redis: _config.redis });
if (_config.vaultd) {
Expand Down
19 changes: 12 additions & 7 deletions lib/utapi/utapiReindex.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
require('werelogs').stderrUtils.catchAndTimestampStderr();
const UtapiReindex = require('utapi').UtapiReindex;
// TODO CLDSRV-610 re-enable utapi
/* eslint-disable */
// const UtapiReindex = require('utapi').UtapiReindex;
const { config } = require('../Config');

const reindexConfig = config.utapi && config.utapi.reindex;
if (reindexConfig && reindexConfig.password === undefined) {
reindexConfig.password = config.utapi && config.utapi.redis
&& config.utapi.redis.password;
// TODO CLDSRV-610 re-enable utapi
if (false) {
const reindexConfig = config.utapi && config.utapi.reindex;
if (reindexConfig && reindexConfig.password === undefined) {
reindexConfig.password = config.utapi && config.utapi.redis

Check warning on line 11 in lib/utapi/utapiReindex.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utapiReindex.js#L8-L11

Added lines #L8 - L11 were not covered by tests
&& config.utapi.redis.password;
}
const reindex = new UtapiReindex(reindexConfig);
reindex.start();

Check warning on line 15 in lib/utapi/utapiReindex.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utapiReindex.js#L14-L15

Added lines #L14 - L15 were not covered by tests
}
const reindex = new UtapiReindex(reindexConfig);
reindex.start();
15 changes: 10 additions & 5 deletions lib/utapi/utapiReplay.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
require('werelogs').stderrUtils.catchAndTimestampStderr();
const UtapiReplay = require('utapi').UtapiReplay;
// TODO CLDSRV-610 re-enable utapi
/* eslint-disable */
// const UtapiReplay = require('utapi').UtapiReplay;
const _config = require('../Config').config;

const utapiConfig = _config.utapi &&
Object.assign({}, _config.utapi, { redis: _config.redis });
const replay = new UtapiReplay(utapiConfig); // start utapi server
replay.start();
// TODO CLDSRV-610 re-enable utapi
if (false) {
const utapiConfig = _config.utapi &&

Check warning on line 9 in lib/utapi/utapiReplay.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utapiReplay.js#L8-L9

Added lines #L8 - L9 were not covered by tests
Object.assign({}, _config.utapi, { redis: _config.redis });
const replay = new UtapiReplay(utapiConfig); // start utapi server
replay.start();

Check warning on line 12 in lib/utapi/utapiReplay.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utapiReplay.js#L11-L12

Added lines #L11 - L12 were not covered by tests
}
39 changes: 25 additions & 14 deletions lib/utapi/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@ const http = require('http');
const https = require('https');
const commander = require('commander');
const { auth } = require('arsenal');
const { UtapiClient, utapiVersion } = require('utapi');
// TODO CLDSRV-610 re-enable utapi
/* eslint-disable */
// const { UtapiClient, utapiVersion } = require('utapi');
const logger = require('../utilities/logger');
const _config = require('../Config').config;
const { suppressedUtapiEventFields: suppressedEventFields } = require('../../constants');
// setup utapi client
let utapiConfig;

if (utapiVersion === 1 && _config.utapi) {
if (_config.utapi.redis === undefined) {
utapiConfig = Object.assign({}, _config.utapi, { redis: _config.redis });
} else {
utapiConfig = Object.assign({}, _config.utapi);
}
} else if (utapiVersion === 2) {
utapiConfig = Object.assign({
tls: _config.https,
suppressedEventFields,
}, _config.utapi || {});
}
// TODO CLDSRV-610 re-enable utapi
// if (utapiVersion === 1 && _config.utapi) {
// if (_config.utapi.redis === undefined) {
// utapiConfig = Object.assign({}, _config.utapi, { redis: _config.redis });
// } else {
// utapiConfig = Object.assign({}, _config.utapi);
// }
// } else if (utapiVersion === 2) {
// utapiConfig = Object.assign({
// tls: _config.https,
// suppressedEventFields,
// }, _config.utapi || {});
// }

const utapi = new UtapiClient(utapiConfig);
// const utapi = new UtapiClient(utapiConfig);

const bucketOwnerMetrics = [
'completeMultipartUpload',
Expand Down Expand Up @@ -257,6 +260,8 @@ function listMetrics(metricType) {
* filtered out and not pushed to utapi.
*/
function pushMetric(action, log, metricObj) {
// TODO CLDSRV-610 re-enable utapi
return;
const {
bucket,
keys,
Expand Down Expand Up @@ -355,6 +360,8 @@ function pushMetric(action, log, metricObj) {
* @return {string} - location unique ID
*/
function _getLocationId(location) {
// TODO CLDSRV-610 re-enable utapi
return;

Check warning on line 364 in lib/utapi/utilities.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utilities.js#L364

Added line #L364 was not covered by tests
return _config.locationConstraints[location].objectId;
}

Expand All @@ -367,6 +374,8 @@ function _getLocationId(location) {
* @return {function} - `utapi.getLocationMetric`
*/
function getLocationMetric(location, log, cb) {
// TODO CLDSRV-610 re-enable utapi
return;

Check warning on line 378 in lib/utapi/utilities.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utilities.js#L378

Added line #L378 was not covered by tests
const locationId = _getLocationId(location);
return utapi.getLocationMetric(locationId, log.getSerializedUids(), cb);
}
Expand All @@ -381,6 +390,8 @@ function getLocationMetric(location, log, cb) {
* @return {function} - `utapi.pushLocationMetric`
*/
function pushLocationMetric(location, byteLength, log, cb) {
// TODO CLDSRV-610 re-enable utapi
return;

Check warning on line 394 in lib/utapi/utilities.js

View check run for this annotation

Codecov / codecov/patch

lib/utapi/utilities.js#L394

Added line #L394 was not covered by tests
const locationId = _getLocationId(location);
return utapi.pushLocationMetric(locationId, byteLength,
log.getSerializedUids(), cb);
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ describe('Config', () => {
process.env.S3_CONFIG_FILE = oldConfig;
});

it('should set up utapi local cache', () => {
// TODO CLDSRV-610 re-enable utapi
it.skip('should set up utapi local cache', () => {
const { ConfigObject } = require('../../lib/Config');
const config = new ConfigObject();

Expand All @@ -484,7 +485,8 @@ describe('Config', () => {
);
});

it('should set up utapi redis', () => {
// TODO CLDSRV-610 re-enable utapi
it.skip('should set up utapi redis', () => {
const { ConfigObject } = require('../../lib/Config');
const config = new ConfigObject();

Expand Down
3 changes: 2 additions & 1 deletion tests/utapi/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ const testEvents = [{
},
}];

describe('utapi v2 pushmetrics utility', () => {
// TODO CLDSRV-610 re-enable utapi
describe.skip('utapi v2 pushmetrics utility', () => {
const log = new werelogs.Logger('utapi-utility');
const { UtapiClient, utapiVersion } = require('utapi');
let pushMetric;
Expand Down

0 comments on commit 7b1565b

Please sign in to comment.