From 007f4f7314eabd9cc3a2b0d11889de49ad3c682a Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Sat, 12 Nov 2022 15:12:15 +0300 Subject: Tests cleaned up --- test/server_poll.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test/server_poll.py') diff --git a/test/server_poll.py b/test/server_poll.py index eeefb7eb..8e63b450 100644 --- a/test/server_poll.py +++ b/test/server_poll.py @@ -3,7 +3,7 @@ import requests import time -def run_tests(): +def run_tests(proc): timeout_threshold = 240 start_time = time.time() while time.time()-start_time < timeout_threshold: @@ -11,8 +11,9 @@ def run_tests(): requests.head("http://localhost:7860/") break except requests.exceptions.ConnectionError: - pass - if time.time()-start_time < timeout_threshold: + if proc.poll() is not None: + break + if proc.poll() is None: suite = unittest.TestLoader().discover('', pattern='*_test.py') result = unittest.TextTestRunner(verbosity=2).run(suite) else: -- cgit v1.2.1 From 93d6c0209ae55632b72751cf82740e32a0cd81bc Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Mon, 14 Nov 2022 13:39:22 +0300 Subject: Tests separated for github-actions CI --- test/server_poll.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/server_poll.py') diff --git a/test/server_poll.py b/test/server_poll.py index 8e63b450..c71e906a 100644 --- a/test/server_poll.py +++ b/test/server_poll.py @@ -3,7 +3,7 @@ import requests import time -def run_tests(proc): +def run_tests(proc, test_dir): timeout_threshold = 240 start_time = time.time() while time.time()-start_time < timeout_threshold: @@ -14,7 +14,9 @@ def run_tests(proc): if proc.poll() is not None: break if proc.poll() is None: - suite = unittest.TestLoader().discover('', pattern='*_test.py') + if test_dir is None: + test_dir = "" + suite = unittest.TestLoader().discover(test_dir, pattern="*_test.py", top_level_dir="test") result = unittest.TextTestRunner(verbosity=2).run(suite) else: print("Launch unsuccessful") -- cgit v1.2.1 From 0646040667b59526ac8346d53efd14dc0e75b01e Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Mon, 14 Nov 2022 14:36:07 +0300 Subject: Propagate test error and try it without localhost --- test/server_poll.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/server_poll.py') diff --git a/test/server_poll.py b/test/server_poll.py index c71e906a..028fd476 100644 --- a/test/server_poll.py +++ b/test/server_poll.py @@ -8,7 +8,7 @@ def run_tests(proc, test_dir): start_time = time.time() while time.time()-start_time < timeout_threshold: try: - requests.head("http://localhost:7860/") + requests.head("http://127.0.0.1:7860/") break except requests.exceptions.ConnectionError: if proc.poll() is not None: @@ -18,5 +18,7 @@ def run_tests(proc, test_dir): test_dir = "" suite = unittest.TestLoader().discover(test_dir, pattern="*_test.py", top_level_dir="test") result = unittest.TextTestRunner(verbosity=2).run(suite) + return len(result.failures) else: print("Launch unsuccessful") + return 1 -- cgit v1.2.1 From 7416ac8d3cadcc6a53bbcc41e1cd184fa1587afd Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Mon, 14 Nov 2022 14:55:39 +0300 Subject: Use localhost with 80 port, count errors as well --- test/server_poll.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/server_poll.py') diff --git a/test/server_poll.py b/test/server_poll.py index 028fd476..e4462b6c 100644 --- a/test/server_poll.py +++ b/test/server_poll.py @@ -8,7 +8,7 @@ def run_tests(proc, test_dir): start_time = time.time() while time.time()-start_time < timeout_threshold: try: - requests.head("http://127.0.0.1:7860/") + requests.head("http://localhost:80/") break except requests.exceptions.ConnectionError: if proc.poll() is not None: @@ -18,7 +18,7 @@ def run_tests(proc, test_dir): test_dir = "" suite = unittest.TestLoader().discover(test_dir, pattern="*_test.py", top_level_dir="test") result = unittest.TextTestRunner(verbosity=2).run(suite) - return len(result.failures) + return len(result.failures) + len(result.errors) else: print("Launch unsuccessful") return 1 -- cgit v1.2.1 From 9e4f68acad4697fdf10004eb85d3f6f769c2c70b Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Mon, 14 Nov 2022 18:40:15 +0300 Subject: Stop exporting cl args and upload stdout and stderr as artifacts --- test/server_poll.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/server_poll.py') diff --git a/test/server_poll.py b/test/server_poll.py index e4462b6c..d4df697b 100644 --- a/test/server_poll.py +++ b/test/server_poll.py @@ -8,7 +8,7 @@ def run_tests(proc, test_dir): start_time = time.time() while time.time()-start_time < timeout_threshold: try: - requests.head("http://localhost:80/") + requests.head("http://localhost:7860/") break except requests.exceptions.ConnectionError: if proc.poll() is not None: -- cgit v1.2.1