Skip to content

Commit c695c46

Browse files
authored
fix: Add environment to no_compose (#257)
#### Relevant issue or PR #250 Add environment to `no_compose` #### Description of changes Add environment to `no_compose` and testing #### Testing done Unit testing
1 parent a41f9e3 commit c695c46

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tesseract_core/sdk/engine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ def serve(
647647
detach=True,
648648
volumes=volumes,
649649
user=user,
650+
environment=environment,
650651
)
651652
# wait for server to start
652653
timeout = 30

tests/endtoend_tests/test_endtoend.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,18 @@ def test_build_generate_only(dummy_tesseract_location, skip_checks):
129129
assert 'RUN ["tesseract-runtime", "check"]' in docker_file_contents
130130

131131

132-
def test_env_passthrough_serve(docker_cleanup, docker_client, built_image_name):
132+
@pytest.mark.parametrize("no_compose", [True, False])
133+
def test_env_passthrough_serve(
134+
docker_cleanup, docker_client, built_image_name, no_compose
135+
):
133136
"""Ensure we can pass environment variables to tesseracts when serving."""
134137
run_res = subprocess.run(
135138
[
136139
"tesseract",
137140
"serve",
138141
built_image_name,
139142
"--env=TEST_ENV_VAR=foo",
143+
*(["--no-compose"] if no_compose else []),
140144
],
141145
capture_output=True,
142146
text=True,
@@ -148,7 +152,10 @@ def test_env_passthrough_serve(docker_cleanup, docker_client, built_image_name):
148152
project_id = project_meta["project_id"]
149153
tesseract_id = project_meta["containers"][0]["name"]
150154

151-
docker_cleanup["project_ids"].append(project_id)
155+
if no_compose:
156+
docker_cleanup["containers"].append(tesseract_id)
157+
else:
158+
docker_cleanup["project_ids"].append(project_id)
152159

153160
container = docker_client.containers.get(tesseract_id)
154161
exit_code, output = container.exec_run(["sh", "-c", "echo $TEST_ENV_VAR"])

0 commit comments

Comments
 (0)