Skip to content

Commit

Permalink
Merge branch 'remove/test-execution-ci-link-requirement' into rpbritt…
Browse files Browse the repository at this point in the history
…on-rerun-and-ci-link-changes
  • Loading branch information
rpbritton committed Jan 14, 2025
2 parents 267f068 + d7b2755 commit 302a8ea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
30 changes: 27 additions & 3 deletions backend/tests/controllers/test_executions/test_start_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def test_requires_family_field(execute: Execute):
"arch",
"execution_stage",
"environment",
"ci_link",
"test_plan",
"store",
"track",
Expand All @@ -121,7 +120,6 @@ def test_snap_required_fields(execute: Execute, field: str):
"arch",
"execution_stage",
"environment",
"ci_link",
"test_plan",
],
)
Expand Down Expand Up @@ -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"]

0 comments on commit 302a8ea

Please sign in to comment.