Skip to content

Conversation

@varun-edachali-dbx
Copy link
Contributor

@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 <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
@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 <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
to allow keeping the test inside ClientTestSuite

Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
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.

4 participants