Skip to content

fix test_closing_connection_closes_commands #584

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

Merged
merged 7 commits into from
Jun 10, 2025

Conversation

varun-edachali-dbx
Copy link
Collaborator

@varun-edachali-dbx varun-edachali-dbx commented Jun 4, 2025

What type of PR is this?

  • Bug Fix

Description

Currently, test_closing_connection_closes_commands is incorrect because:

  • it iterates over values of closed but does not use them distinctly in the subTests. The intention is likely to set them as the initial state of has_been_closed_server_side, based on the comment.
  • the entire result set is Mocked, so when we check the final value of has_been_closed_server_side, it may extract an attribute that does not exist. This assertion will pass even if we do not set has_been_closed_server_side to True in our close() in the ResultSet. This is because the attribute is created as a new mock on being accessed, and mocks are by-default truthy. In order to test this, even if we change the assertion to self.assertTrue(mock_result_set_class.return_value.random_attr), the test will pass, despite random_attr not existing on the type.

How is this tested?

  • Unit tests
  • E2E Tests
  • Manually
  • N/A

Related Tickets & Documents

N/A

Signed-off-by: varun-edachali-dbx <[email protected]>
Signed-off-by: varun-edachali-dbx <[email protected]>
@jayantsing-db
Copy link
Contributor

Hi @jprakash-db, could you please take a look as this fix is intended for the main branch.

… instead of unittest primitives

Signed-off-by: varun-edachali-dbx <[email protected]>
to allow keeping the test inside ClientTestSuite

Signed-off-by: varun-edachali-dbx <[email protected]>
Signed-off-by: varun-edachali-dbx <[email protected]>
Signed-off-by: varun-edachali-dbx <[email protected]>
Copy link
Contributor

@jprakash-db jprakash-db left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for making the changes

@varun-edachali-dbx varun-edachali-dbx merged commit 3842583 into main Jun 10, 2025
23 checks passed
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.

3 participants