ashb commented on a change in pull request #9280:
URL: https://github.com/apache/airflow/pull/9280#discussion_r445427034
##########
File path: tests/hooks/test_hive_hook.py
##########
@@ -390,6 +390,25 @@ def test_table_exists(self):
self.hook.table_exists(str(random.randint(1, 10000)))
)
+ def test_check_hms_clients_load_balance(self):
+ # checks if every time HMS Hook is instantiated, it gets to
+ # different HMS server most of the time and not to the same HMS
server.
+ connection_count = {}
+ hms_hook = HiveMetastoreHook()
+ hms_server_count = len(hms_hook.get_connections('metastore_default'))
+
+ if hms_server_count > 2:
+ for index in range(2 * hms_server_count):
+ conn = HiveMetastoreHook()._find_valid_server().host
+ if conn in connection_count:
+ if connection_count[conn] >= (2 * hms_server_count) - 1:
+ self.assertTrue(1 == 2)
+ else:
+ connection_count[conn] = connection_count[conn] + 1
+ else:
+ connection_count[conn] = 1
+ self.assertTrue(1 == 1)
Review comment:
@vanka56 could you make this change Tomek suggested today by any chance?
(Then we can get this in to 1.10.11)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]