From 1fda150670e9787935e5ac30aac7eb17211aea96 Mon Sep 17 00:00:00 2001
From: Nathan Xu <nathan.xu@mongodb.com>
Date: Tue, 29 Oct 2024 13:24:50 -0400
Subject: [PATCH 1/2] Sync up transaction specs

---
 .../transactions/mongos-pin-auto.json         | 294 +++++++++
 ...-commit-errorLabels-forbid_serverless.json | 351 ----------
 .../retryable-commit-forbid_serverless.json   | 598 ------------------
 .../unified/UnifiedTransactionsTest.java      |   3 +
 .../unified/UnifiedTransactionsTest.java      |   4 +
 5 files changed, 301 insertions(+), 949 deletions(-)
 delete mode 100644 driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-errorLabels-forbid_serverless.json
 delete mode 100644 driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-forbid_serverless.json

diff --git a/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json b/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json
index 93eac8bb773..27db5204011 100644
--- a/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json
+++ b/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json
@@ -2004,6 +2004,104 @@
         }
       ]
     },
+    {
+      "description": "remain pinned after non-transient Interrupted error on clientBulkWrite bulkWrite",
+      "operations": [
+        {
+          "object": "session0",
+          "name": "startTransaction"
+        },
+        {
+          "object": "collection0",
+          "name": "insertOne",
+          "arguments": {
+            "session": "session0",
+            "document": {
+              "_id": 3
+            }
+          },
+          "expectResult": {
+            "$$unsetOrMatches": {
+              "insertedId": {
+                "$$unsetOrMatches": 3
+              }
+            }
+          }
+        },
+        {
+          "name": "targetedFailPoint",
+          "object": "testRunner",
+          "arguments": {
+            "session": "session0",
+            "failPoint": {
+              "configureFailPoint": "failCommand",
+              "mode": {
+                "times": 1
+              },
+              "data": {
+                "failCommands": [
+                  "bulkWrite"
+                ],
+                "errorCode": 11601
+              }
+            }
+          }
+        },
+        {
+          "name": "clientBulkWrite",
+          "object": "client0",
+          "arguments": {
+            "session": "session0",
+            "models": [
+              {
+                "insertOne": {
+                  "namespace": "database0.collection0",
+                  "document": {
+                    "_id": 8,
+                    "x": 88
+                  }
+                }
+              }
+            ]
+          },
+          "expectError": {
+            "errorLabelsOmit": [
+              "TransientTransactionError"
+            ]
+          }
+        },
+        {
+          "object": "testRunner",
+          "name": "assertSessionPinned",
+          "arguments": {
+            "session": "session0"
+          }
+        },
+        {
+          "object": "session0",
+          "name": "abortTransaction"
+        }
+      ],
+      "outcome": [
+        {
+          "collectionName": "test",
+          "databaseName": "transaction-tests",
+          "documents": [
+            {
+              "_id": 1
+            },
+            {
+              "_id": 2
+            }
+          ]
+        }
+      ],
+      "runOnRequirements": [
+        {
+          "minServerVersion": "8.0"
+        }
+      ]
+    },
     {
       "description": "unpin after transient connection error on insertOne insert",
       "operations": [
@@ -5175,6 +5273,202 @@
           ]
         }
       ]
