Skip to content

Commit a0c8900

Browse files
author
Divjot Arora
authored
DRIVERS-720 Add load balancer support spec tests (#934)
1 parent 9546ff8 commit a0c8900

File tree

94 files changed

+951
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+951
-9
lines changed

source/initial-dns-seedlist-discovery/tests/README.rst

Lines changed: 11 additions & 3 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"uri": "mongodb+srv://test20.test.build.10gen.cc/?directConnection=false",
3+
"seeds": [],
4+
"hosts": [],
5+
"error": true,
6+
"comment": "Should fail because loadBalanced=true is incompatible with directConnection"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The TXT record for test20.test.build.10gen.cc contains loadBalanced=true. There is no corresponding test for
2+
# directConnection=true because that option is already incompatible with SRV URIs.
3+
uri: "mongodb+srv://test20.test.build.10gen.cc/?directConnection=false"
4+
seeds: []
5+
hosts: []
6+
error: true
7+
comment: Should fail because loadBalanced=true is incompatible with directConnection
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"uri": "mongodb+srv://test20.test.build.10gen.cc/?replicaSet=replset",
3+
"seeds": [],
4+
"hosts": [],
5+
"error": true,
6+
"comment": "Should fail because loadBalanced=true is incompatible with replicaSet"
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The TXT record for test20.test.build.10gen.cc contains loadBalanced=true.
2+
uri: "mongodb+srv://test20.test.build.10gen.cc/?replicaSet=replset"
3+
seeds: []
4+
hosts: []
5+
error: true
6+
comment: Should fail because loadBalanced=true is incompatible with replicaSet
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"uri": "mongodb+srv://test1.test.build.10gen.cc/?loadBalanced=true",
3+
"seeds": [],
4+
"hosts": [],
5+
"error": true,
6+
"comment": "Should fail because loadBalanced is true but the SRV record resolves to multiple hosts"
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
uri: "mongodb+srv://test1.test.build.10gen.cc/?loadBalanced=true"
2+
seeds: []
3+
hosts: []
4+
error: true
5+
comment: Should fail because loadBalanced is true but the SRV record resolves to multiple hosts
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"uri": "mongodb+srv://test20.test.build.10gen.cc/",
3+
"seeds": [
4+
"localhost.test.build.10gen.cc:27017"
5+
],
6+
"hosts": [
7+
"localhost.test.build.10gen.cc:27017"
8+
],
9+
"options": {
10+
"loadBalanced": true,
11+
"ssl": true
12+
}
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
uri: "mongodb+srv://test20.test.build.10gen.cc/"
2+
seeds:
3+
- localhost.test.build.10gen.cc:27017
4+
hosts:
5+
# In LB mode, the driver does not do server discovery, so the hostname does
6+
# not get resolved to localhost:27017.
7+
- localhost.test.build.10gen.cc:27017
8+
options:
9+
loadBalanced: true
10+
ssl: true
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"uri": "mongodb+srv://test21.test.build.10gen.cc/",
3+
"seeds": [
4+
"localhost.test.build.10gen.cc:27017"
5+
],
6+
"hosts": [
7+
"localhost:27017",
8+
"localhost:27018",
9+
"localhost:27019"
10+
],
11+
"options": {
12+
"loadBalanced": false,
13+
"ssl": true
14+
}
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
uri: "mongodb+srv://test21.test.build.10gen.cc/"
2+
seeds:
3+
- localhost.test.build.10gen.cc:27017
4+
hosts:
5+
- localhost:27017
6+
- localhost:27018
7+
- localhost:27019
8+
options:
9+
loadBalanced: false
10+
ssl: true

source/polling-srv-records-for-mongos-discovery/tests/README.rst

Lines changed: 21 additions & 6 deletions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"description": "Load balancer can be discovered and only has the address property set",
3+
"uri": "mongodb://a/?loadBalanced=true",
4+
"phases": [
5+
{
6+
"outcome": {
7+
"servers": {
8+
"a:27017": {
9+
"type": "LoadBalancer",
10+
"setName": null,
11+
"setVersion": null,
12+
"electionId": null,
13+
"logicalSessionTimeoutMinutes": null,
14+
"minWireVersion": null,
15+
"maxWireVersion": null,
16+
"topologyVersion": null
17+
}
18+
},
19+
"topologyType": "LoadBalanced",
20+
"setName": null,
21+
"logicalSessionTimeoutMinutes": null,
22+
"maxSetVersion": null,
23+
"maxElectionId": null,
24+
"compatible": true
25+
}
26+
}
27+
]
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
description: "Load balancer can be discovered and only has the address property set"
2+
3+
uri: "mongodb://a/?loadBalanced=true"
4+
5+
phases:
6+
7+
# There should be no monitoring in LoadBalanced mode, so no responses are necessary to get the topology into the
8+
# correct state.
9+
- outcome:
10+
servers:
11+
a:27017:
12+
type: LoadBalancer
13+
setName: null
14+
setVersion: null
15+
electionId: null
16+
logicalSessionTimeoutMinutes: null
17+
minWireVersion: null
18+
maxWireVersion: null
19+
topologyVersion: null
20+
topologyType: LoadBalanced
21+
setName: null
22+
logicalSessionTimeoutMinutes: null
23+
maxSetVersion: null
24+
maxElectionId: null
25+
compatible: true
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"description": "Monitoring a load balancer",
3+
"uri": "mongodb://a:27017/?loadBalanced=true",
4+
"phases": [
5+
{
6+
"outcome": {
7+
"events": [
8+
{
9+
"topology_opening_event": {
10+
"topologyId": "42"
11+
}
12+
},
13+
{
14+
"topology_description_changed_event": {
15+
"topologyId": "42",
16+
"previousDescription": {
17+
"topologyType": "Unknown",
18+
"servers": []
19+
},
20+
"newDescription": {
21+
"topologyType": "LoadBalanced",
22+
"servers": [
23+
{
24+
"address": "a:27017",
25+
"arbiters": [],
26+
"hosts": [],
27+
"passives": [],
28+
"type": "Unknown"
29+
}
30+
]
31+
}
32+
}
33+
},
34+
{
35+
"server_opening_event": {
36+
"topologyId": "42",
37+
"address": "a:27017"
38+
}
39+
},
40+
{
41+
"server_description_changed_event": {
42+
"topologyId": "42",
43+
"address": "a:27017",
44+
"previousDescription": {
45+
"address": "a:27017",
46+
"arbiters": [],
47+
"hosts": [],
48+
"passives": [],
49+
"type": "Unknown"
50+
},
51+
"newDescription": {
52+
"address": "a:27017",
53+
"arbiters": [],
54+
"hosts": [],
55+
"passives": [],
56+
"type": "LoadBalancer"
57+
}
58+
}
59+
},
60+
{
61+
"topology_description_changed_event": {
62+
"topologyId": "42",
63+
"previousDescription": {
64+
"topologyType": "LoadBalanced",
65+
"servers": [
66+
{
67+
"address": "a:27017",
68+
"arbiters": [],
69+
"hosts": [],
70+
"passives": [],
71+
"type": "Unknown"
72+
}
73+
]
74+
},
75+
"newDescription": {
76+
"topologyType": "LoadBalanced",
77+
"servers": [
78+
{
79+
"address": "a:27017",
80+
"arbiters": [],
81+
"hosts": [],
82+
"passives": [],
83+
"type": "LoadBalancer"
84+
}
85+
]
86+
}
87+
}
88+
}
89+
]
90+
}
91+
}
92+
]
93+
}

0 commit comments

Comments
 (0)