Skip to content

Commit

Permalink
BB-295 - fix functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerkesni committed Jan 4, 2023
1 parent d713e16 commit 4b4967b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ jobs:
BACKBEAT_CONFIG_FILE: "tests/config.json"
- name: run backbeat notification feature tests
run: yarn run ft_test:notification

- name: run ballooning tests for lifecycle conductor
run: yarn jest tests/performance/lifecycle/conductor-check-memory-balloon.js
run: .github/scripts/run_ft_tests.bash perf_test:lifecycle
env:
# Constrain heap long-lived heap size to 150MB, so that pushing 200K messages
# Constrain heap long-lived heap size to 200MB, so that pushing 200K messages
# will crash if they end up in memory all at the same time (circuit breaking
# ineffective) while waiting to be committed to the kafka topic.
NODE_OPTIONS: '--max-old-space-size=150'
NODE_OPTIONS: '--max-old-space-size=200'
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"ft_test:ingestion": "jest /functional/ingestion --forceExit --testTimeout 30000",
"ft_test:api:routes": "jest /functional/api/routes.spec.js --forceExit --testTimeout 30000",
"ft_test:api:retry": "jest /functional/api/retry.spec.js --forceExit --testTimeout 30000",
"perf_test:lifecycle": "jest /performance/lifecycle/ --forceExit --testTimeout 30000",
"bh_test": "jest /behavior",
"lint": "eslint $(git ls-files '*.js')",
"lint_md": "mdlint $(git ls-files '[^bucket-scanner/]*.md')",
Expand Down
12 changes: 6 additions & 6 deletions tests/functional/lib/BackbeatClient.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('BackbeatClient unit tests with mock server', () => {
const destReq = backbeatClient.getRaftId({
Bucket: bucketName,
});
return destReq.send((err, data) => {
destReq.send((err, data) => {
assert.ifError(err);
assert.strictEqual(data[0], '1');
return done();
Expand All @@ -80,7 +80,7 @@ describe('BackbeatClient unit tests with mock server', () => {
const destReq = backbeatClient.getRaftLog({
LogId: '1',
});
return destReq.send((err, data) => {
destReq.send((err, data) => {
assert.ifError(err);
assert.deepStrictEqual(data, expectedLogs);
return done();
Expand All @@ -91,7 +91,7 @@ describe('BackbeatClient unit tests with mock server', () => {
const destReq = backbeatClient.getBucketMetadata({
Bucket: bucketName,
});
return destReq.send((err, data) => {
destReq.send((err, data) => {
assert.ifError(err);
const bucketMd = dummyBucketMD[bucketName];
const expectedBucketMD = new BucketInfo(bucketMd.name,
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('BackbeatClient unit tests with mock server', () => {
const destReq = backbeatClient.getObjectList({
Bucket: bucketName,
});
return destReq.send((err, data) => {
destReq.send((err, data) => {
assert.ifError(err);
assert.deepStrictEqual(data, expectedObjectList);
return done();
Expand All @@ -131,7 +131,7 @@ describe('BackbeatClient unit tests with mock server', () => {
Bucket: bucketName,
Key: objectName,
});
return destReq.send((err, data) => {
destReq.send((err, data) => {
assert.ifError(err);
assert(data.Body);
const dataValue = JSON.parse(data.Body);
Expand All @@ -144,7 +144,7 @@ describe('BackbeatClient unit tests with mock server', () => {
const destReq = backbeatClient.getBucketCseq({
Bucket: bucketName,
});
return destReq.send((err, data) => {
destReq.send((err, data) => {
assert.ifError(err);
assert(data[0] && data[0].cseq);
assert.strictEqual(data[0].cseq, 7);
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/lib/BackbeatConsumer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('BackbeatConsumer main tests', () => {
setTimeout(() => {
_checkZkMetrics(() => {
consumeCb();
consumer.unsubscribe();
consumer.pause();
});
}, 5000);
assert.deepStrictEqual(
Expand All @@ -142,7 +142,7 @@ describe('BackbeatConsumer main tests', () => {
'messages from the previous offset', done => {
let totalConsumed = 0;
const kafkaConsumer = consumer._consumer;
consumer.subscribe();
consumer.resume();

async.series([
next => {
Expand Down
17 changes: 16 additions & 1 deletion tests/functional/notification/NotificationConfigManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ const notificationConfigurationVariant = {
],
};

class MockChangeStream extends events.EventEmitter {
constructor() {
super();
this.closed = false;
}

isClosed() {
return this.closed;
}

close() {
this.closed = true;
}
}

describe('NotificationConfigManager ::', () => {
const params = {
mongoConfig,
Expand All @@ -42,7 +57,7 @@ describe('NotificationConfigManager ::', () => {
manager = new NotificationConfigManager(params);
const getCollectionStub = sinon.stub().returns({
// mock change stream
watch: () => new events.EventEmitter(),
watch: () => new MockChangeStream(),
// mock bucket notification configuration
findOne: () => (
{
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/replication/queueProcessor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ describe('queue processor functional tests with mocking', () => {

afterAll(done => {
httpServer.close();
async.parallel([
async.series([
done => queueProcessorSF.stop(done),
done => queueProcessorAzure.stop(done),
done => replicationStatusProcessor.stop(done),
Expand All @@ -905,7 +905,8 @@ describe('queue processor functional tests with mocking', () => {
nbParts: 2,
encrypted: true },
{ caption: 'empty object',
nbParts: 0 }].forEach(testCase => describe(testCase.caption, () => {
nbParts: 0 },
].forEach(testCase => describe(testCase.caption, () => {
beforeAll(() => {
s3mock.setParam('nbParts', testCase.nbParts);
if (testCase.encrypted) {
Expand Down

0 comments on commit 4b4967b

Please sign in to comment.