diff --git a/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedNearestOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedNearestOnlyMatchingTags.yml new file mode 100644 index 0000000000..04fe852851 --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedNearestOnlyMatchingTags.yml @@ -0,0 +1,27 @@ +# Test when the deprioritized server is the only server with matching tags. +topology_description: + type: ReplicaSetNoPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: nyc + - &2 + address: c:27017 + avg_rtt_ms: 100 + type: RSSecondary + tags: + data_center: tokyo +operation: read +read_preference: + mode: Nearest + tag_sets: + - data_center: nyc +deprioritized_servers: +- *1 +suitable_servers: +- *1 # Deprioritized, but only server matching the tag set. +in_latency_window: +- *1 diff --git a/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedPrimaryPreferredOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedPrimaryPreferredOnlyMatchingTags.yml new file mode 100644 index 0000000000..fed9cd5d65 --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedPrimaryPreferredOnlyMatchingTags.yml @@ -0,0 +1,27 @@ +# Test when the deprioritized server is the only server with matching tags. +topology_description: + type: ReplicaSetNoPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: nyc + - &2 + address: c:27017 + avg_rtt_ms: 100 + type: RSSecondary + tags: + data_center: tokyo +operation: read +read_preference: + mode: PrimaryPreferred + tag_sets: + - data_center: nyc +deprioritized_servers: +- *1 # Deprioritized, but only server matching the tag set. +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedSecondaryOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedSecondaryOnlyMatchingTags.yml new file mode 100644 index 0000000000..cd98970bd5 --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedSecondaryOnlyMatchingTags.yml @@ -0,0 +1,27 @@ +# Test when the deprioritized server is the only server with matching tags. +topology_description: + type: ReplicaSetNoPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: nyc + - &2 + address: c:27017 + avg_rtt_ms: 100 + type: RSSecondary + tags: + data_center: tokyo +operation: read +read_preference: + mode: Secondary + tag_sets: + - data_center: nyc +deprioritized_servers: +- *1 +suitable_servers: +- *1 # Deprioritized, but only server matching the tag set. +in_latency_window: +- *1 diff --git a/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedSecondaryPreferredOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedSecondaryPreferredOnlyMatchingTags.yml new file mode 100644 index 0000000000..9863598343 --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/DeprioritizedSecondaryPreferredOnlyMatchingTags.yml @@ -0,0 +1,27 @@ +# Test when the deprioritized server is the only server with matching tags. +topology_description: + type: ReplicaSetNoPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: nyc + - &2 + address: c:27017 + avg_rtt_ms: 100 + type: RSSecondary + tags: + data_center: tokyo +operation: read +read_preference: + mode: SecondaryPreferred + tag_sets: + - data_center: nyc +deprioritized_servers: +- *1 +suitable_servers: +- *1 # Deprioritized, but only server matching the tag set. +in_latency_window: +- *1 diff --git a/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedNearestOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedNearestOnlyMatchingTags.yml new file mode 100644 index 0000000000..a8d9e7c3ba --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedNearestOnlyMatchingTags.yml @@ -0,0 +1,34 @@ +# Test when the deprioritized server is the only server with matching tags. +# Serves as a regression test for CDRIVER-6248. +topology_description: + type: ReplicaSetWithPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: nyc + - &2 + address: c:27017 + avg_rtt_ms: 100 + type: RSSecondary + tags: + data_center: tokyo + - &3 + address: a:27017 + avg_rtt_ms: 26 + type: RSPrimary + tags: + data_center: tokyo +operation: read +read_preference: + mode: Nearest + tag_sets: + - data_center: nyc +deprioritized_servers: +- *1 +suitable_servers: +- *1 # Deprioritized, but only server matching the tag set. +in_latency_window: +- *1 diff --git a/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedPrimaryPreferredOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedPrimaryPreferredOnlyMatchingTags.yml new file mode 100644 index 0000000000..7eca837779 --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedPrimaryPreferredOnlyMatchingTags.yml @@ -0,0 +1,34 @@ +# Test when the deprioritized server is the only server with matching tags. +# Serves as a regression test for CDRIVER-6248. +topology_description: + type: ReplicaSetWithPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: tokyo + - &2 + address: c:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: tokyo + - &3 + address: a:27017 + avg_rtt_ms: 5 + type: RSPrimary + tags: + data_center: nyc +operation: read +read_preference: + mode: PrimaryPreferred + tag_sets: + - { data_center: nyc } +deprioritized_servers: +- *3 +suitable_servers: +- *3 # Deprioritized, but only server matching the tag set. +in_latency_window: +- *3 diff --git a/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedSecondaryOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedSecondaryOnlyMatchingTags.yml new file mode 100644 index 0000000000..5855c9ecee --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedSecondaryOnlyMatchingTags.yml @@ -0,0 +1,33 @@ +# Test when the deprioritized server is the only server with matching tags. +topology_description: + type: ReplicaSetWithPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: nyc + - &2 + address: c:27017 + avg_rtt_ms: 100 + type: RSSecondary + tags: + data_center: tokyo + - &3 + address: a:27017 + avg_rtt_ms: 26 + type: RSPrimary + tags: + data_center: tokyo +operation: read +read_preference: + mode: Secondary + tag_sets: + - data_center: nyc +deprioritized_servers: +- *1 +suitable_servers: +- *1 # Deprioritized, but only server matching the tag set. +in_latency_window: +- *1 diff --git a/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedSecondaryPreferredOnlyMatchingTags.yml b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedSecondaryPreferredOnlyMatchingTags.yml new file mode 100644 index 0000000000..bdc1a3242d --- /dev/null +++ b/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/DeprioritizedSecondaryPreferredOnlyMatchingTags.yml @@ -0,0 +1,33 @@ +# Test when the deprioritized server is the only server with matching tags. +topology_description: + type: ReplicaSetWithPrimary + servers: + - &1 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + tags: + data_center: nyc + - &2 + address: c:27017 + avg_rtt_ms: 100 + type: RSSecondary + tags: + data_center: tokyo + - &3 + address: a:27017 + avg_rtt_ms: 5 + type: RSPrimary + tags: + data_center: tokyo +operation: read +read_preference: + mode: SecondaryPreferred + tag_sets: + - data_center: nyc +deprioritized_servers: +- *1 +suitable_servers: +- *3 # Primary selected since tags do not apply to primary selection. +in_latency_window: +- *3