Skip to content

Commit d3fc047

Browse files
committed
tests: Use dummy model in integration tests
Signed-off-by: Phoevos Kalemkeris <[email protected]>
1 parent 9343e2f commit d3fc047

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

tests/integration/test_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_unsupported_task(client: TestClient, test_model_service_ip: str):
134134
def test_process(client: TestClient, config: Config, test_model_service_ip: str):
135135
response = client.post(
136136
f"/models/{test_model_service_ip}/process",
137-
data="Spinal stenosis",
137+
data="Kidney failure",
138138
headers={"Content-Type": "text/plain"},
139139
)
140140
assert response.status_code == 200
@@ -153,7 +153,7 @@ def test_process(client: TestClient, config: Config, test_model_service_ip: str)
153153
task_payload_key = f"{task_uuid}_payload.txt"
154154
tom: ObjectStoreManager = config.task_object_store_manager
155155
payload = tom.get_object(task_payload_key)
156-
assert payload == b"Spinal stenosis"
156+
assert payload == b"Kidney failure"
157157

158158
# Verify that the queue is empty after the task is processed
159159
qm: QueueManager = config.queue_manager
@@ -171,7 +171,7 @@ def test_process(client: TestClient, config: Config, test_model_service_ip: str)
171171
except json.JSONDecodeError as e:
172172
pytest.fail(f"Failed to parse the result as JSON: {result}, {e}")
173173

174-
assert result_json["text"] == "Spinal stenosis"
174+
assert result_json["text"] == "Kidney failure"
175175
assert len(result_json["annotations"]) == 1
176176

177177
annotation = result_json["annotations"][0]
@@ -188,7 +188,7 @@ def test_process(client: TestClient, config: Config, test_model_service_ip: str)
188188
"athena_ids",
189189
]
190190
)
191-
assert annotation["label_name"] == "Spinal Stenosis"
191+
assert annotation["label_name"] == "Loss Of Kidney Function"
192192

193193
# Verify that the above match the information exposed through the user-facing API
194194
get_response = client.get(f"/tasks/{task_uuid}", params={"detail": True, "download_url": True})

tests/integration/utils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import pytest
88
from docker.models.containers import Container
9-
from dotenv import load_dotenv
109
from git import Repo
1110
from testcontainers.compose import DockerCompose
1211
from testcontainers.core.container import DockerClient, DockerContainer
@@ -22,6 +21,7 @@
2221

2322
TEST_ASSETS = Path("tests/integration/assets")
2423
TEST_CMS_ENV_FILE = TEST_ASSETS / "cms.env"
24+
TEST_CMS_MODEL_PACK = TEST_ASSETS / "simple_model4test-3.9-1.12.0_edeb88f7986cb05c.zip"
2525

2626
COGSTACK_MODEL_SERVE_REPO = "https://github.com/CogStack/CogStack-ModelServe.git"
2727
COGSTACK_MODEL_SERVE_COMMIT = "a55be7b10a83e3bdbdbd1a9e13248e1557fdb0db"
@@ -172,11 +172,6 @@ def remove_cogstack_model_serve(ignore_errors: bool = False):
172172

173173
def start_cogstack_model_serve(model_services: list[str]) -> list[DockerCompose]:
174174
log.info("Deploying CogStack Model Serve (this might take a few minutes)...")
175-
load_dotenv()
176-
model_package = os.getenv("MODEL_PACKAGE_FULL_PATH")
177-
if not model_package:
178-
raise ValueError("MODEL_PACKAGE_FULL_PATH environment variable is not set")
179-
180175
with open(TEST_CMS_ENV_FILE) as f:
181176
const_envvars = f.read()
182177

@@ -185,7 +180,7 @@ def start_cogstack_model_serve(model_services: list[str]) -> list[DockerCompose]
185180
env_file.write(const_envvars)
186181
env_file.write(f"CMS_UID={os.getuid()}\n")
187182
env_file.write(f"CMS_GID={os.getgid()}\n")
188-
env_file.write(f"MODEL_PACKAGE_FULL_PATH={model_package}\n")
183+
env_file.write(f"MODEL_PACKAGE_FULL_PATH={TEST_CMS_MODEL_PACK.absolute()}\n")
189184

190185
log.debug(f"CogStack Model Serve environment file: {env_file_path}")
191186

0 commit comments

Comments
 (0)