Skip to content

PYTHON-5724 Add integration test exercising compression logic#2935

Draft
aclark4life wants to merge 1 commit into
mongodb:mainfrom
aclark4life:PYTHON-5724
Draft

PYTHON-5724 Add integration test exercising compression logic#2935
aclark4life wants to merge 1 commit into
mongodb:mainfrom
aclark4life:PYTHON-5724

Conversation

@aclark4life

@aclark4life aclark4life commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PYTHON-5724

Changes in this PR

Adds an integration test that sends real commands with each available wire-protocol compressor enabled, exercising the end-to-end compress/decompress path in compression_support.py.

  • Adds test_compression_commands in test/asynchronous/test_client.py.

Test Plan

For each available compressor, the test handshakes so the server negotiates it, then asserts the pooled connection received the correct compressor context type (skipped if the server did not negotiate it):

Compressor Context class compressor_id
snappy SnappyContext 1
zlib ZlibContext 2
zstd ZstdContext 3

It then spies on compress() and round-trips an insert/find of compressible data, asserting both that compress() was invoked (send path) and that the decompressed response matches (receive path via decompress).

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)? N/A — test-only change.
  • Is there test coverage? This PR is test coverage for compression_support.py.
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). N/A.

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

@aclark4life aclark4life force-pushed the PYTHON-5724 branch 2 times, most recently from c499d8c to d404c2f Compare July 14, 2026 16:08
@aclark4life aclark4life requested a review from Copilot July 14, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds new integration coverage to validate wire-protocol compression behavior by running real commands with each negotiated compressor, aiming to exercise the compress/decompress path used by the driver’s networking stack.

Changes:

  • Import concrete compression context classes (Snappy/Zlib/Zstd) into the client test modules for type assertions.
  • Add test_compression_commands (sync + async) to negotiate each available compressor, assert the negotiated context type, and spy on compress() during a CRUD round-trip.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/test_client.py Adds a sync integration test that negotiates compressors and verifies compression is used during command execution.
test/asynchronous/test_client.py Adds the async equivalent integration test for compressor negotiation and command execution.

Comment thread test/test_client.py Outdated
Comment thread test/asynchronous/test_client.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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.

2 participants