-
Notifications
You must be signed in to change notification settings - Fork 73
Properly shutdown clients in reconnect tests #394
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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): | ||
|
|
@@ -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)) | ||
| ) | ||
|
|
@@ -244,6 +254,8 @@ def _verify_listeners_after_client_disconnected(self, member_address, client_add | |
| cluster_connect_timeout=sys.maxsize, | ||
| ) | ||
|
|
||
| self.client = client | ||
|
|
||
| test_map = client.get_map("test").blocking() | ||
|
|
||
| event_count = AtomicInteger() | ||
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how was the client shutting down before this added?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was not :D That was the problem
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok that question was to clarify 😄 , thanks |
||
There was a problem hiding this comment.
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):There was a problem hiding this comment.
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