bson/testdata/transactions/legacy/create-index.yml
2025-03-17 20:58:26 +01:00

153 lines
4.1 KiB
YAML

runOn:
-
minServerVersion: "4.3.4"
topology: ["replicaset", "sharded"]
database_name: &database_name "transaction-tests"
collection_name: &collection_name "test"
data: []
tests:
- description: create index on a non-existing collection
operations:
- name: dropCollection
object: database
arguments:
collection: *collection_name
- name: startTransaction
object: session0
- name: createIndex
object: collection
arguments:
session: session0
name: &index_name "t_1"
keys:
x: 1
- name: assertIndexNotExists
object: testRunner
arguments:
database: *database_name
collection: *collection_name
index: *index_name
- name: commitTransaction
object: session0
- name: assertIndexExists
object: testRunner
arguments:
database: *database_name
collection: *collection_name
index: *index_name
expectations:
- command_started_event:
command:
drop: *collection_name
writeConcern:
command_name: drop
database_name: *database_name
- command_started_event:
command:
createIndexes: *collection_name
indexes:
- name: *index_name
key:
x: 1
lsid: session0
txnNumber:
$numberLong: "1"
startTransaction: true
autocommit: false
writeConcern:
command_name: createIndexes
database_name: *database_name
- command_started_event:
command:
commitTransaction: 1
lsid: session0
txnNumber:
$numberLong: "1"
startTransaction:
autocommit: false
writeConcern:
command_name: commitTransaction
database_name: admin
- description: create index on a collection created within the same transaction
operations:
- name: dropCollection
object: database
arguments:
collection: *collection_name
- name: startTransaction
object: session0
- name: createCollection
object: database
arguments:
session: session0
collection: *collection_name
- name: createIndex
object: collection
arguments:
session: session0
name: *index_name
keys:
x: 1
- name: assertIndexNotExists
object: testRunner
arguments:
database: *database_name
collection: *collection_name
index: *index_name
- name: commitTransaction
object: session0
- name: assertIndexExists
object: testRunner
arguments:
database: *database_name
collection: *collection_name
index: *index_name
expectations:
- command_started_event:
command:
drop: *collection_name
writeConcern:
command_name: drop
database_name: *database_name
- command_started_event:
command:
create: *collection_name
lsid: session0
txnNumber:
$numberLong: "1"
startTransaction: true
autocommit: false
writeConcern:
command_name: create
database_name: *database_name
- command_started_event:
command:
createIndexes: *collection_name
indexes:
- name: *index_name
key:
x: 1
lsid: session0
writeConcern:
command_name: createIndexes
database_name: *database_name
- command_started_event:
command:
commitTransaction: 1
lsid: session0
txnNumber:
$numberLong: "1"
startTransaction:
autocommit: false
writeConcern:
command_name: commitTransaction
database_name: admin