...

Text file src/go.mongodb.org/mongo-driver/testdata/change-streams/change-streams-resume-errorLabels.yml

Documentation: go.mongodb.org/mongo-driver/testdata/change-streams

     1# Tests for resume behavior on server versions that support the ResumableChangeStreamError label
     2description: "change-streams-resume-errorlabels"
     3
     4schemaVersion: "1.7"
     5
     6runOnRequirements:
     7  - minServerVersion: "4.3.1"
     8    topologies: [ replicaset, sharded-replicaset, load-balanced ]
     9    serverless: forbid
    10
    11createEntities:
    12  - client:
    13      id: &client0 client0
    14      observeEvents: [ commandStartedEvent ]
    15      ignoreCommandMonitoringEvents: [ killCursors ]
    16      useMultipleMongoses: false
    17  - client:
    18      id: &globalClient globalClient
    19      useMultipleMongoses: false
    20  - database:
    21      id: &database0 database0
    22      client: *client0
    23      databaseName: *database0
    24  - collection:
    25      id: &collection0 collection0
    26      database: *database0
    27      collectionName: *collection0
    28  - database:
    29      id: &globalDatabase0 globalDatabase0
    30      client: *globalClient
    31      databaseName: *database0
    32  - collection:
    33      id: &globalCollection0 globalCollection0
    34      database: *globalDatabase0
    35      collectionName: *collection0
    36
    37tests:
    38  - description: change stream resumes after HostUnreachable
    39    operations:
    40      - name: failPoint
    41        object: testRunner
    42        arguments:
    43          client: *globalClient
    44          failPoint:
    45            configureFailPoint: failGetMoreAfterCursorCheckout # SERVER-46091 explains why a new failpoint was needed
    46            mode: { times: 1 }
    47            data:
    48              errorCode: 6
    49              closeConnection: false
    50      - name: createChangeStream
    51        object: *collection0
    52        arguments: { pipeline: [] }
    53        saveResultAsEntity: &changeStream0 changeStream0
    54      - name: insertOne
    55        object: *globalCollection0
    56        arguments:
    57          document: { x: 1 }
    58      - name: iterateUntilDocumentOrError
    59        object: *changeStream0
    60        expectResult:
    61          _id: { $$exists: true }
    62          documentKey: { $$exists: true }
    63          operationType: insert
    64          ns:
    65            db: *database0
    66            coll: *collection0
    67          fullDocument:
    68            x: 1
    69            _id: { $$exists: true }
    70    expectEvents:
    71      - client: *client0
    72        ignoreExtraEvents: true
    73        events:
    74          - commandStartedEvent:
    75              command:
    76                aggregate: *collection0
    77                cursor: {}
    78                pipeline: [ { $changeStream: {} } ]
    79              commandName: aggregate
    80              databaseName: *database0
    81          - commandStartedEvent:
    82              command:
    83                getMore: { $$exists: true }
    84                collection: *collection0
    85              commandName: getMore
    86              databaseName: *database0
    87          - commandStartedEvent:
    88              command:
    89                aggregate: *collection0
    90                cursor: {}
    91                pipeline:
    92                  - $changeStream:
    93                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
    94              commandName: aggregate
    95              databaseName: *database0
    96
    97  - description: change stream resumes after HostNotFound
    98    operations:
    99      - name: failPoint
   100        object: testRunner
   101        arguments:
   102          client: *globalClient
   103          failPoint:
   104            configureFailPoint: failGetMoreAfterCursorCheckout
   105            mode: { times: 1 }
   106            data:
   107              errorCode: 7
   108              closeConnection: false
   109      - name: createChangeStream
   110        object: *collection0
   111        arguments: { pipeline: [] }
   112        saveResultAsEntity: &changeStream0 changeStream0
   113      - name: insertOne
   114        object: *globalCollection0
   115        arguments:
   116          document: { x: 1 }
   117      - name: iterateUntilDocumentOrError
   118        object: *changeStream0
   119        expectResult:
   120          _id: { $$exists: true }
   121          documentKey: { $$exists: true }
   122          operationType: insert
   123          ns:
   124            db: *database0
   125            coll: *collection0
   126          fullDocument:
   127            x: 1
   128            _id: { $$exists: true }
   129    expectEvents:
   130      - client: *client0
   131        ignoreExtraEvents: true
   132        events:
   133          - commandStartedEvent:
   134              command:
   135                aggregate: *collection0
   136                cursor: {}
   137                pipeline: [ { $changeStream: {} } ]
   138              commandName: aggregate
   139              databaseName: *database0
   140          - commandStartedEvent:
   141              command:
   142                getMore: { $$exists: true }
   143                collection: *collection0
   144              commandName: getMore
   145              databaseName: *database0
   146          - commandStartedEvent:
   147              command:
   148                aggregate: *collection0
   149                cursor: {}
   150                pipeline:
   151                  - $changeStream:
   152                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   153              commandName: aggregate
   154              databaseName: *database0
   155
   156  - description: change stream resumes after NetworkTimeout
   157    operations:
   158      - name: failPoint
   159        object: testRunner
   160        arguments:
   161          client: *globalClient
   162          failPoint:
   163            configureFailPoint: failGetMoreAfterCursorCheckout
   164            mode: { times: 1 }
   165            data:
   166              errorCode: 89
   167              closeConnection: false
   168      - name: createChangeStream
   169        object: *collection0
   170        arguments: { pipeline: [] }
   171        saveResultAsEntity: &changeStream0 changeStream0
   172      - name: insertOne
   173        object: *globalCollection0
   174        arguments:
   175          document: { x: 1 }
   176      - name: iterateUntilDocumentOrError
   177        object: *changeStream0
   178        expectResult:
   179          _id: { $$exists: true }
   180          documentKey: { $$exists: true }
   181          operationType: insert
   182          ns:
   183            db: *database0
   184            coll: *collection0
   185          fullDocument:
   186            x: 1
   187            _id: { $$exists: true }
   188    expectEvents:
   189      - client: *client0
   190        ignoreExtraEvents: true
   191        events:
   192          - commandStartedEvent:
   193              command:
   194                aggregate: *collection0
   195                cursor: {}
   196                pipeline: [ { $changeStream: {} } ]
   197              commandName: aggregate
   198              databaseName: *database0
   199          - commandStartedEvent:
   200              command:
   201                getMore: { $$exists: true }
   202                collection: *collection0
   203              commandName: getMore
   204              databaseName: *database0
   205          - commandStartedEvent:
   206              command:
   207                aggregate: *collection0
   208                cursor: {}
   209                pipeline:
   210                  - $changeStream:
   211                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   212              commandName: aggregate
   213
   214  - description: change stream resumes after ShutdownInProgress
   215    operations:
   216      - name: failPoint
   217        object: testRunner
   218        arguments:
   219          client: *globalClient
   220          failPoint:
   221            configureFailPoint: failGetMoreAfterCursorCheckout
   222            mode: { times: 1 }
   223            data:
   224              errorCode: 91
   225              closeConnection: false
   226      - name: createChangeStream
   227        object: *collection0
   228        arguments: { pipeline: [] }
   229        saveResultAsEntity: &changeStream0 changeStream0
   230      - name: insertOne
   231        object: *globalCollection0
   232        arguments:
   233          document: { x: 1 }
   234      - name: iterateUntilDocumentOrError
   235        object: *changeStream0
   236        expectResult:
   237          _id: { $$exists: true }
   238          documentKey: { $$exists: true }
   239          operationType: insert
   240          ns:
   241            db: *database0
   242            coll: *collection0
   243          fullDocument:
   244            x: 1
   245            _id: { $$exists: true }
   246    expectEvents:
   247      - client: *client0
   248        ignoreExtraEvents: true
   249        events:
   250          - commandStartedEvent:
   251              command:
   252                aggregate: *collection0
   253                cursor: {}
   254                pipeline: [ { $changeStream: {} } ]
   255              commandName: aggregate
   256              databaseName: *database0
   257          - commandStartedEvent:
   258              command:
   259                getMore: { $$exists: true }
   260                collection: *collection0
   261              commandName: getMore
   262              databaseName: *database0
   263          - commandStartedEvent:
   264              command:
   265                aggregate: *collection0
   266                cursor: {}
   267                pipeline:
   268                  - $changeStream:
   269                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   270              commandName: aggregate
   271              databaseName: *database0
   272
   273  - description: change stream resumes after PrimarySteppedDown
   274    operations:
   275      - name: failPoint
   276        object: testRunner
   277        arguments:
   278          client: *globalClient
   279          failPoint:
   280            configureFailPoint: failGetMoreAfterCursorCheckout
   281            mode: { times: 1 }
   282            data:
   283              errorCode: 189
   284              closeConnection: false
   285      - name: createChangeStream
   286        object: *collection0
   287        arguments: { pipeline: [] }
   288        saveResultAsEntity: &changeStream0 changeStream0
   289      - name: insertOne
   290        object: *globalCollection0
   291        arguments:
   292          document: { x: 1 }
   293      - name: iterateUntilDocumentOrError
   294        object: *changeStream0
   295        expectResult:
   296          _id: { $$exists: true }
   297          documentKey: { $$exists: true }
   298          operationType: insert
   299          ns:
   300            db: *database0
   301            coll: *collection0
   302          fullDocument:
   303            x: 1
   304            _id: { $$exists: true }
   305    expectEvents:
   306      - client: *client0
   307        ignoreExtraEvents: true
   308        events:
   309          - commandStartedEvent:
   310              command:
   311                aggregate: *collection0
   312                cursor: {}
   313                pipeline: [ { $changeStream: {} } ]
   314              commandName: aggregate
   315              databaseName: *database0
   316          - commandStartedEvent:
   317              command:
   318                getMore: { $$exists: true }
   319                collection: *collection0
   320              commandName: getMore
   321              databaseName: *database0
   322          - commandStartedEvent:
   323              command:
   324                aggregate: *collection0
   325                cursor: {}
   326                pipeline:
   327                  - $changeStream:
   328                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   329              commandName: aggregate
   330              databaseName: *database0
   331
   332  - description: change stream resumes after ExceededTimeLimit
   333    operations:
   334      - name: failPoint
   335        object: testRunner
   336        arguments:
   337          client: *globalClient
   338          failPoint:
   339            configureFailPoint: failGetMoreAfterCursorCheckout
   340            mode: { times: 1 }
   341            data:
   342              errorCode: 262
   343              closeConnection: false
   344      - name: createChangeStream
   345        object: *collection0
   346        arguments: { pipeline: [] }
   347        saveResultAsEntity: &changeStream0 changeStream0
   348      - name: insertOne
   349        object: *globalCollection0
   350        arguments:
   351          document: { x: 1 }
   352      - name: iterateUntilDocumentOrError
   353        object: *changeStream0
   354        expectResult:
   355          _id: { $$exists: true }
   356          documentKey: { $$exists: true }
   357          operationType: insert
   358          ns:
   359            db: *database0
   360            coll: *collection0
   361          fullDocument:
   362            x: 1
   363            _id: { $$exists: true }
   364    expectEvents:
   365      - client: *client0
   366        ignoreExtraEvents: true
   367        events:
   368          - commandStartedEvent:
   369              command:
   370                aggregate: *collection0
   371                cursor: {}
   372                pipeline: [ { $changeStream: {} } ]
   373              commandName: aggregate
   374              databaseName: *database0
   375          - commandStartedEvent:
   376              command:
   377                getMore: { $$exists: true }
   378                collection: *collection0
   379              commandName: getMore
   380              databaseName: *database0
   381          - commandStartedEvent:
   382              command:
   383                aggregate: *collection0
   384                cursor: {}
   385                pipeline:
   386                  - $changeStream:
   387                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   388              commandName: aggregate
   389              databaseName: *database0
   390
   391  - description: change stream resumes after SocketException
   392    operations:
   393      - name: failPoint
   394        object: testRunner
   395        arguments:
   396          client: *globalClient
   397          failPoint:
   398            configureFailPoint: failGetMoreAfterCursorCheckout
   399            mode: { times: 1 }
   400            data:
   401              errorCode: 9001
   402              closeConnection: false
   403      - name: createChangeStream
   404        object: *collection0
   405        arguments: { pipeline: [] }
   406        saveResultAsEntity: &changeStream0 changeStream0
   407      - name: insertOne
   408        object: *globalCollection0
   409        arguments:
   410          document: { x: 1 }
   411      - name: iterateUntilDocumentOrError
   412        object: *changeStream0
   413        expectResult:
   414          _id: { $$exists: true }
   415          documentKey: { $$exists: true }
   416          operationType: insert
   417          ns:
   418            db: *database0
   419            coll: *collection0
   420          fullDocument:
   421            x: 1
   422            _id: { $$exists: true }
   423    expectEvents:
   424      - client: *client0
   425        ignoreExtraEvents: true
   426        events:
   427          - commandStartedEvent:
   428              command:
   429                aggregate: *collection0
   430                cursor: {}
   431                pipeline: [ { $changeStream: {} } ]
   432              commandName: aggregate
   433              databaseName: *database0
   434          - commandStartedEvent:
   435              command:
   436                getMore: { $$exists: true }
   437                collection: *collection0
   438              commandName: getMore
   439              databaseName: *database0
   440          - commandStartedEvent:
   441              command:
   442                aggregate: *collection0
   443                cursor: {}
   444                pipeline:
   445                  - $changeStream:
   446                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   447              commandName: aggregate
   448              databaseName: *database0
   449
   450  - description: change stream resumes after NotWritablePrimary
   451    operations:
   452      - name: failPoint
   453        object: testRunner
   454        arguments:
   455          client: *globalClient
   456          failPoint:
   457            configureFailPoint: failGetMoreAfterCursorCheckout
   458            mode: { times: 1 }
   459            data:
   460              errorCode: 10107
   461              closeConnection: false
   462      - name: createChangeStream
   463        object: *collection0
   464        arguments: { pipeline: [] }
   465        saveResultAsEntity: &changeStream0 changeStream0
   466      - name: insertOne
   467        object: *globalCollection0
   468        arguments:
   469          document: { x: 1 }
   470      - name: iterateUntilDocumentOrError
   471        object: *changeStream0
   472        expectResult:
   473          _id: { $$exists: true }
   474          documentKey: { $$exists: true }
   475          operationType: insert
   476          ns:
   477            db: *database0
   478            coll: *collection0
   479          fullDocument:
   480            x: 1
   481            _id: { $$exists: true }
   482    expectEvents:
   483      - client: *client0
   484        ignoreExtraEvents: true
   485        events:
   486          - commandStartedEvent:
   487              command:
   488                aggregate: *collection0
   489                cursor: {}
   490                pipeline: [ { $changeStream: {} } ]
   491              commandName: aggregate
   492              databaseName: *database0
   493          - commandStartedEvent:
   494              command:
   495                getMore: { $$exists: true }
   496                collection: *collection0
   497              commandName: getMore
   498              databaseName: *database0
   499          - commandStartedEvent:
   500              command:
   501                aggregate: *collection0
   502                cursor: {}
   503                pipeline:
   504                  - $changeStream:
   505                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   506              commandName: aggregate
   507              databaseName: *database0
   508
   509  - description: change stream resumes after InterruptedAtShutdown
   510    operations:
   511      - name: failPoint
   512        object: testRunner
   513        arguments:
   514          client: *globalClient
   515          failPoint:
   516            configureFailPoint: failGetMoreAfterCursorCheckout
   517            mode: { times: 1 }
   518            data:
   519              errorCode: 11600
   520              closeConnection: false
   521      - name: createChangeStream
   522        object: *collection0
   523        arguments: { pipeline: [] }
   524        saveResultAsEntity: &changeStream0 changeStream0
   525      - name: insertOne
   526        object: *globalCollection0
   527        arguments:
   528          document: { x: 1 }
   529      - name: iterateUntilDocumentOrError
   530        object: *changeStream0
   531        expectResult:
   532          _id: { $$exists: true }
   533          documentKey: { $$exists: true }
   534          operationType: insert
   535          ns:
   536            db: *database0
   537            coll: *collection0
   538          fullDocument:
   539            x: 1
   540            _id: { $$exists: true }
   541    expectEvents:
   542      - client: *client0
   543        ignoreExtraEvents: true
   544        events:
   545          - commandStartedEvent:
   546              command:
   547                aggregate: *collection0
   548                cursor: {}
   549                pipeline: [ { $changeStream: {} } ]
   550              commandName: aggregate
   551              databaseName: *database0
   552          - commandStartedEvent:
   553              command:
   554                getMore: { $$exists: true }
   555                collection: *collection0
   556              commandName: getMore
   557              databaseName: *database0
   558          - commandStartedEvent:
   559              command:
   560                aggregate: *collection0
   561                cursor: {}
   562                pipeline:
   563                  - $changeStream:
   564                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   565              commandName: aggregate
   566              databaseName: *database0
   567
   568  - description: change stream resumes after InterruptedDueToReplStateChange
   569    operations:
   570      - name: failPoint
   571        object: testRunner
   572        arguments:
   573          client: *globalClient
   574          failPoint:
   575            configureFailPoint: failGetMoreAfterCursorCheckout
   576            mode: { times: 1 }
   577            data:
   578              errorCode: 11602
   579              closeConnection: false
   580      - name: createChangeStream
   581        object: *collection0
   582        arguments: { pipeline: [] }
   583        saveResultAsEntity: &changeStream0 changeStream0
   584      - name: insertOne
   585        object: *globalCollection0
   586        arguments:
   587          document: { x: 1 }
   588      - name: iterateUntilDocumentOrError
   589        object: *changeStream0
   590        expectResult:
   591          _id: { $$exists: true }
   592          documentKey: { $$exists: true }
   593          operationType: insert
   594          ns:
   595            db: *database0
   596            coll: *collection0
   597          fullDocument:
   598            x: 1
   599            _id: { $$exists: true }
   600    expectEvents:
   601      - client: *client0
   602        ignoreExtraEvents: true
   603        events:
   604          - commandStartedEvent:
   605              command:
   606                aggregate: *collection0
   607                cursor: {}
   608                pipeline: [ { $changeStream: {} } ]
   609              commandName: aggregate
   610              databaseName: *database0
   611          - commandStartedEvent:
   612              command:
   613                getMore: { $$exists: true }
   614                collection: *collection0
   615              commandName: getMore
   616              databaseName: *database0
   617          - commandStartedEvent:
   618              command:
   619                aggregate: *collection0
   620                cursor: {}
   621                pipeline:
   622                  - $changeStream:
   623                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   624              commandName: aggregate
   625              databaseName: *database0
   626
   627  - description: change stream resumes after NotPrimaryNoSecondaryOk
   628    operations:
   629      - name: failPoint
   630        object: testRunner
   631        arguments:
   632          client: *globalClient
   633          failPoint:
   634            configureFailPoint: failGetMoreAfterCursorCheckout
   635            mode: { times: 1 }
   636            data:
   637              errorCode: 13435
   638              closeConnection: false
   639      - name: createChangeStream
   640        object: *collection0
   641        arguments: { pipeline: [] }
   642        saveResultAsEntity: &changeStream0 changeStream0
   643      - name: insertOne
   644        object: *globalCollection0
   645        arguments:
   646          document: { x: 1 }
   647      - name: iterateUntilDocumentOrError
   648        object: *changeStream0
   649        expectResult:
   650          _id: { $$exists: true }
   651          documentKey: { $$exists: true }
   652          operationType: insert
   653          ns:
   654            db: *database0
   655            coll: *collection0
   656          fullDocument:
   657            x: 1
   658            _id: { $$exists: true }
   659    expectEvents:
   660      - client: *client0
   661        ignoreExtraEvents: true
   662        events:
   663          - commandStartedEvent:
   664              command:
   665                aggregate: *collection0
   666                cursor: {}
   667                pipeline: [ { $changeStream: {} } ]
   668              commandName: aggregate
   669              databaseName: *database0
   670          - commandStartedEvent:
   671              command:
   672                getMore: { $$exists: true }
   673                collection: *collection0
   674              commandName: getMore
   675              databaseName: *database0
   676          - commandStartedEvent:
   677              command:
   678                aggregate: *collection0
   679                cursor: {}
   680                pipeline:
   681                  - $changeStream:
   682                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   683              commandName: aggregate
   684              databaseName: *database0
   685
   686  - description: change stream resumes after NotPrimaryOrSecondary
   687    operations:
   688      - name: failPoint
   689        object: testRunner
   690        arguments:
   691          client: *globalClient
   692          failPoint:
   693            configureFailPoint: failGetMoreAfterCursorCheckout
   694            mode: { times: 1 }
   695            data:
   696              errorCode: 13436
   697              closeConnection: false
   698      - name: createChangeStream
   699        object: *collection0
   700        arguments: { pipeline: [] }
   701        saveResultAsEntity: &changeStream0 changeStream0
   702      - name: insertOne
   703        object: *globalCollection0
   704        arguments:
   705          document: { x: 1 }
   706      - name: iterateUntilDocumentOrError
   707        object: *changeStream0
   708        expectResult:
   709          _id: { $$exists: true }
   710          documentKey: { $$exists: true }
   711          operationType: insert
   712          ns:
   713            db: *database0
   714            coll: *collection0
   715          fullDocument:
   716            x: 1
   717            _id: { $$exists: true }
   718    expectEvents:
   719      - client: *client0
   720        ignoreExtraEvents: true
   721        events:
   722          - commandStartedEvent:
   723              command:
   724                aggregate: *collection0
   725                cursor: {}
   726                pipeline: [ { $changeStream: {} } ]
   727              commandName: aggregate
   728              databaseName: *database0
   729          - commandStartedEvent:
   730              command:
   731                getMore: { $$exists: true }
   732                collection: *collection0
   733              commandName: getMore
   734              databaseName: *database0
   735          - commandStartedEvent:
   736              command:
   737                aggregate: *collection0
   738                cursor: {}
   739                pipeline:
   740                  - $changeStream:
   741                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   742              commandName: aggregate
   743              databaseName: *database0
   744
   745  - description: change stream resumes after StaleShardVersion
   746    runOnRequirements:
   747       # StaleShardVersion is obsolete as of 6.1 and is no longer marked as resumable.
   748       - maxServerVersion: "6.0.99"
   749    operations:
   750      - name: failPoint
   751        object: testRunner
   752        arguments:
   753          client: *globalClient
   754          failPoint:
   755            configureFailPoint: failGetMoreAfterCursorCheckout
   756            mode: { times: 1 }
   757            data:
   758              errorCode: 63
   759              closeConnection: false
   760      - name: createChangeStream
   761        object: *collection0
   762        arguments: { pipeline: [] }
   763        saveResultAsEntity: &changeStream0 changeStream0
   764      - name: insertOne
   765        object: *globalCollection0
   766        arguments:
   767          document: { x: 1 }
   768      - name: iterateUntilDocumentOrError
   769        object: *changeStream0
   770        expectResult:
   771          _id: { $$exists: true }
   772          documentKey: { $$exists: true }
   773          operationType: insert
   774          ns:
   775            db: *database0
   776            coll: *collection0
   777          fullDocument:
   778            x: 1
   779            _id: { $$exists: true }
   780    expectEvents:
   781      - client: *client0
   782        ignoreExtraEvents: true
   783        events:
   784          - commandStartedEvent:
   785              command:
   786                aggregate: *collection0
   787                cursor: {}
   788                pipeline: [ { $changeStream: {} } ]
   789              commandName: aggregate
   790              databaseName: *database0
   791          - commandStartedEvent:
   792              command:
   793                getMore: { $$exists: true }
   794                collection: *collection0
   795              commandName: getMore
   796              databaseName: *database0
   797          - commandStartedEvent:
   798              command:
   799                aggregate: *collection0
   800                cursor: {}
   801                pipeline:
   802                  - $changeStream:
   803                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   804              commandName: aggregate
   805              databaseName: *database0
   806
   807  - description: change stream resumes after StaleEpoch
   808    operations:
   809      - name: failPoint
   810        object: testRunner
   811        arguments:
   812          client: *globalClient
   813          failPoint:
   814            configureFailPoint: failGetMoreAfterCursorCheckout
   815            mode: { times: 1 }
   816            data:
   817              errorCode: 150
   818              closeConnection: false
   819      - name: createChangeStream
   820        object: *collection0
   821        arguments: { pipeline: [] }
   822        saveResultAsEntity: &changeStream0 changeStream0
   823      - name: insertOne
   824        object: *globalCollection0
   825        arguments:
   826          document: { x: 1 }
   827      - name: iterateUntilDocumentOrError
   828        object: *changeStream0
   829        expectResult:
   830          _id: { $$exists: true }
   831          documentKey: { $$exists: true }
   832          operationType: insert
   833          ns:
   834            db: *database0
   835            coll: *collection0
   836          fullDocument:
   837            x: 1
   838            _id: { $$exists: true }
   839    expectEvents:
   840      - client: *client0
   841        ignoreExtraEvents: true
   842        events:
   843          - commandStartedEvent:
   844              command:
   845                aggregate: *collection0
   846                cursor: {}
   847                pipeline: [ { $changeStream: {} } ]
   848              commandName: aggregate
   849              databaseName: *database0
   850          - commandStartedEvent:
   851              command:
   852                getMore: { $$exists: true }
   853                collection: *collection0
   854              commandName: getMore
   855              databaseName: *database0
   856          - commandStartedEvent:
   857              command:
   858                aggregate: *collection0
   859                cursor: {}
   860                pipeline:
   861                  - $changeStream:
   862                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   863              commandName: aggregate
   864              databaseName: *database0
   865
   866  - description: change stream resumes after RetryChangeStream
   867    operations:
   868      - name: failPoint
   869        object: testRunner
   870        arguments:
   871          client: *globalClient
   872          failPoint:
   873            configureFailPoint: failGetMoreAfterCursorCheckout
   874            mode: { times: 1 }
   875            data:
   876              errorCode: 234
   877              closeConnection: false
   878      - name: createChangeStream
   879        object: *collection0
   880        arguments: { pipeline: [] }
   881        saveResultAsEntity: &changeStream0 changeStream0
   882      - name: insertOne
   883        object: *globalCollection0
   884        arguments:
   885          document: { x: 1 }
   886      - name: iterateUntilDocumentOrError
   887        object: *changeStream0
   888        expectResult:
   889          _id: { $$exists: true }
   890          documentKey: { $$exists: true }
   891          operationType: insert
   892          ns:
   893            db: *database0
   894            coll: *collection0
   895          fullDocument:
   896            x: 1
   897            _id: { $$exists: true }
   898    expectEvents:
   899      - client: *client0
   900        ignoreExtraEvents: true
   901        events:
   902          - commandStartedEvent:
   903              command:
   904                aggregate: *collection0
   905                cursor: {}
   906                pipeline: [ { $changeStream: {} } ]
   907              commandName: aggregate
   908              databaseName: *database0
   909          - commandStartedEvent:
   910              command:
   911                getMore: { $$exists: true }
   912                collection: *collection0
   913              commandName: getMore
   914              databaseName: *database0
   915          - commandStartedEvent:
   916              command:
   917                aggregate: *collection0
   918                cursor: {}
   919                pipeline:
   920                  - $changeStream:
   921                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   922              commandName: aggregate
   923              databaseName: *database0
   924
   925  - description: change stream resumes after FailedToSatisfyReadPreference
   926    operations:
   927      - name: failPoint
   928        object: testRunner
   929        arguments:
   930          client: *globalClient
   931          failPoint:
   932            configureFailPoint: failGetMoreAfterCursorCheckout
   933            mode: { times: 1 }
   934            data:
   935              errorCode: 133
   936              closeConnection: false
   937      - name: createChangeStream
   938        object: *collection0
   939        arguments: { pipeline: [] }
   940        saveResultAsEntity: &changeStream0 changeStream0
   941      - name: insertOne
   942        object: *globalCollection0
   943        arguments:
   944          document: { x: 1 }
   945      - name: iterateUntilDocumentOrError
   946        object: *changeStream0
   947        expectResult:
   948          _id: { $$exists: true }
   949          documentKey: { $$exists: true }
   950          operationType: insert
   951          ns:
   952            db: *database0
   953            coll: *collection0
   954          fullDocument:
   955            x: 1
   956            _id: { $$exists: true }
   957    expectEvents:
   958      - client: *client0
   959        ignoreExtraEvents: true
   960        events:
   961          - commandStartedEvent:
   962              command:
   963                aggregate: *collection0
   964                cursor: {}
   965                pipeline: [ { $changeStream: {} } ]
   966              commandName: aggregate
   967              databaseName: *database0
   968          - commandStartedEvent:
   969              command:
   970                getMore: { $$exists: true }
   971                collection: *collection0
   972              commandName: getMore
   973              databaseName: *database0
   974          - commandStartedEvent:
   975              command:
   976                aggregate: *collection0
   977                cursor: {}
   978                pipeline:
   979                  - $changeStream:
   980                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
   981              commandName: aggregate
   982              databaseName: *database0
   983
   984  # The next two tests ensure that the driver only uses the error label, not the allow list.
   985  - description: change stream resumes if error contains ResumableChangeStreamError
   986    operations:
   987      - name: failPoint
   988        object: testRunner
   989        arguments:
   990          client: *globalClient
   991          failPoint:
   992            configureFailPoint: failCommand
   993            mode: { times: 1 }
   994            data:
   995              failCommands: [ getMore ]
   996              errorCode: 50 # Use an error code that does not have the allow list label by default
   997              closeConnection: false
   998              errorLabels: [ ResumableChangeStreamError ]
   999      - name: createChangeStream
  1000        object: *collection0
  1001        arguments: { pipeline: [] }
  1002        saveResultAsEntity: &changeStream0 changeStream0
  1003      - name: insertOne
  1004        object: *globalCollection0
  1005        arguments:
  1006          document: { x: 1 }
  1007      - name: iterateUntilDocumentOrError
  1008        object: *changeStream0
  1009        expectResult:
  1010          _id: { $$exists: true }
  1011          documentKey: { $$exists: true }
  1012          operationType: insert
  1013          ns:
  1014            db: *database0
  1015            coll: *collection0
  1016          fullDocument:
  1017            x: 1
  1018            _id: { $$exists: true }
  1019    expectEvents:
  1020      - client: *client0
  1021        ignoreExtraEvents: true
  1022        events:
  1023          - commandStartedEvent:
  1024              command:
  1025                aggregate: *collection0
  1026                cursor: {}
  1027                pipeline: [ { $changeStream: {} } ]
  1028              commandName: aggregate
  1029              databaseName: *database0
  1030          - commandStartedEvent:
  1031              command:
  1032                getMore: { $$exists: true }
  1033                collection: *collection0
  1034              commandName: getMore
  1035              databaseName: *database0
  1036          - commandStartedEvent:
  1037              command:
  1038                aggregate: *collection0
  1039                cursor: {}
  1040                pipeline:
  1041                  - $changeStream:
  1042                      resumeAfter: { $$unsetOrMatches: { $$exists: true } }
  1043              commandName: aggregate
  1044              databaseName: *database0
  1045
  1046  - description: change stream does not resume if error does not contain ResumableChangeStreamError
  1047    operations:
  1048      - name: failPoint
  1049        object: testRunner
  1050        arguments:
  1051          client: *globalClient
  1052          failPoint:
  1053            configureFailPoint: failCommand # failCommand will not add the allow list error label
  1054            mode: { times: 1 }
  1055            data:
  1056              failCommands: [ getMore ]
  1057              errorCode: 6 # Use an error code that is on the allow list
  1058              closeConnection: false
  1059      - name: createChangeStream
  1060        object: *collection0
  1061        arguments: { pipeline: [] }
  1062        saveResultAsEntity: &changeStream0 changeStream0
  1063      - name: insertOne
  1064        object: *globalCollection0
  1065        arguments:
  1066          document: { x: 1 }
  1067      - name: iterateUntilDocumentOrError
  1068        object: *changeStream0
  1069        expectError: { errorCode: 6 }

View as plain text