Skip to content

Commit 499dea5

Browse files
author
Divjot Arora
authored
GODRIVER-1427 Resync sessions spec tests (#278)
1 parent c0d964c commit 499dea5

File tree

2 files changed

+482
-1
lines changed

2 files changed

+482
-1
lines changed

data/sessions/dirty-session-errors.json

Lines changed: 314 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,149 @@
357357
}
358358
}
359359
},
360+
{
361+
"description": "Dirty explicit session is discarded (non-bulk write)",
362+
"clientOptions": {
363+
"retryWrites": true
364+
},
365+
"failPoint": {
366+
"configureFailPoint": "failCommand",
367+
"mode": {
368+
"times": 1
369+
},
370+
"data": {
371+
"failCommands": [
372+
"findAndModify"
373+
],
374+
"closeConnection": true
375+
}
376+
},
377+
"operations": [
378+
{
379+
"name": "assertSessionNotDirty",
380+
"object": "testRunner",
381+
"arguments": {
382+
"session": "session0"
383+
}
384+
},
385+
{
386+
"name": "findOneAndUpdate",
387+
"object": "collection",
388+
"arguments": {
389+
"session": "session0",
390+
"filter": {
391+
"_id": 1
392+
},
393+
"update": {
394+
"$inc": {
395+
"x": 1
396+
}
397+
},
398+
"returnDocument": "Before"
399+
},
400+
"result": {
401+
"_id": 1
402+
}
403+
},
404+
{
405+
"name": "assertSessionDirty",
406+
"object": "testRunner",
407+
"arguments": {
408+
"session": "session0"
409+
}
410+
},
411+
{
412+
"name": "endSession",
413+
"object": "session0"
414+
},
415+
{
416+
"name": "find",
417+
"object": "collection",
418+
"arguments": {
419+
"filter": {
420+
"_id": -1
421+
}
422+
},
423+
"result": []
424+
},
425+
{
426+
"name": "assertDifferentLsidOnLastTwoCommands",
427+
"object": "testRunner"
428+
}
429+
],
430+
"expectations": [
431+
{
432+
"command_started_event": {
433+
"command": {
434+
"findAndModify": "test",
435+
"query": {
436+
"_id": 1
437+
},
438+
"update": {
439+
"$inc": {
440+
"x": 1
441+
}
442+
},
443+
"new": false,
444+
"lsid": "session0",
445+
"txnNumber": {
446+
"$numberLong": "1"
447+
},
448+
"readConcern": null,
449+
"writeConcern": null
450+
},
451+
"command_name": "findAndModify",
452+
"database_name": "session-tests"
453+
}
454+
},
455+
{
456+
"command_started_event": {
457+
"command": {
458+
"findAndModify": "test",
459+
"query": {
460+
"_id": 1
461+
},
462+
"update": {
463+
"$inc": {
464+
"x": 1
465+
}
466+
},
467+
"new": false,
468+
"lsid": "session0",
469+
"txnNumber": {
470+
"$numberLong": "1"
471+
},
472+
"readConcern": null,
473+
"writeConcern": null
474+
},
475+
"command_name": "findAndModify",
476+
"database_name": "session-tests"
477+
}
478+
},
479+
{
480+
"command_started_event": {
481+
"command": {
482+
"find": "test",
483+
"filter": {
484+
"_id": -1
485+
}
486+
},
487+
"command_name": "find",
488+
"database_name": "session-tests"
489+
}
490+
}
491+
],
492+
"outcome": {
493+
"collection": {
494+
"data": [
495+
{
496+
"_id": 1,
497+
"x": 1
498+
}
499+
]
500+
}
501+
}
502+
},
360503
{
361504
"description": "Dirty implicit session is discarded (write)",
362505
"clientOptions": {
@@ -465,6 +608,128 @@
465608
}
466609
}
467610
},
611+
{
612+
"description": "Dirty implicit session is discarded (non-bulk write)",
613+
"clientOptions": {
614+
"retryWrites": true
615+
},
616+
"failPoint": {
617+
"configureFailPoint": "failCommand",
618+
"mode": {
619+
"times": 1
620+
},
621+
"data": {
622+
"failCommands": [
623+
"findAndModify"
624+
],
625+
"closeConnection": true
626+
}
627+
},
628+
"operations": [
629+
{
630+
"name": "findOneAndUpdate",
631+
"object": "collection",
632+
"arguments": {
633+
"filter": {
634+
"_id": 1
635+
},
636+
"update": {
637+
"$inc": {
638+
"x": 1
639+
}
640+
},
641+
"returnDocument": "Before"
642+
},
643+
"result": {
644+
"_id": 1
645+
}
646+
},
647+
{
648+
"name": "find",
649+
"object": "collection",
650+
"arguments": {
651+
"filter": {
652+
"_id": -1
653+
}
654+
},
655+
"result": []
656+
},
657+
{
658+
"name": "assertDifferentLsidOnLastTwoCommands",
659+
"object": "testRunner"
660+
}
661+
],
662+
"expectations": [
663+
{
664+
"command_started_event": {
665+
"command": {
666+
"findAndModify": "test",
667+
"query": {
668+
"_id": 1
669+
},
670+
"update": {
671+
"$inc": {
672+
"x": 1
673+
}
674+
},
675+
"new": false,
676+
"txnNumber": {
677+
"$numberLong": "1"
678+
},
679+
"readConcern": null,
680+
"writeConcern": null
681+
},
682+
"command_name": "findAndModify",
683+
"database_name": "session-tests"
684+
}
685+
},
686+
{
687+
"command_started_event": {
688+
"command": {
689+
"findAndModify": "test",
690+
"query": {
691+
"_id": 1
692+
},
693+
"update": {
694+
"$inc": {
695+
"x": 1
696+
}
697+
},
698+
"new": false,
699+
"txnNumber": {
700+
"$numberLong": "1"
701+
},
702+
"readConcern": null,
703+
"writeConcern": null
704+
},
705+
"command_name": "findAndModify",
706+
"database_name": "session-tests"
707+
}
708+
},
709+
{
710+
"command_started_event": {
711+
"command": {
712+
"find": "test",
713+
"filter": {
714+
"_id": -1
715+
}
716+
},
717+
"command_name": "find",
718+
"database_name": "session-tests"
719+
}
720+
}
721+
],
722+
"outcome": {
723+
"collection": {
724+
"data": [
725+
{
726+
"_id": 1,
727+
"x": 1
728+
}
729+
]
730+
}
731+
}
732+
},
468733
{
469734
"description": "Dirty implicit session is discarded (read)",
470735
"failPoint": {
@@ -518,6 +783,54 @@
518783
]
519784
}
520785
}
786+
},
787+
{
788+
"description": "Dirty implicit session is discarded (non-cursor returning read)",
789+
"failPoint": {
790+
"configureFailPoint": "failCommand",
791+
"mode": {
792+
"times": 2
793+
},
794+
"data": {
795+
"failCommands": [
796+
"aggregate"
797+
],
798+
"closeConnection": true
799+
}
800+
},
801+
"operations": [
802+
{
803+
"name": "countDocuments",
804+
"object": "collection",
805+
"arguments": {
806+
"filter": {}
807+
},
808+
"error": true
809+
},
810+
{
811+
"name": "find",
812+
"object": "collection",
813+
"arguments": {
814+
"filter": {
815+
"_id": -1
816+
}
817+
},
818+
"result": []
819+
},
820+
{
821+
"name": "assertDifferentLsidOnLastTwoCommands",
822+
"object": "testRunner"
823+
}
824+
],
825+
"outcome": {
826+
"collection": {
827+
"data": [
828+
{
829+
"_id": 1
830+
}
831+
]
832+
}
833+
}
521834
}
522835
]
523-
}
836+
}

0 commit comments

Comments
 (0)