diff --git a/backend/test_observer/controllers/test_executions/models.py b/backend/test_observer/controllers/test_executions/models.py index 8da75f16..be7d257c 100644 --- a/backend/test_observer/controllers/test_executions/models.py +++ b/backend/test_observer/controllers/test_executions/models.py @@ -47,7 +47,7 @@ class _StartTestExecutionRequest(BaseModel): arch: str execution_stage: StageName environment: str - ci_link: Annotated[str, HttpUrl] | None + ci_link: Annotated[str, HttpUrl] | None = None 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 82770818..8d32d935 100644 --- a/backend/tests/controllers/test_executions/test_start_test.py +++ b/backend/tests/controllers/test_executions/test_start_test.py @@ -97,7 +97,6 @@ def test_requires_family_field(execute: Execute): "arch", "execution_stage", "environment", - "ci_link", "test_plan", "store", "track", @@ -121,7 +120,6 @@ def test_snap_required_fields(execute: Execute, field: str): "arch", "execution_stage", "environment", - "ci_link", "test_plan", ], ) @@ -364,9 +362,35 @@ def test_sets_initial_test_execution_status(db_session: Session, execute: Execut def test_allows_null_ci_link(db_session: Session, execute: Execute): - response = execute({**deb_test_request, "ci_link": None}) + request = {**deb_test_request, "ci_link": None} + + response = execute(request) assert response.status_code == 200 te = db_session.get(TestExecution, response.json()["id"]) assert te is not None assert te.ci_link is None + + +def test_allows_omitting_ci_link(db_session: Session, execute: Execute): + request = {**deb_test_request} + del request["ci_link"] + + response = execute(request) + + assert response.status_code == 200 + te = db_session.get(TestExecution, response.json()["id"]) + assert te is not None + assert te.ci_link is None + + +def test_create_two_executions_for_null_ci_link(execute: Execute): + request = {**deb_test_request} + del request["ci_link"] + + response_1 = execute(request) + response_2 = execute(request) + + assert response_1.status_code == 200 + assert response_2.status_code == 200 + assert response_1.json()["id"] != response_2.json()["id"]