Skip to content

Commit efd906a

Browse files
author
Thomas Reggi
authored
test: add directConnection spec tests
NODE-2788
1 parent 6acced0 commit efd906a

11 files changed

+190
-15
lines changed

test/spec/server-discovery-and-monitoring/integration/isMaster-command-error.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tests:
2727
appname: commandErrorHandshakeTest
2828
operations:
2929
# The command error on the initial handshake should mark the server
30-
# Unknown and clear the pool.
30+
# Unknown (emitting a ServerDescriptionChangedEvent) and clear the pool.
3131
- name: waitForEvent
3232
object: testRunner
3333
arguments:

test/spec/server-discovery-and-monitoring/integration/isMaster-network-error.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ tests:
2626
appname: networkErrorHandshakeTest
2727
operations:
2828
# The network error on the initial handshake should mark the server
29-
# Unknown and clear the pool.
29+
# Unknown (emitting a ServerDescriptionChangedEvent) and clear the pool.
3030
- name: waitForEvent
3131
object: testRunner
3232
arguments:

test/spec/server-discovery-and-monitoring/integration/isMaster-timeout.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tests:
2727
appname: timeoutMonitorHandshakeTest
2828
operations:
2929
# The network error on the initial handshake should mark the server
30-
# Unknown and clear the pool.
30+
# Unknown (emitting a ServerDescriptionChangedEvent) and clear the pool.
3131
- name: waitForEvent
3232
object: testRunner
3333
arguments:
@@ -101,6 +101,9 @@ tests:
101101
failCommands: ["isMaster"]
102102
appName: timeoutMonitorCheckTest
103103
blockConnection: true
104+
# blockTimeMS is evaluated after the waiting for heartbeatFrequencyMS server-side, so this value only
105+
# needs to be greater than connectTimeoutMS. The driver will wait for (500+750)ms and the server will
106+
# respond after (500+1000)ms.
104107
blockTimeMS: 1000
105108
# The network error on the next check should mark the server Unknown and
106109
# clear the pool.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"description": "Monitoring a discovered standalone connection",
3+
"uri": "mongodb://a:27017/?directConnection=false",
4+
"phases": [
5+
{
6+
"responses": [
7+
[
8+
"a:27017",
9+
{
10+
"ok": 1,
11+
"ismaster": true,
12+
"minWireVersion": 0,
13+
"maxWireVersion": 4
14+
}
15+
]
16+
],
17+
"outcome": {
18+
"events": [
19+
{
20+
"topology_opening_event": {
21+
"topologyId": "42"
22+
}
23+
},
24+
{
25+
"topology_description_changed_event": {
26+
"topologyId": "42",
27+
"previousDescription": {
28+
"topologyType": "Unknown",
29+
"servers": []
30+
},
31+
"newDescription": {
32+
"topologyType": "Unknown",
33+
"servers": [
34+
{
35+
"address": "a:27017",
36+
"arbiters": [],
37+
"hosts": [],
38+
"passives": [],
39+
"type": "Unknown"
40+
}
41+
]
42+
}
43+
}
44+
},
45+
{
46+
"server_opening_event": {
47+
"topologyId": "42",
48+
"address": "a:27017"
49+
}
50+
},
51+
{
52+
"server_description_changed_event": {
53+
"topologyId": "42",
54+
"address": "a:27017",
55+
"previousDescription": {
56+
"address": "a:27017",
57+
"arbiters": [],
58+
"hosts": [],
59+
"passives": [],
60+
"type": "Unknown"
61+
},
62+
"newDescription": {
63+
"address": "a:27017",
64+
"arbiters": [],
65+
"hosts": [],
66+
"passives": [],
67+
"type": "Standalone"
68+
}
69+
}
70+
},
71+
{
72+
"topology_description_changed_event": {
73+
"topologyId": "42",
74+
"previousDescription": {
75+
"topologyType": "Unknown",
76+
"servers": [
77+
{
78+
"address": "a:27017",
79+
"arbiters": [],
80+
"hosts": [],
81+
"passives": [],
82+
"type": "Unknown"
83+
}
84+
]
85+
},
86+
"newDescription": {
87+
"topologyType": "Single",
88+
"servers": [
89+
{
90+
"address": "a:27017",
91+
"arbiters": [],
92+
"hosts": [],
93+
"passives": [],
94+
"type": "Standalone"
95+
}
96+
]
97+
}
98+
}
99+
}
100+
]
101+
}
102+
}
103+
]
104+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
description: "Monitoring a discovered standalone connection"
2+
uri: "mongodb://a:27017/?directConnection=false"
3+
phases:
4+
-
5+
responses:
6+
-
7+
- "a:27017"
8+
- { ok: 1, ismaster: true, minWireVersion: 0, maxWireVersion: 4 }
9+
10+
outcome:
11+
events:
12+
-
13+
topology_opening_event:
14+
topologyId: "42"
15+
-
16+
topology_description_changed_event:
17+
topologyId: "42"
18+
previousDescription:
19+
topologyType: "Unknown"
20+
servers: []
21+
newDescription:
22+
topologyType: "Unknown"
23+
servers:
24+
-
25+
address: "a:27017"
26+
arbiters: []
27+
hosts: []
28+
passives: []
29+
type: "Unknown"
30+
-
31+
server_opening_event:
32+
topologyId: "42"
33+
address: "a:27017"
34+
-
35+
server_description_changed_event:
36+
topologyId: "42"
37+
address: "a:27017"
38+
previousDescription:
39+
address: "a:27017"
40+
arbiters: []
41+
hosts: []
42+
passives: []
43+
type: "Unknown"
44+
newDescription:
45+
address: "a:27017"
46+
arbiters: []
47+
hosts: []
48+
passives: []
49+
type: "Standalone"
50+
-
51+
topology_description_changed_event:
52+
topologyId: "42"
53+
previousDescription:
54+
topologyType: "Unknown"
55+
servers:
56+
-
57+
address: "a:27017"
58+
arbiters: []
59+
hosts: []
60+
passives: []
61+
type: "Unknown"
62+
newDescription:
63+
topologyType: "Single"
64+
servers:
65+
-
66+
address: "a:27017"
67+
arbiters: []
68+
hosts: []
69+
passives: []
70+
type: "Standalone"