+    },
+    {
+      "description": "unpin after transient connection error on clientBulkWrite bulkWrite",
+      "operations": [
+        {
+          "object": "session0",
+          "name": "startTransaction"
+        },
+        {
+          "object": "collection0",
+          "name": "insertOne",
+          "arguments": {
+            "session": "session0",
+            "document": {
+              "_id": 3
+            }
+          },
+          "expectResult": {
+            "$$unsetOrMatches": {
+              "insertedId": {
+                "$$unsetOrMatches": 3
+              }
+            }
+          }
+        },
+        {
+          "name": "targetedFailPoint",
+          "object": "testRunner",
+          "arguments": {
+            "session": "session0",
+            "failPoint": {
+              "configureFailPoint": "failCommand",
+              "mode": {
+                "times": 1
+              },
+              "data": {
+                "failCommands": [
+                  "bulkWrite"
+                ],
+                "closeConnection": true
+              }
+            }
+          }
+        },
+        {
+          "name": "clientBulkWrite",
+          "object": "client0",
+          "arguments": {
+            "session": "session0",
+            "models": [
+              {
+                "insertOne": {
+                  "namespace": "database0.collection0",
+                  "document": {
+                    "_id": 8,
+                    "x": 88
+                  }
+                }
+              }
+            ]
+          },
+          "expectError": {
+            "errorLabelsContain": [
+              "TransientTransactionError"
+            ]
+          }
+        },
+        {
+          "object": "testRunner",
+          "name": "assertSessionUnpinned",
+          "arguments": {
+            "session": "session0"
+          }
+        },
+        {
+          "object": "session0",
+          "name": "abortTransaction"
+        }
+      ],
+      "outcome": [
+        {
+          "collectionName": "test",
+          "databaseName": "transaction-tests",
+          "documents": [
+            {
+              "_id": 1
+            },
+            {
+              "_id": 2
+            }
+          ]
+        }
+      ],
+      "runOnRequirements": [
+        {
+          "minServerVersion": "8.0"
+        }
+      ]
+    },
+    {
+      "description": "unpin after transient ShutdownInProgress error on clientBulkWrite bulkWrite",
+      "operations": [
+        {
+          "object": "session0",
+          "name": "startTransaction"
+        },
+        {
+          "object": "collection0",
+          "name": "insertOne",
+          "arguments": {
+            "session": "session0",
+            "document": {
+              "_id": 3
+            }
+          },
+          "expectResult": {
+            "$$unsetOrMatches": {
+              "insertedId": {
+                "$$unsetOrMatches": 3
+              }
+            }
+          }
+        },
+        {
+          "name": "targetedFailPoint",
+          "object": "testRunner",
+          "arguments": {
+            "session": "session0",
+            "failPoint": {
+              "configureFailPoint": "failCommand",
+              "mode": {
+                "times": 1
+              },
+              "data": {
+                "failCommands": [
+                  "bulkWrite"
+                ],
+                "errorCode": 91
+              }
+            }
+          }
+        },
+        {
+          "name": "clientBulkWrite",
+          "object": "client0",
+          "arguments": {
+            "session": "session0",
+            "models": [
+              {
+                "insertOne": {
+                  "namespace": "database0.collection0",
+                  "document": {
+                    "_id": 8,
+                    "x": 88
+                  }
+                }
+              }
+            ]
+          },
+          "expectError": {
+            "errorLabelsContain": [
+              "TransientTransactionError"
+            ]
+          }
+        },
+        {
+          "object": "testRunner",
+          "name": "assertSessionUnpinned",
+          "arguments": {
+            "session": "session0"
+          }
+        },
+        {
+          "object": "session0",
+          "name": "abortTransaction"
+        }
+      ],
+      "outcome": [
+        {
+          "collectionName": "test",
+          "databaseName": "transaction-tests",
+          "documents": [
+            {
+              "_id": 1
+            },
+            {
+              "_id": 2
+            }
+          ]
+        }
+      ],
+      "runOnRequirements": [
+        {
+          "minServerVersion": "8.0"
+        }
+      ]
     }
   ]
 }
