...

Text file src/go.mongodb.org/mongo-driver/testdata/transactions/unified/mongos-unpin.yml

Documentation: go.mongodb.org/mongo-driver/testdata/transactions/unified

     1description: mongos-unpin
     2
     3schemaVersion: '1.4'
     4
     5runOnRequirements:
     6  - minServerVersion: '4.2'
     7    # Skip pending GODRIVER-3113
     8    maxServerVersion: "7.99"
     9    topologies: [ sharded-replicaset ]
    10
    11createEntities:
    12  - client:
    13      id: &client0 client0
    14      useMultipleMongoses: true
    15  - database:
    16      id: &database0 database0
    17      client: *client0
    18      databaseName: &database0Name mongos-unpin-db
    19  - collection:
    20      id: &collection0 collection0
    21      database: *database0
    22      collectionName: &collection0Name test
    23  - session:
    24      id: &session0 session0
    25      client: *client0
    26
    27initialData:
    28  - collectionName: *collection0Name
    29    databaseName: *database0Name
    30    documents: []
    31
    32_yamlAnchors:
    33  anchors:
    34    # LockTimeout will cause the server to add a TransientTransactionError label. It is not retryable.
    35    &lockTimeoutErrorCode 24
    36
    37tests:
    38  - description: unpin after TransientTransactionError error on commit
    39    runOnRequirements:
    40        # serverless proxy doesn't append error labels to errors in transactions
    41        # caused by failpoints (CLOUDP-88216)
    42      - serverless: "forbid"
    43    operations:
    44      - &startTransaction
    45        name: startTransaction
    46        object: *session0
    47      - &insertOne
    48        name: insertOne
    49        object: *collection0
    50        arguments:
    51          document: { x: 1 }
    52          session: *session0
    53      - name: targetedFailPoint
    54        object: testRunner
    55        arguments:
    56          session: *session0
    57          failPoint:
    58            configureFailPoint: failCommand
    59            mode: { times: 1 }
    60            data:
    61              failCommands: [ commitTransaction ]
    62              errorCode: *lockTimeoutErrorCode
    63      - name: commitTransaction
    64        object: *session0
    65        expectError:
    66          # LockTimeout is not retryable, so the commit fails.
    67          errorCode: *lockTimeoutErrorCode
    68          errorLabelsContain: [ TransientTransactionError ]
    69          errorLabelsOmit: [ UnknownTransactionCommitResult ]
    70      - &assertNoPinnedServer
    71        name: assertSessionUnpinned
    72        object: testRunner
    73        arguments:
    74          session: *session0
    75      # Cleanup the potentionally open server transaction by starting and
    76      # aborting a new transaction on the same session.
    77      - *startTransaction
    78      - *insertOne
    79      - &abortTransaction
    80        name: abortTransaction
    81        object: *session0
    82
    83  - description: unpin on successful abort
    84    operations:
    85      - *startTransaction
    86      - *insertOne
    87      - *abortTransaction
    88      - *assertNoPinnedServer
    89
    90  - description: unpin after non-transient error on abort
    91    runOnRequirements:
    92        # serverless proxy doesn't append error labels to errors in transactions
    93        # caused by failpoints (CLOUDP-88216)
    94      - serverless: "forbid"
    95    operations:
    96      - *startTransaction
    97      - *insertOne
    98      - name: targetedFailPoint
    99        object: testRunner
   100        arguments:
   101          session: *session0
   102          failPoint:
   103            configureFailPoint: failCommand
   104            mode: { times: 1 }
   105            data:
   106              failCommands: [ abortTransaction ]
   107              errorCode: *lockTimeoutErrorCode
   108      - *abortTransaction
   109      - *assertNoPinnedServer
   110      # Cleanup the potentionally open server transaction by starting and
   111      # aborting a new transaction on the same session.
   112      - *startTransaction
   113      - *insertOne
   114      - *abortTransaction
   115
   116  - description: unpin after TransientTransactionError error on abort
   117    operations:
   118      - *startTransaction
   119      - *insertOne
   120      - name: targetedFailPoint
   121        object: testRunner
   122        arguments:
   123          session: *session0
   124          failPoint:
   125            configureFailPoint: failCommand
   126            mode: { times: 1 }
   127            data:
   128              failCommands: [ abortTransaction ]
   129              errorCode: 91 # ShutdownInProgress
   130      - *abortTransaction
   131      - *assertNoPinnedServer
   132      # Cleanup the potentionally open server transaction by starting and
   133      # aborting a new transaction on the same session.
   134      - *startTransaction
   135      - *insertOne
   136      - *abortTransaction
   137
   138  - description: unpin when a new transaction is started
   139    operations:
   140      - *startTransaction
   141      - *insertOne
   142      - name: commitTransaction
   143        object: *session0
   144      - &assertPinnedServer
   145        name: assertSessionPinned
   146        object: testRunner
   147        arguments:
   148          session: *session0
   149      - *startTransaction
   150      - *assertNoPinnedServer
   151
   152  - description: unpin when a non-transaction write operation uses a session
   153    operations:
   154      - *startTransaction
   155      - *insertOne
   156      - name: commitTransaction
   157        object: *session0
   158      - *assertPinnedServer
   159      - *insertOne
   160      - *assertNoPinnedServer
   161
   162  - description: unpin when a non-transaction read operation uses a session
   163    operations:
   164      - *startTransaction
   165      - *insertOne
   166      - name: commitTransaction
   167        object: *session0
   168      - *assertPinnedServer
   169      - name: find
   170        object: *collection0
   171        arguments:
   172          filter: { x: 1 }
   173          session: *session0
   174      - *assertNoPinnedServer

View as plain text