mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-27 06:58:35 +00:00
Rely api healthcheck on status code rather than json decoding (#1871)
* Rely api healthcheck on status code rather than json decoding * Install UI dependencies on the Linux and Windows CI Co-authored-by: Fabrice Depaulis <fabrice.depaulis@orange.com> Co-authored-by: ZanSara <sarazanzo94@gmail.com>
This commit is contained in:
parent
4eb4503f25
commit
77d52ad215
1
.github/workflows/linux_ci.yml
vendored
1
.github/workflows/linux_ci.yml
vendored
@ -41,6 +41,7 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt -e .
|
||||
pip install --upgrade --upgrade-strategy eager -r requirements.txt -e .
|
||||
pip install --upgrade --upgrade-strategy eager -r ui/requirements.txt -e .
|
||||
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cpu.html
|
||||
|
||||
prepare-build:
|
||||
|
||||
1
.github/workflows/windows_ci.yml
vendored
1
.github/workflows/windows_ci.yml
vendored
@ -44,6 +44,7 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt -e .
|
||||
pip install --upgrade --upgrade-strategy eager -r ui/requirements-dev.txt -e .
|
||||
pip install --upgrade --upgrade-strategy eager -f https://download.pytorch.org/whl/torch_stable.html -r requirements.txt -e .
|
||||
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cpu.html
|
||||
|
||||
|
||||
@ -63,4 +63,4 @@ weaviate-client==2.5.0
|
||||
ray==1.5.0
|
||||
dataclasses-json
|
||||
quantulum3
|
||||
azure-ai-formrecognizer==3.2.0b2
|
||||
azure-ai-formrecognizer==3.2.0b2
|
||||
|
||||
15
test/test_ui_utils.py
Normal file
15
test/test_ui_utils.py
Normal file
@ -0,0 +1,15 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from ui.utils import haystack_is_ready
|
||||
|
||||
|
||||
def test_haystack_is_ready():
|
||||
with patch('requests.get') as mocked_get:
|
||||
mocked_get.return_value.status_code = 200
|
||||
assert haystack_is_ready()
|
||||
|
||||
|
||||
def test_haystack_is_ready_fail():
|
||||
with patch('requests.get') as mocked_get:
|
||||
mocked_get.return_value.status_code = 400
|
||||
assert not haystack_is_ready()
|
||||
@ -22,7 +22,7 @@ def haystack_is_ready():
|
||||
"""
|
||||
url = f"{API_ENDPOINT}/{STATUS}"
|
||||
try:
|
||||
if requests.get(url).json():
|
||||
if requests.get(url).status_code < 400:
|
||||
return True
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user