Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix max version check
  • Loading branch information
blink1073 committed Apr 11, 2023
commit a04e29d61d35748fc722c262336a7991c4d3f8e9
9 changes: 5 additions & 4 deletions test/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ def test_wire_version(self):
t.select_servers(any_server_selector)

# Incompatible.
max_version = common.MAX_SUPPORTED_WIRE_VERSION
got_hello(
t,
address,
Expand All @@ -540,8 +541,8 @@ def test_wire_version(self):
HelloCompat.LEGACY_CMD: True,
"setName": "rs",
"hosts": ["a"],
"minWireVersion": 21,
"maxWireVersion": 22,
"minWireVersion": max_version + 1,
"maxWireVersion": max_version + 2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your motivation here but I think it's good to keep this test separate from common.MAX_SUPPORTED_WIRE_VERSION, that way when we change MAX_SUPPORTED_WIRE_VERSION we know it has an effect.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

},
)

Expand All @@ -551,8 +552,8 @@ def test_wire_version(self):
# Error message should say which server failed and why.
self.assertEqual(
str(e),
"Server at a:27017 requires wire version 21, but this version "
"of PyMongo only supports up to %d." % (common.MAX_SUPPORTED_WIRE_VERSION,),
"Server at a:27017 requires wire version %d, but this version "
"of PyMongo only supports up to %d." % (max_version + 1, max_version),
)
else:
self.fail("No error with incompatible wire version")
Expand Down