-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dind test to validate docker build (#94)
* Add dind test to validate docker build * Updates to see if we can get this to work * Add fake model for testing * Fix all the things, move tests to a separate file * Whoops * Rename * Fix * Fix name collision in tests
- Loading branch information
1 parent
5f27dc5
commit aaf914d
Showing
6 changed files
with
115 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
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
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,19 @@ | ||
import pytest | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--run-docker", action="store_true", default=False, help="run docker integration tests" | ||
) | ||
|
||
|
||
def pytest_configure(config): | ||
config.addinivalue_line("markers", "docker: mark test as requiring docker containers") | ||
|
||
|
||
def pytest_collection_modifyitems(config, items): | ||
if not config.getoption("--run-docker"): | ||
skip_docker = pytest.mark.skip(reason="need --run-docker option to run") | ||
for item in items: | ||
if "docker" in item.keywords: | ||
item.add_marker(skip_docker) |
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,15 @@ | ||
import pytest | ||
|
||
from client import AgentClient | ||
|
||
|
||
@pytest.mark.docker | ||
def test_service_with_fake_model(): | ||
"""Test the service using the fake model. | ||
This test requires the service container to be running with USE_FAKE_MODEL=true | ||
""" | ||
client = AgentClient("http://localhost", agent="chatbot") | ||
response = client.invoke("Tell me a joke?", model="fake") | ||
assert response.type == "ai" | ||
assert response.content == "This is a test response from the fake model." |