diff --git a/driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-errorLabels-forbid_serverless.json b/driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-errorLabels-forbid_serverless.json
deleted file mode 100644
index 2a9c44d4b07..00000000000
--- a/driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-errorLabels-forbid_serverless.json
+++ /dev/null
@@ -1,351 +0,0 @@
-{
-  "description": "retryable-commit-errorLabels-forbid_serverless",
-  "schemaVersion": "1.4",
-  "runOnRequirements": [
-    {
-      "minServerVersion": "4.3.1",
-      "serverless": "forbid",
-      "topologies": [
-        "replicaset",
-        "sharded",
-        "load-balanced"
-      ]
-    }
-  ],
-  "createEntities": [
-    {
-      "client": {
-        "id": "client0",
-        "useMultipleMongoses": false,
-        "observeEvents": [
-          "commandStartedEvent"
-        ]
-      }
-    },
-    {
-      "database": {
-        "id": "database0",
-        "client": "client0",
-        "databaseName": "transaction-tests"
-      }
-    },
-    {
-      "collection": {
-        "id": "collection0",
-        "database": "database0",
-        "collectionName": "test"
-      }
-    },
-    {
-      "session": {
-        "id": "session0",
-        "client": "client0"
-      }
-    },
-    {
-      "session": {
-        "id": "session1",
-        "client": "client0"
-      }
-    }
-  ],
-  "initialData": [
-    {
-      "collectionName": "test",
-      "databaseName": "transaction-tests",
-      "documents": []
-    }
-  ],
-  "tests": [
-    {
-      "description": "commitTransaction succeeds after InterruptedAtShutdown",
-      "operations": [
-        {
-          "object": "testRunner",
-          "name": "failPoint",
-          "arguments": {
-            "client": "client0",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 1
-              },
-              "data": {
-                "failCommands": [
-                  "commitTransaction"
-                ],
-                "errorCode": 11600,
-                "errorLabels": [
-                  "RetryableWriteError"
-                ],
-                "closeConnection": false
-              }
-            }
-          }
-        },
-        {
-          "object": "session0",
-          "name": "startTransaction"
-        },
-        {
-          "object": "collection0",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session0",
-            "document": {
-              "_id": 1
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 1
-              }
-            }
-          }
-        },
-        {
-          "object": "session0",
-          "name": "commitTransaction"
-        }
-      ],
-      "expectEvents": [
-        {
-          "client": "client0",
-          "events": [
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "insert": "test",
-                  "documents": [
-                    {
-                      "_id": 1
-                    }
-                  ],
-                  "ordered": true,
-                  "readConcern": {
-                    "$$exists": false
-                  },
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": true,
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "insert",
-                "databaseName": "transaction-tests"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": "majority",
-                    "wtimeout": 10000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            }
-          ]
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            }
-          ]
-        }
-      ]
-    },
-    {
-      "description": "commitTransaction succeeds after ShutdownInProgress",
-      "operations": [
-        {
-          "object": "testRunner",
-          "name": "failPoint",
-          "arguments": {
-            "client": "client0",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 1
-              },
-              "data": {
-                "failCommands": [
-                  "commitTransaction"
-                ],
-                "errorCode": 91,
-                "errorLabels": [
-                  "RetryableWriteError"
-                ],
-                "closeConnection": false
-              }
-            }
-          }
-        },
-        {
-          "object": "session0",
-          "name": "startTransaction"
-        },
-        {
-          "object": "collection0",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session0",
-            "document": {
-              "_id": 1
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 1
-              }
-            }
-          }
-        },
-        {
-          "object": "session0",
-          "name": "commitTransaction"
-        }
-      ],
-      "expectEvents": [
-        {
-          "client": "client0",
-          "events": [
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "insert": "test",
-                  "documents": [
-                    {
-                      "_id": 1
-                    }
-                  ],
-                  "ordered": true,
-                  "readConcern": {
-                    "$$exists": false
-                  },
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": true,
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "insert",
-                "databaseName": "transaction-tests"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": "majority",
-                    "wtimeout": 10000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            }
-          ]
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
diff --git a/driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-forbid_serverless.json b/driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-forbid_serverless.json
deleted file mode 100644
index c99dd816bda..00000000000
--- a/driver-core/src/test/resources/unified-test-format/transactions/retryable-commit-forbid_serverless.json
+++ /dev/null
@@ -1,598 +0,0 @@
-{
-  "description": "retryable-commit-forbid_serverless",
-  "schemaVersion": "1.4",
-  "runOnRequirements": [
-    {
-      "minServerVersion": "4.0",
-      "topologies": [
-        "replicaset"
-      ]
-    },
-    {
-      "minServerVersion": "4.1.8",
-      "serverless": "forbid",
-      "topologies": [
-        "sharded",
-        "load-balanced"
-      ]
-    }
-  ],
-  "createEntities": [
-    {
-      "client": {
-        "id": "client0",
-        "useMultipleMongoses": false,
-        "observeEvents": [
-          "commandStartedEvent"
-        ]
-      }
-    },
-    {
-      "database": {
-        "id": "database0",
-        "client": "client0",
-        "databaseName": "transaction-tests"
-      }
-    },
-    {
-      "collection": {
-        "id": "collection0",
-        "database": "database0",
-        "collectionName": "test"
-      }
-    },
-    {
-      "session": {
-        "id": "session0",
-        "client": "client0"
-      }
-    },
-    {
-      "client": {
-        "id": "client1",
-        "useMultipleMongoses": false,
-        "uriOptions": {
-          "retryWrites": false
-        },
-        "observeEvents": [
-          "commandStartedEvent"
-        ]
-      }
-    },
-    {
-      "database": {
-        "id": "database1",
-        "client": "client1",
-        "databaseName": "transaction-tests"
-      }
-    },
-    {
-      "collection": {
-        "id": "collection1",
-        "database": "database1",
-        "collectionName": "test"
-      }
-    },
-    {
-      "session": {
-        "id": "session1",
-        "client": "client1"
-      }
-    }
-  ],
-  "initialData": [
-    {
-      "collectionName": "test",
-      "databaseName": "transaction-tests",
-      "documents": []
-    }
-  ],
-  "tests": [
-    {
-      "description": "commitTransaction fails after two errors",
-      "operations": [
-        {
-          "object": "testRunner",
-          "name": "failPoint",
-          "arguments": {
-            "client": "client1",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 2
-              },
-              "data": {
-                "failCommands": [
-                  "commitTransaction"
-                ],
-                "closeConnection": true
-              }
-            }
-          }
-        },
-        {
-          "object": "session1",
-          "name": "startTransaction"
-        },
-        {
-          "object": "collection1",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session1",
-            "document": {
-              "_id": 1
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 1
-              }
-            }
-          }
-        },
-        {
-          "object": "session1",
-          "name": "commitTransaction",
-          "expectError": {
-            "errorLabelsContain": [
-              "RetryableWriteError",
-              "UnknownTransactionCommitResult"
-            ],
-            "errorLabelsOmit": [
-              "TransientTransactionError"
-            ]
-          }
-        },
-        {
-          "object": "session1",
-          "name": "commitTransaction"
-        }
-      ],
-      "expectEvents": [
-        {
-          "client": "client1",
-          "events": [
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "insert": "test",
-                  "documents": [
-                    {
-                      "_id": 1
-                    }
-                  ],
-                  "ordered": true,
-                  "readConcern": {
-                    "$$exists": false
-                  },
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": true,
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "insert",
-                "databaseName": "transaction-tests"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": "majority",
-                    "wtimeout": 10000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": "majority",
-                    "wtimeout": 10000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            }
-          ]
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            }
-          ]
-        }
-      ]
-    },
-    {
-      "description": "commitTransaction applies majority write concern on retries",
-      "operations": [
-        {
-          "object": "testRunner",
-          "name": "failPoint",
-          "arguments": {
-            "client": "client1",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 2
-              },
-              "data": {
-                "failCommands": [
-                  "commitTransaction"
-                ],
-                "closeConnection": true
-              }
-            }
-          }
-        },
-        {
-          "object": "session1",
-          "name": "startTransaction",
-          "arguments": {
-            "writeConcern": {
-              "w": 2,
-              "journal": true,
-              "wtimeoutMS": 5000
-            }
-          }
-        },
-        {
-          "object": "collection1",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session1",
-            "document": {
-              "_id": 1
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 1
-              }
-            }
-          }
-        },
-        {
-          "object": "session1",
-          "name": "commitTransaction",
-          "expectError": {
-            "errorLabelsContain": [
-              "RetryableWriteError",
-              "UnknownTransactionCommitResult"
-            ],
-            "errorLabelsOmit": [
-              "TransientTransactionError"
-            ]
-          }
-        },
-        {
-          "object": "session1",
-          "name": "commitTransaction"
-        }
-      ],
-      "expectEvents": [
-        {
-          "client": "client1",
-          "events": [
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "insert": "test",
-                  "documents": [
-                    {
-                      "_id": 1
-                    }
-                  ],
-                  "ordered": true,
-                  "readConcern": {
-                    "$$exists": false
-                  },
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": true,
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "insert",
-                "databaseName": "transaction-tests"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": 2,
-                    "j": true,
-                    "wtimeout": 5000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": "majority",
-                    "j": true,
-                    "wtimeout": 5000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session1"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": "majority",
-                    "j": true,
-                    "wtimeout": 5000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            }
-          ]
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            }
-          ]
-        }
-      ]
-    },
-    {
-      "description": "commitTransaction succeeds after connection error",
-      "operations": [
-        {
-          "object": "testRunner",
-          "name": "failPoint",
-          "arguments": {
-            "client": "client0",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 1
-              },
-              "data": {
-                "failCommands": [
-                  "commitTransaction"
-                ],
-                "closeConnection": true
-              }
-            }
-          }
-        },
-        {
-          "object": "session0",
-          "name": "startTransaction"
-        },
-        {
-          "object": "collection0",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session0",
-            "document": {
-              "_id": 1
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 1
-              }
-            }
-          }
-        },
-        {
-          "object": "session0",
-          "name": "commitTransaction"
-        }
-      ],
-      "expectEvents": [
-        {
-          "client": "client0",
-          "events": [
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "insert": "test",
-                  "documents": [
-                    {
-                      "_id": 1
-                    }
-                  ],
-                  "ordered": true,
-                  "readConcern": {
-                    "$$exists": false
-                  },
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": true,
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "insert",
-                "databaseName": "transaction-tests"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "$$exists": false
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            },
-            {
-              "commandStartedEvent": {
-                "command": {
-                  "commitTransaction": 1,
-                  "lsid": {
-                    "$$sessionLsid": "session0"
-                  },
-                  "txnNumber": {
-                    "$numberLong": "1"
-                  },
-                  "startTransaction": {
-                    "$$exists": false
-                  },
-                  "autocommit": false,
-                  "writeConcern": {
-                    "w": "majority",
-                    "wtimeout": 10000
-                  }
-                },
-                "commandName": "commitTransaction",
-                "databaseName": "admin"
-              }
-            }
-          ]
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java
index 18a92f8eee8..7520118514e 100644
--- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java
+++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java
@@ -36,6 +36,9 @@ protected void skips(final String fileDescription, final String testDescription)
             assumeFalse(fileDescription.equals("read-concern") && testDescription.equals("distinct ignores collection readConcern"));
             assumeFalse(fileDescription.equals("reads") && testDescription.equals("distinct"));
         }
