Skip to content

Commit

Permalink
PHPLIB-1228: Run legacy transaction tests on LB topologies
Browse files Browse the repository at this point in the history
Synced with mongodb/specifications@38e65fc

Skip select legacy transaction spec tests on load balancers (per libmongoc). This includes any tests that rely on session pinning, including those that use targetedFailPoint.
  • Loading branch information
jmikola committed Oct 3, 2023
1 parent bb63143 commit b4a7b2f
Show file tree
Hide file tree
Showing 34 changed files with 984 additions and 696 deletions.
74 changes: 74 additions & 0 deletions tests/SpecTests/TransactionsSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,76 @@ class TransactionsSpecTest extends FunctionalTestCase
'transactions/pin-mongos: unpin after transient error within a transaction and commit' => 'isMaster failpoints cannot be disabled',
];

/**
* Any tests that rely on session pinning (including targetedFailPoint) must
* be skipped since libmongoc does not pin on load-balanced toplogies. */
private static array $incompleteLoadBalancerTests = [
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on insertOne' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient error within a transaction' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on insertOne insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on insertMany insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on updateOne update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on replaceOne update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on updateMany update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on deleteOne delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on deleteMany delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on bulkWrite insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on bulkWrite update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on bulkWrite delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on find find' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on countDocuments aggregate' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on aggregate aggregate' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on distinct distinct' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: remain pinned after non-transient Interrupted error on runCommand insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on insertOne insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on insertOne insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on insertMany insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on insertMany insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on updateOne update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on updateOne update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on replaceOne update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on replaceOne update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on updateMany update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on updateMany update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on deleteOne delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on deleteOne delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on deleteMany delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on deleteMany delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on findOneAndDelete findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on findOneAndUpdate findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on findOneAndReplace findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on bulkWrite insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on bulkWrite insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on bulkWrite update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on bulkWrite update' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on bulkWrite delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on bulkWrite delete' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on find find' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on find find' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on countDocuments aggregate' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on countDocuments aggregate' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on aggregate aggregate' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on aggregate aggregate' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on distinct distinct' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on distinct distinct' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient connection error on runCommand insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-pin-auto: unpin after transient ShutdownInProgress error on runCommand insert' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-recovery-token: commitTransaction explicit retries include recoveryToken' => 'libmongoc omits recoveryToken for load-balanced topology (CDRIVER-4718)',
'transactions/mongos-recovery-token: commitTransaction retry succeeds on new mongos' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-recovery-token: commitTransaction retry fails on new mongos' => 'libmongoc does not pin for load-balanced topology',
'transactions/mongos-recovery-token: abortTransaction sends recoveryToken' => 'libmongoc does not pin for load-balanced topology',
'transactions/pin-mongos: multiple commits' => 'libmongoc does not pin for load-balanced topology',
'transactions/pin-mongos: remain pinned after non-transient error on commit' => 'libmongoc does not pin for load-balanced topology',
'transactions/pin-mongos: unpin after transient error within a transaction' => 'libmongoc does not pin for load-balanced topology',
'transactions/pin-mongos: unpin after transient error within a transaction and commit' => 'libmongoc does not pin for load-balanced topology',
];

public function setUp(): void
{
parent::setUp();
Expand Down Expand Up @@ -143,6 +213,10 @@ private function runTransactionTest(stdClass $test, ?array $runOn, array $data,
$this->markTestIncomplete(self::$incompleteTests[$this->dataDescription()]);
}

if ($this->isLoadBalanced() && isset(self::$incompleteLoadBalancerTests[$this->dataDescription()])) {
$this->markTestIncomplete(self::$incompleteLoadBalancerTests[$this->dataDescription()]);
}

if (isset($runOn)) {
$this->checkServerRequirements($runOn);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/abort.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/bulk.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/causal-consistency.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/commit.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/count.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/create-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"minServerVersion": "4.3.4",
"topology": [
"replicaset",
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/create-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"minServerVersion": "4.3.4",
"topology": [
"replicaset",
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/delete.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
160 changes: 160 additions & 0 deletions tests/SpecTests/transactions/error-labels-blockConnection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"runOn": [
{
"minServerVersion": "4.2",
"topology": [
"replicaset",
"sharded",
"load-balanced"
]
}
],
"database_name": "transaction-tests",
"collection_name": "test",
"data": [],
"tests": [
{
"description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors",
"clientOptions": {
"socketTimeoutMS": 100
},
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"commitTransaction"
],
"blockConnection": true,
"blockTimeMS": 150
}
},
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
},
{
"name": "commitTransaction",
"object": "session0",
"result": {
"errorLabelsContain": [
"RetryableWriteError",
"UnknownTransactionCommitResult"
],
"errorLabelsOmit": [
"TransientTransactionError"
]
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"readConcern": null,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": {
"w": "majority",
"wtimeout": 10000
}
},
"command_name": "commitTransaction",
"database_name": "admin"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": {
"w": "majority",
"wtimeout": 10000
}
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1
}
]
}
}
}
]
}
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/error-labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
],
"serverless": "forbid"
}
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/errors-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/findOneAndDelete.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/findOneAndReplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/findOneAndUpdate.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tests/SpecTests/transactions/insert.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
"sharded",
"load-balanced"
]
}
],
Expand Down
Loading

0 comments on commit b4a7b2f

Please sign in to comment.