2025-03-17 20:58:26 +01:00

134 lines
2.7 KiB
YAML

# Test snapshot isolation.
# This test doesn't check contents of command-started events.
runOn:
-
minServerVersion: "4.0"
topology: ["replicaset"]
-
minServerVersion: "4.1.8"
topology: ["sharded"]
database_name: &database_name "transaction-tests"
collection_name: &collection_name "test"
data: []
tests:
- description: one transaction
operations:
- name: startTransaction
object: session0
- name: insertOne
object: collection
arguments:
session: session0
document:
_id: 1
result:
insertedId: 1
- name: find
object: collection
arguments:
session: session0
filter:
_id: 1
result:
- {_id: 1}
- name: find
object: collection
arguments:
session: session1
filter:
_id: 1
result: []
- name: find
object: collection
arguments:
filter:
_id: 1
result: []
- name: commitTransaction
object: session0
- name: find
object: collection
arguments:
session: session1
filter:
_id: 1
result:
- {_id: 1}
- name: find
object: collection
arguments:
filter:
_id: 1
result:
- {_id: 1}
outcome:
collection:
data:
- _id: 1
- description: two transactions
operations:
- name: startTransaction
object: session0
- name: startTransaction
object: session1
- name: insertOne
object: collection
arguments:
session: session0
document:
_id: 1
result:
insertedId: 1
- name: find
object: collection
arguments:
session: session0
filter:
_id: 1
result:
- {_id: 1}
- name: find
object: collection
arguments:
session: session1
filter:
_id: 1
result: []
- name: find
object: collection
arguments:
filter:
_id: 1
result: []
- name: commitTransaction
object: session0
# Snapshot isolation in session1, not read-committed.
- name: find
object: collection
arguments:
session: session1
filter:
_id: 1
result: []
- name: find
object: collection
arguments:
filter:
_id: 1
result:
- {_id: 1}
- name: commitTransaction
object: session1
outcome:
collection:
data:
- {_id: 1}