+        assumeFalse(fileDescription.equals("mongos-pin-auto")
+                        && testDescription.contains(" clientBulkWrite "),
+                "Skipping until JAVA-4586 is implemented");
     }
 
     private static Collection<Arguments> data() throws URISyntaxException, IOException {
diff --git a/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java b/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java
index 5acf74cd972..0b48aa052b2 100644
--- a/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java
+++ b/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java
@@ -36,6 +36,10 @@ protected void skips(final String fileDescription, final String testDescription)
             assumeFalse(fileDescription.equals("read-concern") && testDescription.equals("distinct ignores collection readConcern"));
             assumeFalse(fileDescription.equals("reads") && testDescription.equals("distinct"));
         }
+        assumeFalse(fileDescription.equals("mongos-pin-auto")
+                && testDescription.contains(" clientBulkWrite "),
+                "Skipping until JAVA-4586 is implemented");
+
     }
 
     private static Collection<Arguments> data() throws URISyntaxException, IOException {

From 43d87a95cd745cfe069436f395d75cf2c75e3e79 Mon Sep 17 00:00:00 2001
From: Nathan Xu <nathan.xu@mongodb.com>
Date: Wed, 30 Oct 2024 10:54:53 -0400
Subject: [PATCH 2/2] revert back changes mongos-pin-auto.json

---
 .../transactions/mongos-pin-auto.json         | 294 ------------------
 .../unified/UnifiedTransactionsTest.java      |   3 -
 .../unified/UnifiedTransactionsTest.java      |   4 -
 3 files changed, 301 deletions(-)

diff --git a/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json b/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json
index 27db5204011..93eac8bb773 100644
--- a/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json
+++ b/driver-core/src/test/resources/unified-test-format/transactions/mongos-pin-auto.json
@@ -2004,104 +2004,6 @@
         }
       ]
     },
