Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Re-enable session tests on local after removal of mongo-unit #23263

Merged
merged 3 commits into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
meteor npm run lint && \
meteor npm run testunit -- --exclude app/models/server/models/Sessions.tests.js
meteor npm run testunit
6 changes: 3 additions & 3 deletions app/models/server/models/Sessions.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const DATA = {
lastActivityAt: new Date('2019-05-03T02:59:59.999Z'),
}],
sessions_dates,
}; // require('./fixtures/testData.json')
};

describe('Sessions Aggregates', () => {
let db;
Expand All @@ -251,7 +251,7 @@ describe('Sessions Aggregates', () => {
const version = '5.0.0';
console.log(`Starting mongo version ${ version }`);
mongod = await MongoMemoryServer.create({ binary: { version } });
process.env.MONGO_URL = mongod.getUri();
process.env.MONGO_URL = await mongod.getUri();
});

after(async () => {
Expand All @@ -261,7 +261,7 @@ describe('Sessions Aggregates', () => {

before(async () => {
console.log(`Connecting to mongo at ${ process.env.MONGO_URL }`);
const client = await MongoClient.connect(process.env.MONGO_URL, { useUnifiedTopology: true });
const client = await MongoClient.connect(process.env.MONGO_URL, { useUnifiedTopology: true, useNewUrlParser: true });
db = client.db('test');

after(() => {
Expand Down
9 changes: 3 additions & 6 deletions server/startup/serverRunning.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import { settings } from '../../app/settings/server';
import { Info, getMongoInfo } from '../../app/utils/server';
import { Users } from '../../app/models/server';
import { sendMessagesToAdmins } from '../lib/sendMessagesToAdmins';
import { showErrorBox, showSuccessBox } from '../lib/logger/showBox';
import { SystemLogger } from '../lib/logger/system';
import { showErrorBox, showWarningBox, showSuccessBox } from '../lib/logger/showBox';

const exitIfNotBypassed = (ignore, errorCode = 1) => {
if (typeof ignore === 'string' && ['yes', 'true'].includes(ignore.toLowerCase())) {
Expand Down Expand Up @@ -64,8 +63,7 @@ Meteor.startup(function() {

if (!semver.satisfies(semver.coerce(mongoVersion), '>=3.6.0')) {
msg += ['', '', 'YOUR CURRENT MONGODB VERSION IS NOT SUPPORTED,', 'PLEASE UPGRADE TO VERSION 3.6 OR LATER'].join('\n');
SystemLogger.error_box(msg, 'SERVER ERROR');

showErrorBox('SERVER ERROR', msg);

exitIfNotBypassed(process.env.BYPASS_MONGO_VALIDATION);
}
Expand All @@ -75,8 +73,7 @@ Meteor.startup(function() {
// Deprecation
if (!semver.satisfies(semver.coerce(mongoVersion), '>=4.2.0')) {
msg = [`YOUR CURRENT MONGODB VERSION (${ mongoVersion }) IS DEPRECATED.`, 'IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 5.0.0 AND GREATER,', 'PLEASE UPGRADE MONGODB TO VERSION 4.2 OR GREATER'].join('\n');
SystemLogger.deprecation_box(msg, 'DEPRECATION');

showWarningBox('DEPRECATION', msg);

const id = `mongodbDeprecation_${ mongoVersion.replace(/[^0-9]/g, '_') }`;
const title = 'MongoDB_Deprecated';
Expand Down