Skip to content
Merged
Changes from all commits
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
15 changes: 15 additions & 0 deletions tests/integration/backward_compatible/reconnect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,16 @@ def _create_cluster_config(self, public_address, heartbeat_seconds=300):

def setUp(self):
self.rc = self.create_rc()
self.client = None

def tearDown(self):
if self.client:
# If the test is failed, and we couldn't shutdown
# the client, try to shutdown here to make sure that
# we are not going to affect other tests. If the client
# is already shutdown, then this is basically no-op.
self.client.shutdown()

self.rc.exit()

def test_connection_count_after_reconnect_with_member_hostname_client_ip(self):
Expand Down Expand Up @@ -214,6 +222,8 @@ def listener(state):
lifecycle_listeners=[listener],
)

self.client = client

self.assertTrueEventually(
lambda: self.assertEqual(1, len(client._connection_manager.active_connections))
)
Expand Down Expand Up @@ -244,6 +254,8 @@ def _verify_listeners_after_client_disconnected(self, member_address, client_add
cluster_connect_timeout=sys.maxsize,
)

self.client = client

Comment on lines 256 to +258
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could do this as well (same for other self.client = client):

self.client = HazelcastClient(
            cluster_name=cluster.id,
            cluster_members=[client_address],
            cluster_connect_timeout=sys.maxsize,
 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I head to reference them as self.client instead of client, which I don't like

test_map = client.get_map("test").blocking()

event_count = AtomicInteger()
Expand All @@ -268,3 +280,6 @@ def assertion():
self.assertNotEqual(0, event_count.get())

self.assertTrueEventually(assertion)

client.shutdown()
self.rc.terminateCluster(cluster.id)
Comment on lines +283 to +285
Copy link
Contributor

Choose a reason for hiding this comment

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

how was the client shutting down before this added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was not :D That was the problem

Copy link
Contributor

Choose a reason for hiding this comment

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

ok that question was to clarify 😄 , thanks