283 lines
7.0 KiB
JSON
283 lines
7.0 KiB
JSON
{
|
|
"description": "create-collection",
|
|
"schemaVersion": "1.3",
|
|
"runOnRequirements": [
|
|
{
|
|
"minServerVersion": "4.3.4",
|
|
"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"
|
|
}
|
|
}
|
|
],
|
|
"initialData": [
|
|
{
|
|
"collectionName": "test",
|
|
"databaseName": "transaction-tests",
|
|
"documents": []
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "explicitly create collection using create command",
|
|
"operations": [
|
|
{
|
|
"object": "database0",
|
|
"name": "dropCollection",
|
|
"arguments": {
|
|
"collection": "test"
|
|
}
|
|
},
|
|
{
|
|
"object": "session0",
|
|
"name": "startTransaction"
|
|
},
|
|
{
|
|
"object": "database0",
|
|
"name": "createCollection",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"collection": "test"
|
|
}
|
|
},
|
|
{
|
|
"object": "testRunner",
|
|
"name": "assertCollectionNotExists",
|
|
"arguments": {
|
|
"databaseName": "transaction-tests",
|
|
"collectionName": "test"
|
|
}
|
|
},
|
|
{
|
|
"object": "session0",
|
|
"name": "commitTransaction"
|
|
},
|
|
{
|
|
"object": "testRunner",
|
|
"name": "assertCollectionExists",
|
|
"arguments": {
|
|
"databaseName": "transaction-tests",
|
|
"collectionName": "test"
|
|
}
|
|
}
|
|
],
|
|
"expectEvents": [
|
|
{
|
|
"client": "client0",
|
|
"events": [
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"drop": "test",
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "drop",
|
|
"databaseName": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"create": "test",
|
|
"lsid": {
|
|
"$$sessionLsid": "session0"
|
|
},
|
|
"txnNumber": {
|
|
"$numberLong": "1"
|
|
},
|
|
"startTransaction": true,
|
|
"autocommit": false,
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "create",
|
|
"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"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "implicitly create collection using insert",
|
|
"operations": [
|
|
{
|
|
"object": "database0",
|
|
"name": "dropCollection",
|
|
"arguments": {
|
|
"collection": "test"
|
|
}
|
|
},
|
|
{
|
|
"object": "session0",
|
|
"name": "startTransaction"
|
|
},
|
|
{
|
|
"object": "collection0",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"session": "session0",
|
|
"document": {
|
|
"_id": 1
|
|
}
|
|
},
|
|
"expectResult": {
|
|
"$$unsetOrMatches": {
|
|
"insertedId": {
|
|
"$$unsetOrMatches": 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"object": "testRunner",
|
|
"name": "assertCollectionNotExists",
|
|
"arguments": {
|
|
"databaseName": "transaction-tests",
|
|
"collectionName": "test"
|
|
}
|
|
},
|
|
{
|
|
"object": "session0",
|
|
"name": "commitTransaction"
|
|
},
|
|
{
|
|
"object": "testRunner",
|
|
"name": "assertCollectionExists",
|
|
"arguments": {
|
|
"databaseName": "transaction-tests",
|
|
"collectionName": "test"
|
|
}
|
|
}
|
|
],
|
|
"expectEvents": [
|
|
{
|
|
"client": "client0",
|
|
"events": [
|
|
{
|
|
"commandStartedEvent": {
|
|
"command": {
|
|
"drop": "test",
|
|
"writeConcern": {
|
|
"$$exists": false
|
|
}
|
|
},
|
|
"commandName": "drop",
|
|
"databaseName": "transaction-tests"
|
|
}
|
|
},
|
|
{
|
|
"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"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|