test(test_proxy_startup.py): fix gunicorn test

This commit is contained in:
Krrish Dholakia 2024-01-08 19:54:51 +05:30
parent 59c57f84cf
commit 8edd3fe651

View file

@ -30,14 +30,20 @@ def test_proxy_gunicorn_startup_direct_config():
Test both approaches
"""
try:
filepath = os.path.dirname(os.path.abspath(__file__))
# test with worker_config = config yaml
config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml"
os.environ["WORKER_CONFIG"] = config_fp
asyncio.run(startup_event())
except Exception as e:
if "Already connected to the query engine" in str(e):
pass
else:
pytest.fail(f"An exception occurred - {str(e)}")
def test_proxy_gunicorn_startup_config_dict():
try:
filepath = os.path.dirname(os.path.abspath(__file__))
# test with worker_config = config yaml
config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml"
@ -45,6 +51,11 @@ def test_proxy_gunicorn_startup_config_dict():
worker_config = {"config": config_fp}
os.environ["WORKER_CONFIG"] = json.dumps(worker_config)
asyncio.run(startup_event())
except Exception as e:
if "Already connected to the query engine" in str(e):
pass
else:
pytest.fail(f"An exception occurred - {str(e)}")
# test_proxy_gunicorn_startup()