-    {
-      "description": "remain pinned after non-transient Interrupted error on clientBulkWrite bulkWrite",
-      "operations": [
-        {
-          "object": "session0",
-          "name": "startTransaction"
-        },
-        {
-          "object": "collection0",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session0",
-            "document": {
-              "_id": 3
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 3
-              }
-            }
-          }
-        },
-        {
-          "name": "targetedFailPoint",
-          "object": "testRunner",
-          "arguments": {
-            "session": "session0",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 1
-              },
-              "data": {
-                "failCommands": [
-                  "bulkWrite"
-                ],
-                "errorCode": 11601
-              }
-            }
-          }
-        },
-        {
-          "name": "clientBulkWrite",
-          "object": "client0",
-          "arguments": {
-            "session": "session0",
-            "models": [
-              {
-                "insertOne": {
-                  "namespace": "database0.collection0",
-                  "document": {
-                    "_id": 8,
-                    "x": 88
-                  }
-                }
-              }
-            ]
-          },
-          "expectError": {
-            "errorLabelsOmit": [
-              "TransientTransactionError"
-            ]
-          }
-        },
-        {
-          "object": "testRunner",
-          "name": "assertSessionPinned",
-          "arguments": {
-            "session": "session0"
-          }
-        },
-        {
-          "object": "session0",
-          "name": "abortTransaction"
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            },
-            {
-              "_id": 2
-            }
-          ]
-        }
-      ],
-      "runOnRequirements": [
-        {
-          "minServerVersion": "8.0"
-        }
-      ]
-    },
     {
       "description": "unpin after transient connection error on insertOne insert",
       "operations": [
@@ -5273,202 +5175,6 @@
           ]
         }
       ]
