Skip to content

Commit c1fbd54

Browse files
committed
test(NODE-7451): sync spec tests for server selection
1 parent 22c6031 commit c1fbd54

3 files changed

Lines changed: 68 additions & 1 deletion

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"topology_description": {
3+
"type": "ReplicaSetWithPrimary",
4+
"servers": [
5+
{
6+
"address": "a:27017",
7+
"avg_rtt_ms": 5,
8+
"type": "RSPrimary"
9+
},
10+
{
11+
"address": "b:27017",
12+
"avg_rtt_ms": 5,
13+
"type": "RSSecondary"
14+
}
15+
]
16+
},
17+
"operation": "read",
18+
"read_preference": {
19+
"mode": "SecondaryPreferred",
20+
"tag_sets": [
21+
{
22+
"data_center": "nyc"
23+
},
24+
{}
25+
]
26+
},
27+
"suitable_servers": [
28+
{
29+
"address": "b:27017",
30+
"avg_rtt_ms": 5,
31+
"type": "RSSecondary"
32+
}
33+
],
34+
"in_latency_window": [
35+
{
36+
"address": "b:27017",
37+
"avg_rtt_ms": 5,
38+
"type": "RSSecondary"
39+
}
40+
]
41+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Attempt to select the secondary using an empty tag set. Expect empty tag set to match.
2+
# This is a regression test for RUST-2363.
3+
---
4+
topology_description:
5+
type: ReplicaSetWithPrimary
6+
servers:
7+
- &1
8+
address: a:27017
9+
avg_rtt_ms: 5
10+
type: RSPrimary
11+
# No "tags".
12+
- &2
13+
address: b:27017
14+
avg_rtt_ms: 5
15+
type: RSSecondary
16+
# No "tags"
17+
operation: read
18+
read_preference:
19+
mode: SecondaryPreferred
20+
tag_sets:
21+
- data_center: nyc # Does not match.
22+
- {} # Empty tag set.
23+
suitable_servers:
24+
- *2
25+
in_latency_window:
26+
- *2

test/unit/assorted/server_selection.spec.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
runServerSelectionLogicTest
1212
} from './server_selection_logic_spec_utils';
1313

14-
describe('Server Selection Logic (spec)', function () {
14+
describe.only('Server Selection Logic (spec)', function () {
1515
beforeEach(function () {
1616
if (this.currentTest.title.match(/Possible/)) {
1717
this.currentTest.skipReason = 'Nodejs driver does not support PossiblePrimary';

0 commit comments

Comments
 (0)