Skip to content

GODRIVER-2384 Unified test runner changes for CSOT. #912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions data/unified-test-format/valid-pass/entity-cursor-iterateOnce.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"description": "entity-cursor-iterateOnce",
"schemaVersion": "1.5",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"databaseName": "database0",
"collectionName": "coll0",
"documents": [
{
"_id": 1
},
{
"_id": 2
},
{
"_id": 3
}
]
}
],
"tests": [
{
"description": "iterateOnce",
"operations": [
{
"name": "createFindCursor",
"object": "collection0",
"arguments": {
"filter": {},
"batchSize": 2
},
"saveResultAsEntity": "cursor0"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor0",
"expectResult": {
"_id": 1
}
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor0",
"expectResult": {
"_id": 2
}
},
{
"name": "iterateOnce",
"object": "cursor0"
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "coll0",
"filter": {},
"batchSize": 2
},
"commandName": "find",
"databaseName": "database0"
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
},
"collection": "coll0"
},
"commandName": "getMore"
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
description: entity-cursor-iterateOnce

schemaVersion: '1.5'

createEntities:
- client:
id: &client0 client0
observeEvents: [ commandStartedEvent ]
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name database0
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name coll0

initialData:
- databaseName: *database0Name
collectionName: *collection0Name
documents:
- _id: 1
- _id: 2
- _id: 3

tests:
- description: iterateOnce
operations:
- name: createFindCursor
object: *collection0
arguments:
filter: {}
batchSize: 2
saveResultAsEntity: &cursor0 cursor0
- name: iterateUntilDocumentOrError
object: *cursor0
expectResult: { _id: 1 }
- name: iterateUntilDocumentOrError
object: *cursor0
expectResult: { _id: 2 }
# This operation could be iterateUntilDocumentOrError, but we use iterateOne to ensure that drivers support it.
- name: iterateOnce
object: *cursor0
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
find: *collection0Name
filter: {}
batchSize: 2
commandName: find
databaseName: *database0Name
- commandStartedEvent:
command:
getMore: { $$type: long }
collection: *collection0Name
commandName: getMore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"description": "initialCollectionData-collectionOptions",
"schemaVersion": "1.5",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"collectionName": "coll0",
"databaseName": "database0",
"collectionOptions": {
"capped": true,
"size": 512
},
"documents": [
{
"_id": 1,
"x": 11
}
]
}
],
"tests": [
{
"description": "collection is created with the correct options",
"runOnRequirements": [
{
"minServerVersion": "3.6"
}
],
"operations": [
{
"name": "runCommand",
"object": "database0",
"arguments": {
"commandName": "collStats",
"command": {
"collStats": "coll0",
"scale": 1
}
},
"expectResult": {
"capped": true,
"maxSize": 512
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
description: initialCollectionData-collectionOptions

schemaVersion: '1.5'

createEntities:
- client:
id: &client0 client0
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name database0
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name coll0

initialData:
- collectionName: *collection0Name
databaseName: *database0Name
collectionOptions:
capped: true
size: &cappedSize 512
documents:
- { _id: 1, x: 11 }

tests:
- description: collection is created with the correct options
runOnRequirements:
- minServerVersion: "3.6"
operations:
# Execute a collStats command to ensure the collection was created with the correct options.
- name: runCommand
object: *database0
arguments:
commandName: collStats
command:
collStats: *collection0Name
scale: 1
expectResult:
capped: true
maxSize: *cappedSize
78 changes: 78 additions & 0 deletions data/unified-test-format/valid-pass/matches-lte-operator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"description": "matches-lte-operator",
"schemaVersion": "1.5",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0Name"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"collectionName": "coll0",
"databaseName": "database0Name",
"documents": []
}
],
"tests": [
{
"description": "special lte matching operator",
"operations": [
{
"name": "insertOne",
"object": "collection0",
"arguments": {
"document": {
"_id": 1,
"y": 1
}
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"insert": "coll0",
"documents": [
{
"_id": {
"$$lte": 1
},
"y": {
"$$lte": 2
}
}
]
},
"commandName": "insert",
"databaseName": "database0Name"
}
}
]
}
]
}
]
}
40 changes: 40 additions & 0 deletions data/unified-test-format/valid-pass/matches-lte-operator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
description: matches-lte-operator

schemaVersion: '1.5'

createEntities:
- client:
id: &client0 client0
observeEvents: [ commandStartedEvent ]
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name database0Name
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name coll0

initialData:
- collectionName: *collection0Name
databaseName: *database0Name
documents: []

tests:
- description: special lte matching operator
operations:
- name: insertOne
object: *collection0
arguments:
document: { _id : 1, y: 1 }
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
insert: *collection0Name
documents:
# We can make exact assertions here but we use the $$lte operator to ensure drivers support it.
- { _id: { $$lte: 1 }, y: { $$lte: 2 } }
commandName: insert
databaseName: *database0Name
Loading