Skip to content

Commit 349d211

Browse files
RUBY-3784 Test deprioritized selection with tag sets (#3017)
1 parent 0419fa5 commit 349d211

8 files changed

+242
-0
lines changed
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: 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: 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
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
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
# Serves as a regression test for CDRIVER-6248.
3+
topology_description:
4+
type: ReplicaSetWithPrimary
5+
servers:
6+
- &1
7+
address: b:27017
8+
avg_rtt_ms: 5
9+
type: RSSecondary
10+
tags:
11+
data_center: nyc
12+
- &2
13+
address: c:27017
14+
avg_rtt_ms: 100
15+
type: RSSecondary
16+
tags:
17+
data_center: tokyo
18+
- &3
19+
address: a:27017
20+
avg_rtt_ms: 26
21+
type: RSPrimary
22+
tags:
23+
data_center: tokyo
24+
operation: read
25+
read_preference:
26+
mode: Nearest
27+
tag_sets:
28+
- data_center: nyc
29+
deprioritized_servers:
30+
- *1
31+
suitable_servers:
32+
- *1 # Deprioritized, but only server matching the tag set.
33+
in_latency_window:
34+
- *1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
# Serves as a regression test for CDRIVER-6248.
3+
topology_description:
4+
type: ReplicaSetWithPrimary
5+
servers:
6+
- &1
7+
address: b:27017
8+
avg_rtt_ms: 5
9+
type: RSSecondary
10+
tags:
11+
data_center: tokyo
12+
- &2
13+
address: c:27017
14+
avg_rtt_ms: 5
15+
type: RSSecondary
16+
tags:
17+
data_center: tokyo
18+
- &3
19+
address: a:27017
20+
avg_rtt_ms: 5
21+
type: RSPrimary
22+
tags:
23+
data_center: nyc
24+
operation: read
25+
read_preference:
26+
mode: PrimaryPreferred
27+
tag_sets:
28+
- { data_center: nyc }
29+
deprioritized_servers:
30+
- *3
31+
suitable_servers:
32+
- *3 # Deprioritized, but only server matching the tag set.
33+
in_latency_window:
34+
- *3
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
topology_description:
3+
type: ReplicaSetWithPrimary
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+
- &3
18+
address: a:27017
19+
avg_rtt_ms: 26
20+
type: RSPrimary
21+
tags:
22+
data_center: tokyo
23+
operation: read
24+
read_preference:
25+
mode: Secondary
26+
tag_sets:
27+
- data_center: nyc
28+
deprioritized_servers:
29+
- *1
30+
suitable_servers:
31+
- *1 # Deprioritized, but only server matching the tag set.
32+
in_latency_window:
33+
- *1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Test when the deprioritized server is the only server with matching tags.
2+
topology_description:
3+
type: ReplicaSetWithPrimary
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+
- &3
18+
address: a:27017
19+
avg_rtt_ms: 5
20+
type: RSPrimary
21+
tags:
22+
data_center: tokyo
23+
operation: read
24+
read_preference:
25+
mode: SecondaryPreferred
26+
tag_sets:
27+
- data_center: nyc
28+
deprioritized_servers:
29+
- *1
30+
suitable_servers:
31+
- *3 # Primary selected since tags do not apply to primary selection.
32+
in_latency_window:
33+
- *3

0 commit comments

Comments
 (0)