Skip to content

Commit

Permalink
Merge pull request #1155 from mmuzila/reference_test_repo
Browse files Browse the repository at this point in the history
Add test repo reference to package-config

This commit adds 'fmf_url' and 'fmf_ref' to JobMetadataConfig. This can
be later used to store tests in different repository.
Related To: packit/packit-service#968

Reviewed-by: Jiri Popelka <None>
Reviewed-by: Tomas Tomecek <[email protected]>
  • Loading branch information
softwarefactory-project-zuul[bot] committed Mar 18, 2021
2 parents cb16b82 + 62fcf87 commit cdf38cf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packit/config/job_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __init__(
preserve_project: bool = False,
additional_packages: List[str] = None,
additional_repos: List[str] = None,
fmf_url: str = None,
fmf_ref: str = None,
):
"""
:param targets: copr_build job, mock chroots where to build
Expand Down Expand Up @@ -93,6 +95,8 @@ def __init__(
self.preserve_project: bool = preserve_project
self.additional_packages: List[str] = additional_packages or []
self.additional_repos: List[str] = additional_repos or []
self.fmf_url = fmf_url
self.fmf_ref = fmf_ref

def __repr__(self):
return (
Expand All @@ -107,7 +111,9 @@ def __repr__(self):
f"list_on_homepage={self.list_on_homepage}, "
f"preserve_project={self.preserve_project}, "
f"additional_packages={self.additional_packages}, "
f"additional_repos={self.additional_repos})"
f"additional_repos={self.additional_repos}, "
f"fmf_url={self.fmf_url}, "
f"fmf_ref={self.fmf_ref})"
)

def __eq__(self, other: object):
Expand All @@ -127,6 +133,8 @@ def __eq__(self, other: object):
and self.preserve_project == other.preserve_project
and self.additional_packages == other.additional_packages
and self.additional_repos == other.additional_repos
and self.fmf_url == other.fmf_url
and self.fmf_ref == other.fmf_ref
)


Expand Down
2 changes: 2 additions & 0 deletions packit/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class JobMetadataSchema(Schema):
preserve_project = fields.Boolean()
additional_packages = fields.List(fields.String(), missing=None)
additional_repos = fields.List(fields.String(), missing=None)
fmf_url = fields.String(missing=None)
fmf_ref = fields.String(missing=None)

@pre_load
def ordered_preprocess(self, data, **_):
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/test_package_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,36 @@ def test_package_config_parse_error(raw):
),
id="sources",
),
pytest.param(
{
"specfile_path": "fedora/package.spec",
"jobs": [
{
"job": "copr_build",
"trigger": "release",
"metadata": {
"fmf_url": "https://example.com",
"fmf_ref": "test_ref",
},
},
],
},
PackageConfig(
specfile_path="fedora/package.spec",
sync_changelog=False,
jobs=[
JobConfig(
type=JobType.copr_build,
specfile_path="fedora/package.spec",
trigger=JobConfigTriggerType.release,
metadata=JobMetadataConfig(
fmf_url="https://example.com", fmf_ref="test_ref"
),
),
],
),
id="sync_changelog_false_by_default",
),
],
)
def test_package_config_parse(raw, expected):
Expand Down

0 comments on commit cdf38cf

Please sign in to comment.