Skip to content

Commit aa8b39c

Browse files
authored
test(NODE-7458): sync server selection deprioritization tag spec tests (#4886)
1 parent 88b2ad2 commit aa8b39c

16 files changed

+770
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"topology_description": {
3+
"type": "ReplicaSetNoPrimary",
4+
"servers": [
5+
{
6+
"address": "b:27017",
7+
"avg_rtt_ms": 5,
8+
"type": "RSSecondary",
9+
"tags": {
10+
"data_center": "nyc"
11+
}
12+
},
13+
{
14+
"address": "c:27017",
15+
"avg_rtt_ms": 100,
16+
"type": "RSSecondary",
17+
"tags": {
18+
"data_center": "tokyo"
19+
}
20+
}
21+
]
22+
},
23+
"operation": "read",
24+
"read_preference": {
25+
"mode": "Nearest",
26+
"tag_sets": [
27+
{
28+
"data_center": "nyc"
29+
}
30+
]
31+
},
32+
"deprioritized_servers": [
33+
{
34+
"address": "b:27017",
35+
"avg_rtt_ms": 5,
36+
"type": "RSSecondary",
37+
"tags": {
38+
"data_center": "nyc"
39+
}
40+
}
41+
],
42+
"suitable_servers": [
43+
{
44+
"address": "b:27017",
45+
"avg_rtt_ms": 5,
46+
"type": "RSSecondary",
47+
"tags": {
48+
"data_center": "nyc"
49+
}
50+
}
51+
],
52+
"in_latency_window": [
53+
{
54+
"address": "b:27017",
55+
"avg_rtt_ms": 5,
56+
"type": "RSSecondary",
57+
"tags": {
58+
"data_center": "nyc"
59+
}
60+
}
61+
]
62+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
topology_description:
3+
type: ReplicaSetNoPrimary
4+
servers:
5+
- &1
6+
address: b:27017
7+
avg_rtt_ms: 5
8+
type: RSSecondary
9+
tags:
10+
data_center: nyc
11+
- &2
12+
address: c:27017
13+
avg_rtt_ms: 100
14+
type: RSSecondary
15+
tags:
16+
data_center: tokyo
17+
operation: read
18+
read_preference:
19+
mode: Nearest
20+
tag_sets:
21+
- data_center: nyc
22+
deprioritized_servers:
23+
- *1
24+
suitable_servers:
25+
- *1 # Deprioritized, but only server matching the tag set.
26+
in_latency_window:
27+
- *1
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"topology_description": {
3+
"type": "ReplicaSetNoPrimary",
4+
"servers": [
5+
{
6+
"address": "b:27017",
7+
"avg_rtt_ms": 5,
8+
"type": "RSSecondary",
9+
"tags": {
10+
"data_center": "nyc"
11+
}
12+
},
13+
{
14+
"address": "c:27017",
15+
"avg_rtt_ms": 100,
16+
"type": "RSSecondary",
17+
"tags": {
18+
"data_center": "tokyo"
19+
}
20+
}
21+
]
22+
},
23+
"operation": "read",
24+
"read_preference": {
25+
"mode": "PrimaryPreferred",
26+
"tag_sets": [
27+
{
28+
"data_center": "nyc"
29+
}
30+
]
31+
},
32+
"deprioritized_servers": [
33+
{
34+
"address": "b:27017",
35+
"avg_rtt_ms": 5,
36+
"type": "RSSecondary",
37+
"tags": {
38+
"data_center": "nyc"
39+
}
40+
}
41+
],
42+
"suitable_servers": [
43+
{
44+
"address": "b:27017",
45+
"avg_rtt_ms": 5,
46+
"type": "RSSecondary",
47+
"tags": {
48+
"data_center": "nyc"
49+
}
50+
}
51+
],
52+
"in_latency_window": [
53+
{
54+
"address": "b:27017",
55+
"avg_rtt_ms": 5,
56+
"type": "RSSecondary",
57+
"tags": {
58+
"data_center": "nyc"
59+
}
60+
}
61+
]
62+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
topology_description:
3+
type: ReplicaSetNoPrimary
4+
servers:
5+
- &1
6+
address: b:27017
7+
avg_rtt_ms: 5
8+
type: RSSecondary
9+
tags:
10+
data_center: nyc
11+
- &2
12+
address: c:27017
13+
avg_rtt_ms: 100
14+
type: RSSecondary
15+
tags:
16+
data_center: tokyo
17+
operation: read
18+
read_preference:
19+
mode: PrimaryPreferred
20+
tag_sets:
21+
- data_center: nyc
22+
deprioritized_servers:
23+
- *1 # Deprioritized, but only server matching the tag set.
24+
suitable_servers:
25+
- *1
26+
in_latency_window:
27+
- *1
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"topology_description": {
3+
"type": "ReplicaSetNoPrimary",
4+
"servers": [
5+
{
6+
"address": "b:27017",
7+
"avg_rtt_ms": 5,
8+
"type": "RSSecondary",
9+
"tags": {
10+
"data_center": "nyc"
11+
}
12+
},
13+
{
14+
"address": "c:27017",
15+
"avg_rtt_ms": 100,
16+
"type": "RSSecondary",
17+
"tags": {
18+
"data_center": "tokyo"
19+
}
20+
}
21+
]
22+
},
23+
"operation": "read",
24+
"read_preference": {
25+
"mode": "Secondary",
26+
"tag_sets": [
27+
{
28+
"data_center": "nyc"
29+
}
30+
]
31+
},
32+
"deprioritized_servers": [
33+
{
34+
"address": "b:27017",
35+
"avg_rtt_ms": 5,
36+
"type": "RSSecondary",
37+
"tags": {
38+
"data_center": "nyc"
39+
}
40+
}
41+
],
42+
"suitable_servers": [
43+
{
44+
"address": "b:27017",
45+
"avg_rtt_ms": 5,
46+
"type": "RSSecondary",
47+
"tags": {
48+
"data_center": "nyc"
49+
}
50+
}
51+
],
52+
"in_latency_window": [
53+
{
54+
"address": "b:27017",
55+
"avg_rtt_ms": 5,
56+
"type": "RSSecondary",
57+
"tags": {
58+
"data_center": "nyc"
59+
}
60+
}
61+
]
62+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
topology_description:
3+
type: ReplicaSetNoPrimary
4+
servers:
5+
- &1
6+
address: b:27017
7+
avg_rtt_ms: 5
8+
type: RSSecondary
9+
tags:
10+
data_center: nyc
11+
- &2
12+
address: c:27017
13+
avg_rtt_ms: 100
14+
type: RSSecondary
15+
tags:
16+
data_center: tokyo
17+
operation: read
18+
read_preference:
19+
mode: Secondary
20+
tag_sets:
21+
- data_center: nyc
22+
deprioritized_servers:
23+
- *1
24+
suitable_servers:
25+
- *1 # Deprioritized, but only server matching the tag set.
26+
in_latency_window:
27+
- *1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"topology_description": {
3+
"type": "ReplicaSetNoPrimary",
4+
"servers": [
5+
{
6+
"address": "b:27017",
7+
"avg_rtt_ms": 5,
8+
"type": "RSSecondary",
9+
"tags": {
10+
"data_center": "nyc"
11+
}
12+
},
13+
{
14+
"address": "c:27017",
15+
"avg_rtt_ms": 100,
16+
"type": "RSSecondary",
17+
"tags": {
18+
"data_center": "tokyo"
19+
}
20+
}
21+
]
22+
},
23+
"operation": "read",
24+
"read_preference": {
25+
"mode": "SecondaryPreferred",
26+
"tag_sets": [
27+
{
28+
"data_center": "nyc"
29+
}
30+
]
31+
},
32+
"deprioritized_servers": [
33+
{
34+
"address": "b:27017",
35+
"avg_rtt_ms": 5,
36+
"type": "RSSecondary",
37+
"tags": {
38+
"data_center": "nyc"
39+
}
40+
}
41+
],
42+
"suitable_servers": [
43+
{
44+
"address": "b:27017",
45+
"avg_rtt_ms": 5,
46+
"type": "RSSecondary",
47+
"tags": {
48+
"data_center": "nyc"
49+
}
50+
}
51+
],
52+
"in_latency_window": [
53+
{
54+
"address": "b:27017",
55+
"avg_rtt_ms": 5,
56+
"type": "RSSecondary",
57+
"tags": {
58+
"data_center": "nyc"
59+
}
60+
}
61+
]
62+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
topology_description:
3+
type: ReplicaSetNoPrimary
4+
servers:
5+
- &1
6+
address: b:27017
7+
avg_rtt_ms: 5
8+
type: RSSecondary
9+
tags:
10+
data_center: nyc
11+
- &2
12+
address: c:27017
13+
avg_rtt_ms: 100
14+
type: RSSecondary
15+
tags:
16+
data_center: tokyo
17+
operation: read
18+
read_preference:
19+
mode: SecondaryPreferred
20+
tag_sets:
21+
- data_center: nyc
22+
deprioritized_servers:
23+
- *1
24+
suitable_servers:
25+
- *1 # Deprioritized, but only server matching the tag set.
26+
in_latency_window:
27+
- *1

0 commit comments

Comments
 (0)