Skip to content

Commit d46b8d0

Browse files
test(NODE-7393): sync spec tests for transaction logging (#4850)
Co-authored-by: Bailey Pearson <[email protected]>
1 parent 000fa0f commit d46b8d0

File tree

2 files changed

+462
-3
lines changed

2 files changed

+462
-3
lines changed

test/spec/command-logging-and-monitoring/logging/command.json

Lines changed: 329 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
"database": "database",
2424
"collectionName": "logging-tests-collection"
2525
}
26+
},
27+
{
28+
"session": {
29+
"id": "session",
30+
"client": "client"
31+
}
2632
}
2733
],
2834
"initialData": [
@@ -210,6 +216,328 @@
210216
]
211217
}
212218
]
219+
},
220+
{
221+
"description": "A successful commitTransaction command",
222+
"runOnRequirements": [
223+
{
224+
"topologies": [
225+
"replicaset",
226+
"sharded"
227+
]
228+
}
229+
],
230+
"operations": [
231+
{
232+
"name": "startTransaction",
233+
"object": "session"
234+
},
235+
{
236+
"name": "insertOne",
237+
"object": "collection",
238+
"arguments": {
239+
"session": "session",
240+
"document": {
241+
"_id": 2,
242+
"x": 22
243+
}
244+
}
245+
},
246+
{
247+
"name": "commitTransaction",
248+
"object": "session"
249+
}
250+
],
251+
"expectLogMessages": [
252+
{
253+
"client": "client",
254+
"messages": [
255+
{
256+
"level": "debug",
257+
"component": "command",
258+
"data": {
259+
"message": "Command started",
260+
"databaseName": "logging-tests",
261+
"commandName": "insert",
262+
"command": {
263+
"$$type": "string"
264+
},
265+
"requestId": {
266+
"$$type": [
267+
"int",
268+
"long"
269+
]
270+
},
271+
"serverHost": {
272+
"$$type": "string"
273+
},
274+
"serverPort": {
275+
"$$type": [
276+
"int",
277+
"long"
278+
]
279+
}
280+
}
281+
},
282+
{
283+
"level": "debug",
284+
"component": "command",
285+
"data": {
286+
"message": "Command succeeded",
287+
"databaseName": "logging-tests",
288+
"commandName": "insert",
289+
"reply": {
290+
"$$type": "string"
291+
},
292+
"requestId": {
293+
"$$type": [
294+
"int",
295+
"long"
296+
]
297+
},
298+
"serverHost": {
299+
"$$type": "string"
300+
},
301+
"serverPort": {
302+
"$$type": [
303+
"int",
304+
"long"
305+
]
306+
},
307+
"durationMS": {
308+
"$$type": [
309+
"double",
310+
"int",
311+
"long"
312+
]
313+
}
314+
}
315+
},
316+
{
317+
"level": "debug",
318+
"component": "command",
319+
"data": {
320+
"message": "Command started",
321+
"databaseName": "admin",
322+
"commandName": "commitTransaction",
323+
"command": {
324+
"$$type": "string"
325+
},
326+
"requestId": {
327+
"$$type": [
328+
"int",
329+
"long"
330+
]
331+
},
332+
"serverHost": {
333+
"$$type": "string"
334+
},
335+
"serverPort": {
336+
"$$type": [
337+
"int",
338+
"long"
339+
]
340+
}
341+
}
342+
},
343+
{
344+
"level": "debug",
345+
"component": "command",
346+
"data": {
347+
"message": "Command succeeded",
348+
"databaseName": "admin",
349+
"commandName": "commitTransaction",
350+
"reply": {
351+
"$$type": "string"
352+
},
353+
"requestId": {
354+
"$$type": [
355+
"int",
356+
"long"
357+
]
358+
},
359+
"serverHost": {
360+
"$$type": "string"
361+
},
362+
"serverPort": {
363+
"$$type": [
364+
"int",
365+
"long"
366+
]
367+
},
368+
"durationMS": {
369+
"$$type": [
370+
"double",
371+
"int",
372+
"long"
373+
]
374+
}
375+
}
376+
}
377+
]
378+
}
379+
]
380+
},
381+
{
382+
"description": "A successful abortTransaction command",
383+
"runOnRequirements": [
384+
{
385+
"topologies": [
386+
"replicaset",
387+
"sharded"
388+
]
389+
}
390+
],
391+
"operations": [
392+
{
393+
"name": "startTransaction",
394+
"object": "session"
395+
},
396+
{
397+
"name": "insertOne",
398+
"object": "collection",
399+
"arguments": {
400+
"session": "session",
401+
"document": {
402+
"_id": 3,
403+
"x": 33
404+
}
405+
}
406+
},
407+
{
408+
"name": "abortTransaction",
409+
"object": "session"
410+
}
411+
],
412+
"expectLogMessages": [
413+
{
414+
"client": "client",
415+
"messages": [
416+
{
417+
"level": "debug",
418+
"component": "command",
419+
"data": {
420+
"message": "Command started",
421+
"databaseName": "logging-tests",
422+
"commandName": "insert",
423+
"command": {
424+
"$$type": "string"
425+
},
426+
"requestId": {
427+
"$$type": [
428+
"int",
429+
"long"
430+
]
431+
},
432+
"serverHost": {
433+
"$$type": "string"
434+
},
435+
"serverPort": {
436+
"$$type": [
437+
"int",
438+
"long"
439+
]
440+
}
441+
}
442+
},
443+
{
444+
"level": "debug",
445+
"component": "command",
446+
"data": {
447+
"message": "Command succeeded",
448+
"databaseName": "logging-tests",
449+
"commandName": "insert",
450+
"reply": {
451+
"$$type": "string"
452+
},
453+
"requestId": {
454+
"$$type": [
455+
"int",
456+
"long"
457+
]
458+
},
459+
"serverHost": {
460+
"$$type": "string"
461+
},
462+
"serverPort": {
463+
"$$type": [
464+
"int",
465+
"long"
466+
]
467+
},
468+
"durationMS": {
469+
"$$type": [
470+
"double",
471+
"int",
472+
"long"
473+
]
474+
}
475+
}
476+
},
477+
{
478+
"level": "debug",
479+
"component": "command",
480+
"data": {
481+
"message": "Command started",
482+
"databaseName": "admin",
483+
"commandName": "abortTransaction",
484+
"command": {
485+
"$$type": "string"
486+
},
487+
"requestId": {
488+
"$$type": [
489+
"int",
490+
"long"
491+
]
492+
},
493+
"serverHost": {
494+
"$$type": "string"
495+
},
496+
"serverPort": {
497+
"$$type": [
498+
"int",
499+
"long"
500+
]
501+
}
502+
}
503+
},
504+
{
505+
"level": "debug",
506+
"component": "command",
507+
"data": {
508+
"message": "Command succeeded",
509+
"databaseName": "admin",
510+
"commandName": "abortTransaction",
511+
"reply": {
512+
"$$type": "string"
513+
},
514+
"requestId": {
515+
"$$type": [
516+
"int",
517+
"long"
518+
]
519+
},
520+
"serverHost": {
521+
"$$type": "string"
522+
},
523+
"serverPort": {
524+
"$$type": [
525+
"int",
526+
"long"
527+
]
528+
},
529+
"durationMS": {
530+
"$$type": [
531+
"double",
532+
"int",
533+
"long"
534+
]
535+
}
536+
}
537+
}
538+
]
539+
}
540+
]
213541
}
214542
]
215-
}
543+
}

0 commit comments

Comments
 (0)