Skip to content

Commit f195b4e

Browse files
authored
GODRIVER-2384 Unified test runner changes for CSOT. (#912)
1 parent db84b1d commit f195b4e

11 files changed

+477
-8
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"description": "entity-cursor-iterateOnce",
3+
"schemaVersion": "1.5",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"observeEvents": [
9+
"commandStartedEvent"
10+
]
11+
}
12+
},
13+
{
14+
"database": {
15+
"id": "database0",
16+
"client": "client0",
17+
"databaseName": "database0"
18+
}
19+
},
20+
{
21+
"collection": {
22+
"id": "collection0",
23+
"database": "database0",
24+
"collectionName": "coll0"
25+
}
26+
}
27+
],
28+
"initialData": [
29+
{
30+
"databaseName": "database0",
31+
"collectionName": "coll0",
32+
"documents": [
33+
{
34+
"_id": 1
35+
},
36+
{
37+
"_id": 2
38+
},
39+
{
40+
"_id": 3
41+
}
42+
]
43+
}
44+
],
45+
"tests": [
46+
{
47+
"description": "iterateOnce",
48+
"operations": [
49+
{
50+
"name": "createFindCursor",
51+
"object": "collection0",
52+
"arguments": {
53+
"filter": {},
54+
"batchSize": 2
55+
},
56+
"saveResultAsEntity": "cursor0"
57+
},
58+
{
59+
"name": "iterateUntilDocumentOrError",
60+
"object": "cursor0",
61+
"expectResult": {
62+
"_id": 1
63+
}
64+
},
65+
{
66+
"name": "iterateUntilDocumentOrError",
67+
"object": "cursor0",
68+
"expectResult": {
69+
"_id": 2
70+
}
71+
},
72+
{
73+
"name": "iterateOnce",
74+
"object": "cursor0"
75+
}
76+
],
77+
"expectEvents": [
78+
{
79+
"client": "client0",
80+
"events": [
81+
{
82+
"commandStartedEvent": {
83+
"command": {
84+
"find": "coll0",
85+
"filter": {},
86+
"batchSize": 2
87+
},
88+
"commandName": "find",
89+
"databaseName": "database0"
90+
}
91+
},
92+
{
93+
"commandStartedEvent": {
94+
"command": {
95+
"getMore": {
96+
"$$type": "long"
97+
},
98+
"collection": "coll0"
99+
},
100+
"commandName": "getMore"
101+
}
102+
}
103+
]
104+
}
105+
]
106+
}
107+
]
108+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
description: entity-cursor-iterateOnce
2+
3+
schemaVersion: '1.5'
4+
5+
createEntities:
6+
- client:
7+
id: &client0 client0
8+
observeEvents: [ commandStartedEvent ]
9+
- database:
10+
id: &database0 database0
11+
client: *client0
12+
databaseName: &database0Name database0
13+
- collection:
14+
id: &collection0 collection0
15+
database: *database0
16+
collectionName: &collection0Name coll0
17+
18+
initialData:
19+
- databaseName: *database0Name
20+
collectionName: *collection0Name
21+
documents:
22+
- _id: 1
23+
- _id: 2
24+
- _id: 3
25+
26+
tests:
27+
- description: iterateOnce
28+
operations:
29+
- name: createFindCursor
30+
object: *collection0
31+
arguments:
32+
filter: {}
33+
batchSize: 2
34+
saveResultAsEntity: &cursor0 cursor0
35+
- name: iterateUntilDocumentOrError
36+
object: *cursor0
37+
expectResult: { _id: 1 }
38+
- name: iterateUntilDocumentOrError
39+
object: *cursor0
40+
expectResult: { _id: 2 }
41+
# This operation could be iterateUntilDocumentOrError, but we use iterateOne to ensure that drivers support it.
42+
- name: iterateOnce
43+
object: *cursor0
44+
expectEvents:
45+
- client: *client0
46+
events:
47+
- commandStartedEvent:
48+
command:
49+
find: *collection0Name
50+
filter: {}
51+
batchSize: 2
52+
commandName: find
53+
databaseName: *database0Name
54+
- commandStartedEvent:
55+
command:
56+
getMore: { $$type: long }
57+
collection: *collection0Name
58+
commandName: getMore
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"description": "initialCollectionData-collectionOptions",
3+
"schemaVersion": "1.5",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0"
8+
}
9+
},
10+
{
11+
"database": {
12+
"id": "database0",
13+
"client": "client0",
14+
"databaseName": "database0"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "coll0"
22+
}
23+
}
24+
],
25+
"initialData": [
26+
{
27+
"collectionName": "coll0",
28+
"databaseName": "database0",
29+
"collectionOptions": {
30+
"capped": true,
31+
"size": 512
32+
},
33+
"documents": [
34+
{
35+
"_id": 1,
36+
"x": 11
37+
}
38+
]
39+
}
40+
],
41+
"tests": [
42+
{
43+
"description": "collection is created with the correct options",
44+
"runOnRequirements": [
45+
{
46+
"minServerVersion": "3.6"
47+
}
48+
],
49+
"operations": [
50+
{
51+
"name": "runCommand",
52+
"object": "database0",
53+
"arguments": {
54+
"commandName": "collStats",
55+
"command": {
56+
"collStats": "coll0",
57+
"scale": 1
58+
}
59+
},
60+
"expectResult": {
61+
"capped": true,
62+
"maxSize": 512
63+
}
64+
}
65+
]
66+
}
67+
]
68+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
description: initialCollectionData-collectionOptions
2+
3+
schemaVersion: '1.5'
4+
5+
createEntities:
6+
- client:
7+
id: &client0 client0
8+
- database:
9+
id: &database0 database0
10+
client: *client0
11+
databaseName: &database0Name database0
12+
- collection:
13+
id: &collection0 collection0
14+
database: *database0
15+
collectionName: &collection0Name coll0
16+
17+
initialData:
18+
- collectionName: *collection0Name
19+
databaseName: *database0Name
20+
collectionOptions:
21+
capped: true
22+
size: &cappedSize 512
23+
documents:
24+
- { _id: 1, x: 11 }
25+
26+
tests:
27+
- description: collection is created with the correct options
28+
runOnRequirements:
29+
- minServerVersion: "3.6"
30+
operations:
31+
# Execute a collStats command to ensure the collection was created with the correct options.
32+
- name: runCommand
33+
object: *database0
34+
arguments:
35+
commandName: collStats
36+
command:
37+
collStats: *collection0Name
38+
scale: 1
39+
expectResult:
40+
capped: true
41+
maxSize: *cappedSize
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"description": "matches-lte-operator",
3+
"schemaVersion": "1.5",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"observeEvents": [
9+
"commandStartedEvent"
10+
]
11+
}
12+
},
13+
{
14+
"database": {
15+
"id": "database0",
16+
"client": "client0",
17+
"databaseName": "database0Name"
18+
}
19+
},
20+
{
21+
"collection": {
22+
"id": "collection0",
23+
"database": "database0",
24+
"collectionName": "coll0"
25+
}
26+
}
27+
],
28+
"initialData": [
29+
{
30+
"collectionName": "coll0",
31+
"databaseName": "database0Name",
32+
"documents": []
33+
}
34+
],
35+
"tests": [
36+
{
37+
"description": "special lte matching operator",
38+
"operations": [
39+
{
40+
"name": "insertOne",
41+
"object": "collection0",
42+
"arguments": {
43+
"document": {
44+
"_id": 1,
45+
"y": 1
46+
}
47+
}
48+
}
49+
],
50+
"expectEvents": [
51+
{
52+
"client": "client0",
53+
"events": [
54+
{
55+
"commandStartedEvent": {
56+
"command": {
57+
"insert": "coll0",
58+
"documents": [
59+
{
60+
"_id": {
61+
"$$lte": 1
62+
},
63+
"y": {
64+
"$$lte": 2
65+
}
66+
}
67+
]
68+
},
69+
"commandName": "insert",
70+
"databaseName": "database0Name"
71+
}
72+
}
73+
]
74+
}
75+
]
76+
}
77+
]
78+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
description: matches-lte-operator
2+
3+
schemaVersion: '1.5'
4+
5+
createEntities:
6+
- client:
7+
id: &client0 client0
8+
observeEvents: [ commandStartedEvent ]
9+
- database:
10+
id: &database0 database0
11+
client: *client0
12+
databaseName: &database0Name database0Name
13+
- collection:
14+
id: &collection0 collection0
15+
database: *database0
16+
collectionName: &collection0Name coll0
17+
18+
initialData:
19+
- collectionName: *collection0Name
20+
databaseName: *database0Name
21+
documents: []
22+
23+
tests:
24+
- description: special lte matching operator
25+
operations:
26+
- name: insertOne
27+
object: *collection0
28+
arguments:
29+
document: { _id : 1, y: 1 }
30+
expectEvents:
31+
- client: *client0
32+
events:
33+
- commandStartedEvent:
34+
command:
35+
insert: *collection0Name
36+
documents:
37+
# We can make exact assertions here but we use the $$lte operator to ensure drivers support it.
38+
- { _id: { $$lte: 1 }, y: { $$lte: 2 } }
39+
commandName: insert
40+
databaseName: *database0Name

0 commit comments

Comments
 (0)