Skip to content

Commit dc93151

Browse files
pr requested changes 4
1 parent 8f6c860 commit dc93151

File tree

2 files changed

+23
-226
lines changed

2 files changed

+23
-226
lines changed

src/cmap/message_stream.ts

Lines changed: 0 additions & 220 deletions
This file was deleted.

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ describe('Command Logging and Monitoring Prose Tests', function () {
156156
});
157157
});
158158

159-
context('Truncation with multi-byte codepoints', function () {
159+
context.skip('Truncation with multi-byte codepoints', function () {
160160
/*
161161
A specific test case is not provided here due to the allowed variations in truncation logic
162162
as well as varying extended JSON whitespace usage.
@@ -169,6 +169,7 @@ describe('Command Logging and Monitoring Prose Tests', function () {
169169
where the max length falls in the middle of a multi-byte codepoint are handled gracefully.
170170
*/
171171

172+
const maxDocLength = 39;
172173
beforeEach(async function () {
173174
writable = {
174175
buffer: [],
@@ -185,7 +186,7 @@ describe('Command Logging and Monitoring Prose Tests', function () {
185186
mongodbLogComponentSeverities: {
186187
command: 'debug'
187188
},
188-
mongodbLogMaxDocumentLength: 50
189+
mongodbLogMaxDocumentLength: maxDocLength
189190
}
190191
);
191192
});
@@ -195,9 +196,12 @@ describe('Command Logging and Monitoring Prose Tests', function () {
195196
});
196197

197198
it('should handle unicode codepoints in middle and end of truncation gracefully', async function () {
199+
const multibyteUnicode = '\uD801\uDC37';
200+
const firstByteChar = multibyteUnicode.charCodeAt(0);
201+
const secondByteChar = multibyteUnicode.charCodeAt(1);
198202
const docs: Array<Document> = [
199203
{
200-
x: '\u2603\u2603\u2603\u2603'
204+
x: `${multibyteUnicode}${multibyteUnicode}${multibyteUnicode}${multibyteUnicode}`
201205
}
202206
];
203207

@@ -206,12 +210,25 @@ describe('Command Logging and Monitoring Prose Tests', function () {
206210
const insertManyCommandStarted = writable.buffer[0];
207211
expect(insertManyCommandStarted?.message).to.equal('Command started');
208212
expect(insertManyCommandStarted?.command).to.be.a('string');
209-
expect(insertManyCommandStarted?.command?.length).to.equal(50 + ELLIPSES_LENGTH);
213+
// maxDocLength - 1 because stringified response should be rounded down due to ending mid-codepoint
214+
expect(insertManyCommandStarted?.command?.length).to.equal(
215+
maxDocLength - 1 + ELLIPSES_LENGTH
216+
);
217+
218+
// multi-byte codepoint in middle of truncated string
219+
expect(insertManyCommandStarted?.command.charCodeAt(maxDocLength - 1)).to.equal(
220+
firstByteChar
221+
);
222+
expect(insertManyCommandStarted?.command.charCodeAt(maxDocLength - 1)).to.equal(
223+
secondByteChar
224+
);
210225

211226
const insertManyCommandSucceeded = writable.buffer[1];
212227
expect(insertManyCommandSucceeded?.message).to.equal('Command succeeded');
213228
expect(insertManyCommandSucceeded?.reply).to.be.a('string');
214-
expect(insertManyCommandSucceeded?.reply?.length).to.be.at.most(50 + ELLIPSES_LENGTH);
229+
expect(insertManyCommandSucceeded?.reply?.length).to.be.at.most(
230+
maxDocLength + ELLIPSES_LENGTH
231+
);
215232
});
216-
});
233+
}).skipReason = 'todo(NODE-5839)';
217234
});

0 commit comments

Comments
 (0)