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,21 +30,32 @@ def test_proxy_gunicorn_startup_direct_config():
Test both approaches Test both approaches
""" """
try:
filepath = os.path.dirname(os.path.abspath(__file__)) filepath = os.path.dirname(os.path.abspath(__file__))
# test with worker_config = config yaml # test with worker_config = config yaml
config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml" config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml"
os.environ["WORKER_CONFIG"] = config_fp os.environ["WORKER_CONFIG"] = config_fp
asyncio.run(startup_event()) 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(): def test_proxy_gunicorn_startup_config_dict():
filepath = os.path.dirname(os.path.abspath(__file__)) try:
# test with worker_config = config yaml filepath = os.path.dirname(os.path.abspath(__file__))
config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml" # test with worker_config = config yaml
# test with worker_config = dict config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml"
worker_config = {"config": config_fp} # test with worker_config = dict
os.environ["WORKER_CONFIG"] = json.dumps(worker_config) worker_config = {"config": config_fp}
asyncio.run(startup_event()) 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() # test_proxy_gunicorn_startup()