Skip to content

Commit

Permalink
Get the build id from the event. (#2159)
Browse files Browse the repository at this point in the history
Get the build id from the event.

The SRPMBuildModel, unlike the CoprBuildModel,
has not a build id associated.
Take the build id  from the event even though the package name is taken from the db.

Reviewed-by: Laura Barcziová
  • Loading branch information
softwarefactory-project-zuul[bot] authored Aug 24, 2023
2 parents dd3b050 + a396b3c commit e92e65b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packit_service/worker/checker/copr.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def pre_check(self) -> bool:
return True

logger.debug(
f"The Copr build {self.build.build_id} (pkg={build_for_package}) "
f"The Copr build {self.copr_event.build_id} (pkg={build_for_package}) "
f"does not match the package from the configuration "
f"({self.job_config.package})."
)
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
)
from packit_service.worker.events import (
PullRequestGithubEvent,
AbstractCoprBuildEvent,
)
from packit_service.worker.events.event import EventData
from packit_service.worker.events.github import (
Expand Down Expand Up @@ -363,13 +364,17 @@ def test_copr_build_is_package_matching_job_view():
)
]

flexmock(AbstractCoprBuildEvent).should_receive("from_event_dict").and_return(
flexmock(build_id=123)
)

checker = IsPackageMatchingJobView(
flexmock(),
jobs[0],
{"pkg": "package"},
)
checker._build = (
flexmock(build_id=123)
flexmock()
.should_receive("get_package_name")
.and_return("package-b")
.once()
Expand Down

0 comments on commit e92e65b

Please sign in to comment.