Skip to content

Commit 9ca4800

Browse files
committed
PYTHON-1740 - Fix up transaction tests
1 parent 956fd92 commit 9ca4800

13 files changed

+7
-88
lines changed

test/test_transactions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,8 @@ def run_scenario(self):
700700

701701
database_name = scenario_def['database_name']
702702
collection_name = scenario_def['collection_name']
703-
write_concern_db = client.get_database(
703+
# Don't use the test client to load data.
704+
write_concern_db = client_context.client.get_database(
704705
database_name, write_concern=WriteConcern(w='majority'))
705706
write_concern_coll = write_concern_db[collection_name]
706707
write_concern_coll.drop()

test/transactions/causal-consistency.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{
1616
"description": "causal consistency",
1717
"clientOptions": {
18-
"retryWrites": false
18+
"retryWrites": false
1919
},
2020
"operations": [
2121
{
@@ -165,7 +165,7 @@
165165
{
166166
"description": "causal consistency disabled",
167167
"clientOptions": {
168-
"retryWrites": false
168+
"retryWrites": false
169169
},
170170
"sessionOptions": {
171171
"session0": {

test/transactions/commit.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@
673673
{
674674
"description": "reset session state commit",
675675
"clientOptions": {
676-
"retryWrites": false
676+
"retryWrites": false
677677
},
678678
"operations": [
679679
{
@@ -795,7 +795,7 @@
795795
{
796796
"description": "reset session state abort",
797797
"clientOptions": {
798-
"retryWrites": false
798+
"retryWrites": false
799799
},
800800
"operations": [
801801
{

test/transactions/delete.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
"tests": [
2626
{
2727
"description": "delete",
28-
"clientOptions": {
29-
"retryWrites": false
30-
},
3128
"operations": [
3229
{
3330
"name": "startTransaction",
@@ -187,9 +184,6 @@
187184
},
188185
{
189186
"description": "collection writeConcern ignored for delete",
190-
"clientOptions": {
191-
"retryWrites": false
192-
},
193187
"operations": [
194188
{
195189
"name": "startTransaction",

test/transactions/findOneAndDelete.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"tests": [
2020
{
2121
"description": "findOneAndDelete",
22-
"clientOptions": {
23-
"retryWrites": false
24-
},
2522
"operations": [
2623
{
2724
"name": "startTransaction",
@@ -132,9 +129,6 @@
132129
},
133130
{
134131
"description": "collection writeConcern ignored for findOneAndDelete",
135-
"clientOptions": {
136-
"retryWrites": false
137-
},
138132
"operations": [
139133
{
140134
"name": "startTransaction",

test/transactions/findOneAndReplace.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"tests": [
2020
{
2121
"description": "findOneAndReplace",
22-
"clientOptions": {
23-
"retryWrites": false
24-
},
2522
"operations": [
2623
{
2724
"name": "startTransaction",
@@ -159,9 +156,6 @@
159156
},
160157
{
161158
"description": "collection writeConcern ignored for findOneAndReplace",
162-
"clientOptions": {
163-
"retryWrites": false
164-
},
165159
"operations": [
166160
{
167161
"name": "startTransaction",

test/transactions/findOneAndUpdate.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"tests": [
2020
{
2121
"description": "findOneAndUpdate",
22-
"clientOptions": {
23-
"retryWrites": false
24-
},
2522
"operations": [
2623
{
2724
"name": "startTransaction",
@@ -313,9 +310,6 @@
313310
},
314311
{
315312
"description": "collection writeConcern ignored for findOneAndUpdate",
316-
"clientOptions": {
317-
"retryWrites": false
318-
},
319313
"operations": [
320314
{
321315
"name": "startTransaction",

test/transactions/insert.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@
430430
{
431431
"description": "collection writeConcern without transaction",
432432
"clientOptions": {
433-
"retryWrites": false
433+
"retryWrites": false
434434
},
435435
"operations": [
436436
{

test/transactions/mongos-pin-auto.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
"tests": [
1616
{
1717
"description": "remain pinned after non-transient Interrupted error on insertOne",
18-
"clientOptions": {
19-
"retryWrites": false
20-
},
2118
"useMultipleMongoses": true,
2219
"operations": [
2320
{
@@ -168,9 +165,6 @@
168165
},
169166
{
170167
"description": "unpin after transient error within a transaction",
171-
"clientOptions": {
172-
"retryWrites": false
173-
},
174168
"useMultipleMongoses": true,
175169
"operations": [
176170
{

test/transactions/pin-mongos.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -925,9 +925,6 @@
925925
},
926926
{
927927
"description": "unpin after transient error within a transaction",
928-
"clientOptions": {
929-
"retryWrites": false
930-
},
931928
"useMultipleMongoses": true,
932929
"operations": [
933930
{
@@ -1071,7 +1068,6 @@
10711068
"description": "unpin after transient error within a transaction and commit",
10721069
"useMultipleMongoses": true,
10731070
"clientOptions": {
1074-
"retryWrites": false,
10751071
"heartbeatFrequencyMS": 5000
10761072
},
10771073
"operations": [

0 commit comments

Comments
 (0)