From 4ee40e348c5779b476069c07080f0100e7a161d5 Mon Sep 17 00:00:00 2001 From: Yogesh Mahajan Date: Wed, 14 Apr 2021 11:56:38 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20an=20issue=20where=20a=C2=A0long=20time?= =?UTF-8?q?=20is=20taken=20to=20launch=20pgAdmin=20in=20debug=20mode=20for?= =?UTF-8?q?=20feature=20tests.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../python_test_utils/test_utils.py | 5 +- web/regression/runtests.py | 46 ++++++++++++------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 91bdb0d77..4de3ad9d1 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -1332,8 +1332,9 @@ def launch_url_in_browser(driver_instance, url, title='pgAdmin 4', timeout=50): if count == 0: print(str(e)) exception_msg = 'Web-page title did not match to {0}. ' \ - 'Please check url {1} accessible on ' \ - 'internet.'.format(title, url) + 'Waited for {1} seconds Please check url {2}' \ + ' accessible on internet.'.\ + format(title, timeout, url) raise WebDriverException(exception_msg) diff --git a/web/regression/runtests.py b/web/regression/runtests.py index f039e58da..1142fb9cf 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -570,12 +570,12 @@ def run_parallel_tests(url_client, servers_details, parallel_tests_lists, :param max_thread_count: """ driver_object = None - try: - # Thread list - threads_list = [] - # Create thread for each server - for ser in servers_details: - # Logic to add new threads + + # Thread list + threads_list = [] + # Create thread for each server + for ser in servers_details: + try: while True: # If active thread count <= max_thread_count, add new thread if threading.activeCount() <= max_thread_count: @@ -603,16 +603,24 @@ def run_parallel_tests(url_client, servers_details, parallel_tests_lists, else: time.sleep(10) - # Start threads in parallel - for t in threads_list: - t.join() - except Exception as exc: - # Print exception stack trace - traceback.print_exc(file=sys.stderr) - print(str(exc)) - # Clean driver object created - if driver_object is not None: - driver_object.quit() + # Start threads in parallel + for t in threads_list: + t.join() + + except Exception as exc: + # Print exception stack trace + traceback.print_exc(file=sys.stderr) + print('Exception before starting tests for ' + ser['name'], + file=sys.stderr) + print(str(exc), file=sys.stderr) + + # Mark failure as true + global failure + failure = True + + # Clean driver object created + if driver_object is not None: + driver_object.quit() def run_sequential_tests(url_client, servers_details, sequential_tests_lists, @@ -816,6 +824,12 @@ if __name__ == '__main__': app_starter_local = AppStarter(None, config) client_url = app_starter_local.start_app() + if config.DEBUG: + print('pgAdmin is launched with DEBUG=True, ' + 'hence sleeping for 50 seconds.', + file=sys.stderr) + time.sleep(50) + # Running Parallel tests if len(parallel_tests) > 0: parallel_sessions = \