Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packit_service/service/api/copr_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get(self):
"build_id": build.build_id,
"status_per_chroot": {},
"packit_id_per_chroot": {},
"build_submitted_time": optional_timestamp(
"submitted_time": optional_timestamp(
build_info.submitted_time,
),
"web_url": build_info.web_url,
Expand Down Expand Up @@ -86,7 +86,7 @@ def get(self, id):
"build_id": build.build_id,
"status": build.status,
"chroot": build.target,
"build_submitted_time": optional_timestamp(build.submitted_time),
"submitted_time": optional_timestamp(build.submitted_time),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency, it would be beneficial to also rename build_start_time and build_finished_time to start_time and finished_time respectively. This change would align them with the renaming of build_submitted_time and make the API more uniform. This should be applied to the other detail endpoints in koji_builds.py and srpm_builds.py as well. If you apply this change, please also update the release notes accordingly.

"build_start_time": optional_timestamp(build.build_start_time),
"build_finished_time": optional_timestamp(build.build_finished_time),
"commit_sha": build.commit_sha,
Expand Down
4 changes: 2 additions & 2 deletions packit_service/service/api/koji_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get(self):
"task_id": build.task_id,
"scratch": build.scratch,
"status": build.status,
"build_submitted_time": optional_timestamp(build.submitted_time),
"submitted_time": optional_timestamp(build.submitted_time),
"chroot": build.target,
"web_url": build.web_url,
# from old data, sometimes build_logs_url is same and sometimes different to web_url
Expand Down Expand Up @@ -90,7 +90,7 @@ def get(self, id):
"scratch": build.scratch,
"build_start_time": optional_timestamp(build.build_start_time),
"build_finished_time": optional_timestamp(build.build_finished_time),
"build_submitted_time": optional_timestamp(build.submitted_time),
"submitted_time": optional_timestamp(build.submitted_time),
"commit_sha": build.commit_sha,
"web_url": build.web_url,
# from old data, sometimes build_logs_url is same and sometimes different to web_url
Expand Down
4 changes: 2 additions & 2 deletions packit_service/service/api/srpm_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get(self):
"srpm_build_id": build.id,
"status": build.status,
"log_url": get_srpm_build_info_url(build.id),
"build_submitted_time": optional_timestamp(build.submitted_time),
"submitted_time": optional_timestamp(build.submitted_time),
}

# It's possible that jobtrigger isn't stored in db
Expand Down Expand Up @@ -68,7 +68,7 @@ def get(self, id):

build_dict = {
"status": build.status,
"build_submitted_time": optional_timestamp(build.submitted_time),
"submitted_time": optional_timestamp(build.submitted_time),
"build_start_time": optional_timestamp(build.build_start_time),
"build_finished_time": optional_timestamp(build.build_finished_time),
"url": build.url,
Expand Down
20 changes: 10 additions & 10 deletions tests_openshift/service/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_copr_builds_list(client, clean_before_and_after, multiple_copr_builds):
assert response_dict[1]["pr_id"] == SampleValues.pr_id
assert {len(response_build["status_per_chroot"]) for response_build in response_dict} == {1, 2}

assert response_dict[1]["build_submitted_time"] is not None
assert response_dict[1]["submitted_time"] is not None
assert response_dict[1]["project_url"] == SampleValues.project_url

# four builds, but three unique build ids
Expand Down Expand Up @@ -66,15 +66,15 @@ def test_pagination(client, clean_before_and_after, too_many_copr_builds):
)
response_dict_1 = response_1.json
assert len(list(response_dict_1[1]["status_per_chroot"])) == 2
assert response_dict_1[1]["build_submitted_time"] is not None
assert response_dict_1[1]["submitted_time"] is not None
assert len(response_dict_1) == 20 # three builds, but two unique build ids

response_2 = client.get(
url_for("api.copr-builds_copr_builds_list") + "?page=1&per_page=30",
)
response_dict_2 = response_2.json
assert len(list(response_dict_2[1]["status_per_chroot"])) == 2
assert response_dict_2[1]["build_submitted_time"] is not None
assert response_dict_2[1]["submitted_time"] is not None
assert len(response_dict_2) == 30 # three builds, but two unique build ids


Expand All @@ -87,7 +87,7 @@ def test_detailed_copr_build_info(client, clean_before_and_after, a_copr_build_f
assert response_dict["build_id"] == SampleValues.build_id
assert response_dict["status"] == SampleValues.status_pending
assert response_dict["chroot"] == SampleValues.target
assert response_dict["build_submitted_time"] is not None
assert response_dict["submitted_time"] is not None
assert "build_start_time" in response_dict
assert "build_finished_time" in response_dict
assert response_dict["commit_sha"] == SampleValues.commit_sha
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_koji_builds_list(client, clean_before_and_after, multiple_koji_builds):
assert response_dict[1]["project_url"] == SampleValues.project_url
assert response_dict[1]["pr_id"] == SampleValues.pr_id

assert response_dict[1]["build_submitted_time"] is not None
assert response_dict[1]["submitted_time"] is not None

assert {response_build["task_id"] for response_build in response_dict} == {
build.task_id for build in multiple_koji_builds
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_detailed_koji_build_info(client, clean_before_and_after, a_koji_build_f
assert response_dict["task_id"] == SampleValues.build_id
assert response_dict["status"] == SampleValues.status_pending
assert response_dict["chroot"] == SampleValues.target
assert response_dict["build_submitted_time"] is not None
assert response_dict["submitted_time"] is not None
assert "build_start_time" in response_dict
assert "build_finished_time" in response_dict
assert response_dict["commit_sha"] == SampleValues.commit_sha
Expand Down Expand Up @@ -184,7 +184,7 @@ def test_detailed_koji_build_info_non_scratch(
assert response_dict["task_id"] == SampleValues.build_id
assert response_dict["status"] == SampleValues.status_pending
assert response_dict["chroot"] == SampleValues.target
assert response_dict["build_submitted_time"] is not None
assert response_dict["submitted_time"] is not None
assert "build_start_time" in response_dict
assert "build_finished_time" in response_dict
assert response_dict["commit_sha"] == SampleValues.commit_sha
Expand Down Expand Up @@ -243,7 +243,7 @@ def test_srpm_builds_list(client, clean_before_and_after, a_copr_build_for_pr):
assert response_dict[0]["project_url"] == SampleValues.project_url
assert response_dict[0]["pr_id"] == SampleValues.pr_id
assert response_dict[0]["branch_name"] is None # trigger was PR, not branch push
assert response_dict[0]["build_submitted_time"] is not None
assert response_dict[0]["submitted_time"] is not None


def test_srpm_build_info(
Expand All @@ -258,7 +258,7 @@ def test_srpm_build_info(
response_dict = response.json

assert response_dict["status"] == "success"
assert response_dict["build_submitted_time"] is not None
assert response_dict["submitted_time"] is not None
assert "url" in response_dict
assert response_dict["logs"] is not None

Expand All @@ -283,7 +283,7 @@ def test_srpm_build_in_copr_info(
response_dict = response.json

assert response_dict["status"] == "success"
assert response_dict["build_submitted_time"] is not None
assert response_dict["submitted_time"] is not None
assert "url" in response_dict
assert response_dict["logs"] is None
assert response_dict["copr_build_id"] is not None
Expand Down
Loading