From c1fbd54eaadf82c1e5e4826f56c4096598467641 Mon Sep 17 00:00:00 2001 From: Sergey Zelenov Date: Fri, 27 Feb 2026 11:02:38 +0100 Subject: [PATCH 1/2] test(NODE-7451): sync spec tests for server selection --- .../read/SecondaryPreferred_empty_tags.json | 41 +++++++++++++++++++ .../read/SecondaryPreferred_empty_tags.yml | 26 ++++++++++++ .../assorted/server_selection.spec.test.ts | 2 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.json create mode 100644 test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.yml diff --git a/test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.json b/test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.json new file mode 100644 index 00000000000..5cc088df4cb --- /dev/null +++ b/test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.json @@ -0,0 +1,41 @@ +{ + "topology_description": { + "type": "ReplicaSetWithPrimary", + "servers": [ + { + "address": "a:27017", + "avg_rtt_ms": 5, + "type": "RSPrimary" + }, + { + "address": "b:27017", + "avg_rtt_ms": 5, + "type": "RSSecondary" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "SecondaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + }, + {} + ] + }, + "suitable_servers": [ + { + "address": "b:27017", + "avg_rtt_ms": 5, + "type": "RSSecondary" + } + ], + "in_latency_window": [ + { + "address": "b:27017", + "avg_rtt_ms": 5, + "type": "RSSecondary" + } + ] +} \ No newline at end of file diff --git a/test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.yml b/test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.yml new file mode 100644 index 00000000000..72f2bd53ae7 --- /dev/null +++ b/test/spec/server-selection/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_empty_tags.yml @@ -0,0 +1,26 @@ +# Attempt to select the secondary using an empty tag set. Expect empty tag set to match. +# This is a regression test for RUST-2363. +--- +topology_description: + type: ReplicaSetWithPrimary + servers: + - &1 + address: a:27017 + avg_rtt_ms: 5 + type: RSPrimary + # No "tags". + - &2 + address: b:27017 + avg_rtt_ms: 5 + type: RSSecondary + # No "tags" +operation: read +read_preference: + mode: SecondaryPreferred + tag_sets: + - data_center: nyc # Does not match. + - {} # Empty tag set. +suitable_servers: + - *2 +in_latency_window: + - *2 \ No newline at end of file diff --git a/test/unit/assorted/server_selection.spec.test.ts b/test/unit/assorted/server_selection.spec.test.ts index 44707aa7580..098848df05e 100644 --- a/test/unit/assorted/server_selection.spec.test.ts +++ b/test/unit/assorted/server_selection.spec.test.ts @@ -11,7 +11,7 @@ import { runServerSelectionLogicTest } from './server_selection_logic_spec_utils'; -describe('Server Selection Logic (spec)', function () { +describe.only('Server Selection Logic (spec)', function () { beforeEach(function () { if (this.currentTest.title.match(/Possible/)) { this.currentTest.skipReason = 'Nodejs driver does not support PossiblePrimary'; From e619739297094575f4a47bb7aa2cd3e8ec4322a7 Mon Sep 17 00:00:00 2001 From: Sergey Zelenov Date: Fri, 27 Feb 2026 22:47:18 +0100 Subject: [PATCH 2/2] run all tests --- test/unit/assorted/server_selection.spec.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/assorted/server_selection.spec.test.ts b/test/unit/assorted/server_selection.spec.test.ts index 098848df05e..44707aa7580 100644 --- a/test/unit/assorted/server_selection.spec.test.ts +++ b/test/unit/assorted/server_selection.spec.test.ts @@ -11,7 +11,7 @@ import { runServerSelectionLogicTest } from './server_selection_logic_spec_utils'; -describe.only('Server Selection Logic (spec)', function () { +describe('Server Selection Logic (spec)', function () { beforeEach(function () { if (this.currentTest.title.match(/Possible/)) { this.currentTest.skipReason = 'Nodejs driver does not support PossiblePrimary';