Skip to content

Commit c289eef

Browse files
authored
test(NODE-3797): Ensure RSGhost servers are not selectable (#3132)
1 parent 640ef59 commit c289eef

File tree

5 files changed

+72
-10
lines changed

5 files changed

+72
-10
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"topology_description": {
3+
"type": "Unknown",
4+
"servers": [
5+
{
6+
"address": "a:27017",
7+
"avg_rtt_ms": 5,
8+
"type": "RSGhost"
9+
}
10+
]
11+
},
12+
"operation": "read",
13+
"read_preference": {
14+
"mode": "Nearest"
15+
},
16+
"suitable_servers": [],
17+
"in_latency_window": []
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
topology_description:
2+
type: Unknown
3+
servers:
4+
- address: a:27017
5+
avg_rtt_ms: 5
6+
type: RSGhost
7+
operation: read
8+
read_preference:
9+
mode: Nearest
10+
suitable_servers: []
11+
in_latency_window: []
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"topology_description": {
3+
"type": "Unknown",
4+
"servers": [
5+
{
6+
"address": "a:27017",
7+
"avg_rtt_ms": 5,
8+
"type": "RSGhost"
9+
}
10+
]
11+
},
12+
"operation": "write",
13+
"read_preference": {
14+
"mode": "Nearest"
15+
},
16+
"suitable_servers": [],
17+
"in_latency_window": []
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
topology_description:
2+
type: Unknown
3+
servers:
4+
- address: a:27017
5+
avg_rtt_ms: 5
6+
type: RSGhost
7+
operation: write
8+
read_preference:
9+
mode: Nearest
10+
suitable_servers: []
11+
in_latency_window: []

test/unit/assorted/server_selection.spec.test.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,29 @@ describe('Server Selection (spec)', function () {
4949
});
5050
});
5151

52+
beforeEach(function () {
53+
if (this.currentTest.title.match(/Possible/)) {
54+
this.currentTest.skipReason = 'Nodejs driver does not support PossiblePrimary';
55+
this.skip();
56+
}
57+
});
58+
5259
after(() => {
5360
serverConnect.restore();
5461
});
5562

5663
const specTests = collectSelectionTests(selectionSpecDir);
57-
Object.keys(specTests).forEach(topologyType => {
64+
for (const topologyType of Object.keys(specTests)) {
5865
describe(topologyType, function () {
59-
Object.keys(specTests[topologyType]).forEach(subType => {
66+
for (const subType of Object.keys(specTests[topologyType])) {
6067
describe(subType, function () {
61-
specTests[topologyType][subType].forEach(test => {
62-
// NOTE: node does not support PossiblePrimary
63-
const maybeIt = test.name.match(/Possible/) ? it.skip : it;
64-
65-
maybeIt(test.name, function (done) {
68+
for (const test of specTests[topologyType][subType]) {
69+
it(test.name, function (done) {
6670
executeServerSelectionTest(test, done);
6771
});
68-
});
72+
}
6973
});
70-
});
74+
}
7175
});
72-
});
76+
}
7377
});

0 commit comments

Comments
 (0)