diff --git a/test/spec/load-balancers/transactions.json b/test/spec/load-balancers/transactions.json index 8cf24f4ca4..ca9c145217 100644 --- a/test/spec/load-balancers/transactions.json +++ b/test/spec/load-balancers/transactions.json @@ -1,6 +1,6 @@ { "description": "transactions are correctly pinned to connections for load-balanced clusters", - "schemaVersion": "1.3", + "schemaVersion": "1.4", "runOnRequirements": [ { "topologies": [ @@ -1616,6 +1616,50 @@ ] } ] + }, + { + "description": "pinned connection is released when session ended", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "endSession", + "object": "session0" + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] } ] } diff --git a/test/spec/load-balancers/transactions.yml b/test/spec/load-balancers/transactions.yml index 29cbbee723..4807ff21ef 100644 --- a/test/spec/load-balancers/transactions.yml +++ b/test/spec/load-balancers/transactions.yml @@ -1,6 +1,6 @@ description: transactions are correctly pinned to connections for load-balanced clusters -schemaVersion: '1.3' +schemaVersion: '1.4' runOnRequirements: - topologies: [ load-balanced ] @@ -596,3 +596,21 @@ tests: - connectionCheckedOutEvent: {} # Events for abortTransaction. - connectionCheckedInEvent: {} + + - description: pinned connection is released when session ended + operations: + - *startTransaction + - *transactionalInsert + - *commitTransaction + - &endSession + name: endSession + object: *session0 + expectEvents: + - client: *client0 + eventType: cmap + events: + # Events for the insert and commitTransaction. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for endSession. + - connectionCheckedInEvent: {} \ No newline at end of file