diff --git a/backend/test_observer/controllers/test_executions/models.py b/backend/test_observer/controllers/test_executions/models.py index 64416eeb..2000e2e9 100644 --- a/backend/test_observer/controllers/test_executions/models.py +++ b/backend/test_observer/controllers/test_executions/models.py @@ -20,7 +20,7 @@ from datetime import datetime from enum import Enum -from typing import Annotated, Literal +from typing import Annotated, Literal, Optional from pydantic import ( AliasPath, @@ -46,7 +46,7 @@ class _StartTestExecutionRequest(BaseModel): arch: str execution_stage: StageName environment: str - ci_link: Annotated[str, HttpUrl] + ci_link: Optional[Annotated[str, HttpUrl]] test_plan: str = Field(max_length=200) initial_status: TestExecutionStatus = TestExecutionStatus.IN_PROGRESS diff --git a/backend/tests/controllers/test_executions/test_start_test.py b/backend/tests/controllers/test_executions/test_start_test.py index 76c0f4ec..afb466ca 100644 --- a/backend/tests/controllers/test_executions/test_start_test.py +++ b/backend/tests/controllers/test_executions/test_start_test.py @@ -361,3 +361,12 @@ def test_sets_initial_test_execution_status(db_session: Session, execute: Execut te = db_session.get(TestExecution, response.json()["id"]) assert te is not None assert te.status == TestExecutionStatus.NOT_STARTED + + +def test_allows_null_ci_link(db_session: Session, execute: Execute): + response = execute({**deb_test_request, "ci_link": None}) + + assert response.status_code == 200 + te = db_session.get(TestExecution, response.json()["id"]) + assert te is not None + assert te.ci_link == None