-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Liora Milbaum <[email protected]>
- Loading branch information
Showing
4 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
recipes/natural_language_processing/chatbot/tests/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest_container | ||
import os | ||
|
||
|
||
CB = pytest_container.Container( | ||
url=f"containers-storage:{os.environ['REGISTRY']}/{os.environ['IMAGE_NAME']}", | ||
extra_environment_variables={ | ||
"MODEL_SERVICE_ENDPOINT": "http://10.88.0.1:8001/v1" | ||
}, | ||
forwarded_ports=[ | ||
pytest_container.PortForwarding( | ||
container_port=8501, | ||
host_port=8501 | ||
) | ||
], | ||
extra_launch_args=["--net=host"] | ||
) | ||
|
||
def pytest_generate_tests(metafunc): | ||
pytest_container.auto_container_parametrize(metafunc) | ||
|
||
def pytest_addoption(parser): | ||
pytest_container.add_logging_level_options(parser) |
14 changes: 12 additions & 2 deletions
14
recipes/natural_language_processing/chatbot/tests/test_alive.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
def test_placeholder(): | ||
assert 1 == 1 | ||
import pytest_container | ||
from .conftest import CB | ||
import tenacity | ||
|
||
CONTAINER_IMAGES = [CB] | ||
|
||
def test_etc_os_release_present(auto_container: pytest_container.container.ContainerData): | ||
assert auto_container.connection.file("/etc/os-release").exists | ||
|
||
@tenacity.retry(stop=tenacity.stop_after_attempt(5), wait=tenacity.wait_exponential()) | ||
def test_alive(auto_container: pytest_container.container.ContainerData, host): | ||
host.run_expect([0],f"curl http://localhost:{auto_container.forwarded_ports[0].host_port}",).stdout.strip() |