Skip to content

Commit 5a754d1

Browse files
W-A-Jamesnbbeeken
authored andcommitted
test(NODE-6120): Implement Unified test runner changes for CSOT (#4121)
1 parent 227ee0d commit 5a754d1

25 files changed

+547
-37
lines changed

test/spec/unified-test-format/Makefile

+31-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
SCHEMA=../schema-1.5.json
1+
SCHEMA=../schema-1.21.json
22

3-
.PHONY: all invalid valid-fail valid-pass versioned-api load-balancers gridfs transactions crud collection-management sessions command-monitoring HAS_AJV
3+
.PHONY: all invalid valid-fail valid-pass atlas-data-lake versioned-api load-balancers gridfs transactions transactions-convenient-api crud collection-management read-write-concern retryable-reads retryable-writes sessions command-logging-and-monitoring client-side-operations-timeout HAS_AJV
44

5-
all: invalid valid-fail valid-pass versioned-api load-balancers gridfs transactions crud collection-management sessions command-monitoring
5+
all: invalid valid-fail valid-pass atlas-data-lake versioned-api load-balancers gridfs transactions transactions-convenient-api change-streams crud collection-management read-write-concern retryable-reads retryable-writes sessions command-logging-and-monitoring client-side-operations-timeout client-side-encryption
66

77
invalid: HAS_AJV
88
@# Redirect stdout to hide expected validation errors
@@ -14,6 +14,9 @@ valid-fail: HAS_AJV
1414
valid-pass: HAS_AJV
1515
@ajv test -s $(SCHEMA) -d "valid-pass/*.yml" --valid
1616

17+
atlas-data-lake: HAS_AJV
18+
@ajv test -s $(SCHEMA) -d "../../atlas-data-lake-testing/tests/unified/*.yml" --valid
19+
1720
versioned-api: HAS_AJV
1821
@ajv test -s $(SCHEMA) -d "../../versioned-api/tests/*.yml" --valid
1922

@@ -26,17 +29,39 @@ gridfs: HAS_AJV
2629
transactions: HAS_AJV
2730
@ajv test -s $(SCHEMA) -d "../../transactions/tests/unified/*.yml" --valid
2831

32+
transactions-convenient-api: HAS_AJV
33+
@ajv test -s $(SCHEMA) -d "../../transactions-convenient-api/tests/unified/*.yml" --valid
34+
35+
change-streams: HAS_AJV
36+
@ajv test -s $(SCHEMA) -d "../../change-streams/tests/unified/*.yml" --valid
37+
38+
client-side-operations-timeout: HAS_AJV
39+
@ajv test -s $(SCHEMA) -d "../../client-side-operations-timeout/tests/*.yml" --valid
40+
2941
crud: HAS_AJV
3042
@ajv test -s $(SCHEMA) -d "../../crud/tests/unified/*.yml" --valid
3143

3244
collection-management: HAS_AJV
3345
@ajv test -s $(SCHEMA) -d "../../collection-management/tests/*.yml" --valid
3446

47+
read-write-concern: HAS_AJV
48+
@ajv test -s $(SCHEMA) -d "../../read-write-concern/tests/operation/*.yml" --valid
49+
50+
retryable-reads: HAS_AJV
51+
@ajv test -s $(SCHEMA) -d "../../retryable-reads/tests/unified/*.yml" --valid
52+
53+
retryable-writes: HAS_AJV
54+
@ajv test -s $(SCHEMA) -d "../../retryable-writes/tests/unified/*.yml" --valid
55+
3556
sessions: HAS_AJV
36-
@ajv test -s $(SCHEMA) -d "../../sessions/tests/unified/*.yml" --valid
57+
@ajv test -s $(SCHEMA) -d "../../sessions/tests/*.yml" --valid
58+
59+
command-logging-and-monitoring: HAS_AJV
60+
@ajv test -s $(SCHEMA) -d "../../command-logging-and-monitoring/tests/logging/*.yml" --valid
61+
@ajv test -s $(SCHEMA) -d "../../command-logging-and-monitoring/tests/monitoring/*.yml" --valid
3762

38-
command-monitoring: HAS_AJV
39-
@ajv test -s $(SCHEMA) -d "../../command-monitoring/tests/unified/*.yml" --valid
63+
client-side-encryption: HAS_AJV
64+
@ajv test -s $(SCHEMA) -d "../../client-side-encryption/tests/unified/*.yml" --valid
4065

4166
HAS_AJV:
4267
@if ! command -v ajv > /dev/null; then \

test/spec/unified-test-format/valid-pass/collectionData-createOptions.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
description: collectionData-createOptions
2-
32
schemaVersion: "1.9"
4-
53
runOnRequirements:
64
- minServerVersion: "3.6"
75
# Capped collections cannot be created on serverless instances.
86
serverless: forbid
9-
107
createEntities:
118
- client:
129
id: &client0 client0
@@ -18,7 +15,6 @@ createEntities:
1815
id: &collection0 collection0
1916
database: *database0
2017
collectionName: &collection0Name coll0
21-
2218
initialData:
2319
- collectionName: *collection0Name
2420
databaseName: *database0Name
@@ -28,7 +24,6 @@ initialData:
2824
size: &cappedSize 4096
2925
documents:
3026
- { _id: 1, x: 11 }
31-
3227
tests:
3328
- description: collection is created with the correct options
3429
operations:
@@ -39,4 +34,4 @@ tests:
3934
- $collStats: { storageStats: {} }
4035
- $project: { capped: '$storageStats.capped', maxSize: '$storageStats.maxSize'}
4136
expectResult:
42-
- { capped: true, maxSize: *cappedSize }
37+
- { capped: true, maxSize: *cappedSize }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"description": "createEntities-operation",
3+
"schemaVersion": "1.9",
4+
"tests": [
5+
{
6+
"description": "createEntities operation",
7+
"operations": [
8+
{
9+
"name": "createEntities",
10+
"object": "testRunner",
11+
"arguments": {
12+
"entities": [
13+
{
14+
"client": {
15+
"id": "client1",
16+
"observeEvents": [
17+
"commandStartedEvent"
18+
]
19+
}
20+
},
21+
{
22+
"database": {
23+
"id": "database1",
24+
"client": "client1",
25+
"databaseName": "database1"
26+
}
27+
},
28+
{
29+
"collection": {
30+
"id": "collection1",
31+
"database": "database1",
32+
"collectionName": "coll1"
33+
}
34+
}
35+
]
36+
}
37+
},
38+
{
39+
"name": "deleteOne",
40+
"object": "collection1",
41+
"arguments": {
42+
"filter": {
43+
"_id": 1
44+
}
45+
}
46+
}
47+
],
48+
"expectEvents": [
49+
{
50+
"client": "client1",
51+
"events": [
52+
{
53+
"commandStartedEvent": {
54+
"command": {
55+
"delete": "coll1",
56+
"deletes": [
57+
{
58+
"q": {
59+
"_id": 1
60+
},
61+
"limit": 1
62+
}
63+
]
64+
},
65+
"commandName": "delete",
66+
"databaseName": "database1"
67+
}
68+
}
69+
]
70+
}
71+
]
72+
}
73+
]
74+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
description: createEntities-operation
2+
3+
# Note: createEntities is not technically in the 1.9 schema but was introduced at the same time.
4+
schemaVersion: "1.9"
5+
6+
tests:
7+
- description: createEntities operation
8+
operations:
9+
- name: createEntities
10+
object: testRunner
11+
arguments:
12+
entities:
13+
- client:
14+
id: &client1 client1
15+
observeEvents: [ commandStartedEvent ]
16+
- database:
17+
id: &database1 database1
18+
client: *client1
19+
databaseName: &database1Name database1
20+
- collection:
21+
id: &collection1 collection1
22+
database: *database1
23+
collectionName: &collection1Name coll1
24+
- name: deleteOne
25+
object: *collection1
26+
arguments:
27+
filter: { _id : 1 }
28+
expectEvents:
29+
- client: *client1
30+
events:
31+
- commandStartedEvent:
32+
command:
33+
delete: *collection1Name
34+
deletes:
35+
- q: { _id: 1 }
36+
limit: 1
37+
commandName: delete
38+
databaseName: *database1Name
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"description": "entity-cursor-iterateOnce",
3+
"schemaVersion": "1.9",
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": [
97+
"int",
98+
"long"
99+
]
100+
},
101+
"collection": "coll0"
102+
},
103+
"commandName": "getMore"
104+
}
105+
}
106+
]
107+
}
108+
]
109+
}
110+
]
111+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
description: entity-cursor-iterateOnce
2+
3+
# Note: iterateOnce is not technically in the 1.9 schema but was introduced at the same time.
4+
schemaVersion: "1.9"
5+
6+
createEntities:
7+
- client:
8+
id: &client0 client0
9+
observeEvents: [ commandStartedEvent ]
10+
- database:
11+
id: &database0 database0
12+
client: *client0
13+
databaseName: &database0Name database0
14+
- collection:
15+
id: &collection0 collection0
16+
database: *database0
17+
collectionName: &collection0Name coll0
18+
19+
initialData:
20+
- databaseName: *database0Name
21+
collectionName: *collection0Name
22+
documents:
23+
- _id: 1
24+
- _id: 2
25+
- _id: 3
26+
27+
tests:
28+
- description: iterateOnce
29+
operations:
30+
- name: createFindCursor
31+
object: *collection0
32+
arguments:
33+
filter: {}
34+
batchSize: 2
35+
saveResultAsEntity: &cursor0 cursor0
36+
- name: iterateUntilDocumentOrError
37+
object: *cursor0
38+
expectResult: { _id: 1 }
39+
- name: iterateUntilDocumentOrError
40+
object: *cursor0
41+
expectResult: { _id: 2 }
42+
# This operation could be iterateUntilDocumentOrError, but we use iterateOne to ensure that drivers support it.
43+
- name: iterateOnce
44+
object: *cursor0
45+
expectEvents:
46+
- client: *client0
47+
events:
48+
- commandStartedEvent:
49+
command:
50+
find: *collection0Name
51+
filter: {}
52+
batchSize: 2
53+
commandName: find
54+
databaseName: *database0Name
55+
- commandStartedEvent:
56+
command:
57+
getMore: { $$type: [ int, long ] }
58+
collection: *collection0Name
59+
commandName: getMore

0 commit comments

Comments
 (0)