Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed May 13, 2024
1 parent 667af34 commit 0eebe0e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions tests/functional/countItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ const cluster = require('cluster');
const async = require('async');
const werelogs = require('werelogs');
const { BucketInfo, ObjectMD } = require('arsenal').models;
const { constants, network } = require('arsenal');
const { constants } = require('arsenal');
const S3UtilsMongoClient = require('../../utils/S3UtilsMongoClient');

const CountMaster = require('../../CountItems/CountMaster');
const CountManager = require('../../CountItems/CountManager');
const createMongoParams = require('../../utils/createMongoParams');
const monitoring = require('../../utils/monitoring');
const createWorkers = require('../../CountItems/utils/createWorkers');
const {
testBucketMD, testAccountCanonicalId, testBucketCreationDate, testUserBucketInfo,
Expand All @@ -18,7 +17,6 @@ const logger = new werelogs.Logger('CountItems::Test::Functional');
const { MONGODB_REPLICASET } = process.env;
const dbName = 'countItemsTest';
const USERSBUCKET = '__usersbucket';
const WebServer = network.http.server;

const expectedCountItems = {
objects: 90,
Expand Down Expand Up @@ -192,11 +190,14 @@ jest.setTimeout(120000);
describe('CountItems', () => {
const oldEnv = process.env;
let client;
const webServer = new WebServer(8003, logger);
let metricsStub;

beforeAll(done => {
process.env = oldEnv;
process.env.MONGODB_DATABASE = dbName;
metricsStub = {
start: sinon.stub(),

Check failure on line 199 in tests/functional/countItems.js

View workflow job for this annotation

GitHub Actions / tests

'sinon' is not defined
};

const opts = {
replicaSetHosts: MONGODB_REPLICASET,
Expand Down Expand Up @@ -236,16 +237,9 @@ describe('CountItems', () => {
maxConcurrent: 5,
}),
client: new S3UtilsMongoClient(createMongoParams(logger)),
metrics: webServer,
metrics: metricsStub,
});

webServer.onRequest((req, res) => monitoring.metricsHandler(
countMaster,
() => process.exit(1),
req,
res,
));

async.series([
next => countMaster.start(err => {
expect(err).toBeFalsy();
Expand Down

0 comments on commit 0eebe0e

Please sign in to comment.