Skip to content

CSHARP-5620 Fix CommandMessageBinaryEncoderTests failures on Big Endian systems #1714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

medhatiwari
Copy link
Contributor

@medhatiwari medhatiwari commented Jun 18, 2025

Jira: CSHARP-5620

This PR fixes endianness-related test failures on Big Endian systems.

Context
Several tests were failing because they assumed the system's native endianness when verifying wire-level byte sequences. However, the driver's implementation explicitly follows Little Endian encoding for I/O operations, as per the MongoDB wire protocol.

Tests Affected:

WriteMessage_should_write_messageLength
WriteMessage_should_write_flags
WriteMessage_should_write_responseTo
WriteMessage_should_write_requestId
WriteMessage_should_write_expected_opcode
ReadMessage_should_throw_when_flags_is_invalid

Updated the affected test cases to compare data in a platform-agnostic way, ensuring they match the expected Little Endian wire format, regardless of host architecture.

Since the driver's core implementation already adheres to the wire protocol's endianness requirements, I believe the issue lies in test assumptions, not in the source code. This change ensures the tests reflect the correct behavior on both Little and Big Endian platforms.

cc: @giritrivedi

…an systems

Signed-off-by: Medha Tiwari <medhavns1@gmail.com>
@medhatiwari medhatiwari requested a review from a team as a code owner June 18, 2025 19:20
@medhatiwari medhatiwari requested review from sanych-sun and removed request for a team June 18, 2025 19:20
@sanych-sun sanych-sun requested review from BorisDog and removed request for sanych-sun June 18, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant