Skip to content

Commit 2061567

Browse files
committed
add sharded spec test
1 parent 2d6c8f3 commit 2061567

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"description": "sharded-emit-topology-description-changed-before-close",
3+
"schemaVersion": "1.16",
4+
"runOnRequirements": [
5+
{
6+
"topologies": [
7+
"sharded"
8+
],
9+
"minServerVersion": "4.4"
10+
}
11+
],
12+
"tests": [
13+
{
14+
"description": "Topology lifecycle",
15+
"operations": [
16+
{
17+
"name": "createEntities",
18+
"object": "testRunner",
19+
"arguments": {
20+
"entities": [
21+
{
22+
"client": {
23+
"id": "client",
24+
"observeEvents": [
25+
"topologyDescriptionChangedEvent",
26+
"topologyOpeningEvent",
27+
"topologyClosedEvent"
28+
]
29+
}
30+
}
31+
]
32+
}
33+
},
34+
{
35+
"name": "waitForEvent",
36+
"object": "testRunner",
37+
"arguments": {
38+
"client": "client",
39+
"event": {
40+
"topologyDescriptionChangedEvent": {}
41+
},
42+
"count": 2
43+
}
44+
},
45+
{
46+
"name": "close",
47+
"object": "client"
48+
}
49+
],
50+
"expectEvents": [
51+
{
52+
"client": "client",
53+
"eventType": "sdam",
54+
"ignoreExtraEvents": true,
55+
"events": [
56+
{
57+
"topologyOpeningEvent": {}
58+
},
59+
{
60+
"topologyDescriptionChangedEvent": {
61+
"previousDescription": {
62+
"type": "Unknown"
63+
},
64+
"newDescription": {
65+
"type": "Unknown"
66+
}
67+
}
68+
},
69+
{
70+
"topologyDescriptionChangedEvent": {
71+
"previousDescription": {
72+
"type": "Unknown"
73+
},
74+
"newDescription": {
75+
"type": "Sharded"
76+
}
77+
}
78+
},
79+
{
80+
"topologyDescriptionChangedEvent": {
81+
"previousDescription": {
82+
"type": "Sharded"
83+
},
84+
"newDescription": {
85+
"type": "Unknown"
86+
}
87+
}
88+
},
89+
{
90+
"topologyClosedEvent": {}
91+
}
92+
]
93+
}
94+
]
95+
}
96+
]
97+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
description: "sharded-emit-topology-description-changed-before-close"
2+
3+
schemaVersion: "1.16"
4+
5+
runOnRequirements:
6+
- topologies:
7+
- sharded
8+
minServerVersion: "4.4" # awaitable hello
9+
10+
tests:
11+
- description: "Topology lifecycle"
12+
operations:
13+
- name: createEntities
14+
object: testRunner
15+
arguments:
16+
entities:
17+
- client:
18+
id: &client client
19+
observeEvents:
20+
- topologyDescriptionChangedEvent
21+
- topologyOpeningEvent
22+
- topologyClosedEvent
23+
# ensure the topology has been fully discovered before closing the client.
24+
# expected events are initial server discovery and server connect event.
25+
- name: waitForEvent
26+
object: testRunner
27+
arguments:
28+
client: *client
29+
event:
30+
topologyDescriptionChangedEvent: {}
31+
count: 2
32+
- name: close
33+
object: *client
34+
expectEvents:
35+
- client: *client
36+
eventType: sdam
37+
ignoreExtraEvents: true
38+
events:
39+
- topologyOpeningEvent: {}
40+
- topologyDescriptionChangedEvent: # unknown -> unknown w disconnected server
41+
previousDescription:
42+
type: "Unknown"
43+
newDescription:
44+
type: "Unknown"
45+
- topologyDescriptionChangedEvent: # server connected
46+
previousDescription:
47+
type: "Unknown"
48+
newDescription:
49+
type: "Sharded"
50+
- topologyDescriptionChangedEvent: # sharded -> unknown
51+
previousDescription:
52+
type: "Sharded"
53+
newDescription:
54+
type: "Unknown"
55+
- topologyClosedEvent: {}

0 commit comments

Comments
 (0)