test/spec/server-discovery-and-monitoring/monitoring/standalone.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"description": "Monitoring a standalone connection",
3-
"uri": "mongodb://a:27017",
2+
"description": "Monitoring a direct connection",
3+
"uri": "mongodb://a:27017/?directConnection=true",
44
"phases": [
55
{
66
"responses": [

test/spec/server-discovery-and-monitoring/monitoring/standalone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
description: "Monitoring a standalone connection"
2-
uri: "mongodb://a:27017"
1+
description: "Monitoring a direct connection"
2+
uri: "mongodb://a:27017/?directConnection=true"
33
phases:
44
-
55
responses:

test/spec/server-discovery-and-monitoring/monitoring/standalone_suppress_equal_description_changes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"description": "Monitoring a standalone connection - suppress update events for equal server descriptions",
3-
"uri": "mongodb://a:27017",
2+
"description": "Monitoring a direct connection - suppress update events for equal server descriptions",
3+
"uri": "mongodb://a:27017/?directConnection=true",
44
"phases": [
55
{
66
"responses": [

test/spec/server-discovery-and-monitoring/monitoring/standalone_suppress_equal_description_changes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
description: "Monitoring a standalone connection - suppress update events for equal server descriptions"
2-
uri: "mongodb://a:27017"
1+
description: "Monitoring a direct connection - suppress update events for equal server descriptions"
2+
uri: "mongodb://a:27017/?directConnection=true"
33
phases:
44
-
55
responses:

test/spec/server-discovery-and-monitoring/rs/topology_version_greater.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@
157157
],
158158
"setName": "rs",
159159
"minWireVersion": 0,
160-
"maxWireVersion": 9,
161-
"topologyVersion": null
160+
"maxWireVersion": 9
162161
}
163162
]
164163
],

test/spec/server-discovery-and-monitoring/rs/topology_version_greater.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ phases: [
107107
hosts: ["a:27017", "d:27017"],
108108
setName: "rs",
109109
minWireVersion: 0,
110-
maxWireVersion: 9,
111-
topologyVersion: null
110+
maxWireVersion: 9
112111
}]
113112
],
114113

0 commit comments

Comments
 (0)