Skip to content

Commit 62dbde9

Browse files
All tests passing, need to add in prose tests
1 parent a26b009 commit 62dbde9

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

src/cmap/connection.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ export interface ConnectionOptions
141141
socketTimeoutMS?: number;
142142
cancellationToken?: CancellationToken;
143143
metadata: ClientMetadata;
144-
mongoLogger: MongoLogger | undefined;
144+
/** @internal */
145+
mongoLogger?: MongoLogger | undefined;
145146
}
146147

147148
/** @internal */

src/mongo_logger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,6 @@ export class MongoLogger {
705705
if (isLogConvertible(message)) {
706706
logMessage = { ...logMessage, ...message.toLog() };
707707
} else {
708-
709708
logMessage = { ...logMessage, ...defaultLogTransform(message, this.maxDocumentLength) };
710709
}
711710
}

test/integration/command-logging-and-monitoring/command_logging_and_monitoring.spec.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Command Logging and Monitoring Spec', function () {
2222
);
2323
});
2424

25-
describe.only('Command Logging Spec', () => {
25+
describe('Command Logging Spec', () => {
2626
const tests = loadSpecTests(path.join('command-logging-and-monitoring', 'logging'));
2727
runUnifiedSuite(tests, test => {
2828
if (

test/tools/unified-spec-runner/match.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ export function matchesEvents(
648648
}
649649
}
650650

651-
export function filterLogs(
651+
export function filterExtraLogs(
652652
logsToIgnore: ExpectedLogMessage[],
653653
actual: ExpectedLogMessage[],
654654
entities: EntitiesMap
@@ -675,9 +675,6 @@ export function compareLogs(
675675
actual: ExpectedLogMessage[],
676676
entities: EntitiesMap
677677
): void {
678-
console.log('ACTUAL', actual);
679-
console.log('EXPECTED', expected);
680-
681678
expect(actual).to.have.lengthOf(expected.length);
682679

683680
for (const [index, actualLog] of actual.entries()) {

test/tools/unified-spec-runner/runner.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ import { expect } from 'chai';
33
import { gte as semverGte, satisfies as semverSatisfies } from 'semver';
44

55
import type { MongoClient } from '../../mongodb';
6-
import { MONGODB_ERROR_CODES, ns, ReadPreference, TopologyType } from '../../mongodb';
6+
import {
7+
MONGODB_ERROR_CODES,
8+
ns,
9+
ReadPreference,
10+
SENSITIVE_COMMANDS,
11+
TopologyType
12+
} from '../../mongodb';
713
import { ejson } from '../utils';
814
import { AstrolabeResultsWriter } from './astrolabe_results_writer';
915
import { EntitiesMap, type UnifiedMongoClient } from './entities';
10-
import { compareLogs, filterLogs, matchesEvents } from './match';
16+
import { compareLogs, filterExtraLogs, matchesEvents } from './match';
1117
import { executeOperationAndCheck } from './operations';
1218
import * as uni from './schema';
1319
import { isAnyRequirementSatisfied, patchVersion, zip } from './unified-utils';
@@ -232,9 +238,19 @@ async function runUnifiedTest(
232238
const testClient = clientList.get(clientId);
233239

234240
expect(testClient, `No client entity found with id ${clientId}`).to.exist;
235-
const filteredTestClientLogs = expectedLogsForClient.ignoreMessages
236-
? filterLogs(expectedLogsForClient.ignoreMessages, testClient!.collectedLogs, entities)
241+
let filteredTestClientLogs = expectedLogsForClient.ignoreMessages
242+
? filterExtraLogs(
243+
expectedLogsForClient.ignoreMessages,
244+
testClient!.collectedLogs,
245+
entities
246+
)
237247
: testClient!.collectedLogs;
248+
if (!testClient!.observeSensitiveCommands) {
249+
filteredTestClientLogs = filteredTestClientLogs.filter(
250+
log =>
251+
!(log.data && log.data.commandName && SENSITIVE_COMMANDS.has(log.data.commandName))
252+
);
253+
}
238254
compareLogs(expectedLogsForClient.messages, filteredTestClientLogs, entities);
239255
}
240256
}

0 commit comments

Comments
 (0)