-    },
-    {
-      "description": "unpin after transient connection error on clientBulkWrite bulkWrite",
-      "operations": [
-        {
-          "object": "session0",
-          "name": "startTransaction"
-        },
-        {
-          "object": "collection0",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session0",
-            "document": {
-              "_id": 3
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 3
-              }
-            }
-          }
-        },
-        {
-          "name": "targetedFailPoint",
-          "object": "testRunner",
-          "arguments": {
-            "session": "session0",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 1
-              },
-              "data": {
-                "failCommands": [
-                  "bulkWrite"
-                ],
-                "closeConnection": true
-              }
-            }
-          }
-        },
-        {
-          "name": "clientBulkWrite",
-          "object": "client0",
-          "arguments": {
-            "session": "session0",
-            "models": [
-              {
-                "insertOne": {
-                  "namespace": "database0.collection0",
-                  "document": {
-                    "_id": 8,
-                    "x": 88
-                  }
-                }
-              }
-            ]
-          },
-          "expectError": {
-            "errorLabelsContain": [
-              "TransientTransactionError"
-            ]
-          }
-        },
-        {
-          "object": "testRunner",
-          "name": "assertSessionUnpinned",
-          "arguments": {
-            "session": "session0"
-          }
-        },
-        {
-          "object": "session0",
-          "name": "abortTransaction"
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            },
-            {
-              "_id": 2
-            }
-          ]
-        }
-      ],
-      "runOnRequirements": [
-        {
-          "minServerVersion": "8.0"
-        }
-      ]
-    },
-    {
-      "description": "unpin after transient ShutdownInProgress error on clientBulkWrite bulkWrite",
-      "operations": [
-        {
-          "object": "session0",
-          "name": "startTransaction"
-        },
-        {
-          "object": "collection0",
-          "name": "insertOne",
-          "arguments": {
-            "session": "session0",
-            "document": {
-              "_id": 3
-            }
-          },
-          "expectResult": {
-            "$$unsetOrMatches": {
-              "insertedId": {
-                "$$unsetOrMatches": 3
-              }
-            }
-          }
-        },
-        {
-          "name": "targetedFailPoint",
-          "object": "testRunner",
-          "arguments": {
-            "session": "session0",
-            "failPoint": {
-              "configureFailPoint": "failCommand",
-              "mode": {
-                "times": 1
-              },
-              "data": {
-                "failCommands": [
-                  "bulkWrite"
-                ],
-                "errorCode": 91
-              }
-            }
-          }
-        },
-        {
-          "name": "clientBulkWrite",
-          "object": "client0",
-          "arguments": {
-            "session": "session0",
-            "models": [
-              {
-                "insertOne": {
-                  "namespace": "database0.collection0",
-                  "document": {
-                    "_id": 8,
-                    "x": 88
-                  }
-                }
-              }
-            ]
-          },
-          "expectError": {
-            "errorLabelsContain": [
-              "TransientTransactionError"
-            ]
-          }
-        },
-        {
-          "object": "testRunner",
-          "name": "assertSessionUnpinned",
-          "arguments": {
-            "session": "session0"
-          }
-        },
-        {
-          "object": "session0",
-          "name": "abortTransaction"
-        }
-      ],
-      "outcome": [
-        {
-          "collectionName": "test",
-          "databaseName": "transaction-tests",
-          "documents": [
-            {
-              "_id": 1
-            },
-            {
-              "_id": 2
-            }
-          ]
-        }
-      ],
-      "runOnRequirements": [
-        {
-          "minServerVersion": "8.0"
-        }
-      ]
     }
   ]
 }
diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java
index 7520118514e..18a92f8eee8 100644
--- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java
+++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedTransactionsTest.java
@@ -36,9 +36,6 @@ protected void skips(final String fileDescription, final String testDescription)
             assumeFalse(fileDescription.equals("read-concern") && testDescription.equals("distinct ignores collection readConcern"));
             assumeFalse(fileDescription.equals("reads") && testDescription.equals("distinct"));
         }
-        assumeFalse(fileDescription.equals("mongos-pin-auto")
-                        && testDescription.contains(" clientBulkWrite "),
-                "Skipping until JAVA-4586 is implemented");
     }
 
     private static Collection<Arguments> data() throws URISyntaxException, IOException {
diff --git a/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java b/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java
index 0b48aa052b2..5acf74cd972 100644
--- a/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java
+++ b/driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTransactionsTest.java
@@ -36,10 +36,6 @@ protected void skips(final String fileDescription, final String testDescription)
             assumeFalse(fileDescription.equals("read-concern") && testDescription.equals("distinct ignores collection readConcern"));
             assumeFalse(fileDescription.equals("reads") && testDescription.equals("distinct"));
         }
-        assumeFalse(fileDescription.equals("mongos-pin-auto")
-                && testDescription.contains(" clientBulkWrite "),
-                "Skipping until JAVA-4586 is implemented");
-
     }
 
     private static Collection<Arguments> data() throws URISyntaxException, IOException {