Add --respin-of argument.

It is used to defined the relation between original compose
and respun compose with a hotfix in CTS.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2020-11-19 10:04:51 +01:00 committed by lsedlar
parent e3a500ca50
commit c27e21ccf8
3 changed files with 17 additions and 2 deletions

View File

@ -58,6 +58,7 @@ def get_compose_info(
compose_respin=None,
compose_label=None,
parent_compose_ids=None,
respin_of=None,
):
"""
Creates inncomplete ComposeInfo to generate Compose ID
@ -104,6 +105,7 @@ def get_compose_info(
data = {
"compose_info": json.loads(ci.dumps()),
"parent_compose_ids": parent_compose_ids,
"respin_of": respin_of,
}
rv = requests.post(url, json=data, auth=HTTPKerberosAuth())
rv.raise_for_status()

View File

@ -173,6 +173,12 @@ def main():
help="List of compose IDs which should be marked as parents of this "
"compose in Compose Tracking Service",
)
parser.add_argument(
"--respin-of",
default=None,
help="Compose ID of compose which this compose respins to store it in "
"Compose Tracking Service",
)
parser.add_argument(
"--print-output-dir",
action="store_true",
@ -301,6 +307,7 @@ def main():
compose_type=compose_type,
compose_label=opts.label,
parent_compose_ids=opts.parent_compose_id,
respin_of=opts.respin_of,
)
Compose.write_compose_info(compose_dir, ci)

View File

@ -640,15 +640,21 @@ class ComposeTestCase(unittest.TestCase):
requests=mocked_requests,
requests_kerberos=mocked_requests_kerberos,
):
ci = Compose.get_compose_info(conf)
ci = Compose.get_compose_info(conf, respin_of="Fedora-Rawhide-20200517.n.1")
ci_json = json.loads(ci.dumps())
self.assertEqual(ci_json, self.ci_json)
expected_json = {
"compose_info": self.ci_json,
"parent_compose_ids": None,
"respin_of": "Fedora-Rawhide-20200517.n.1",
}
mocked_response.raise_for_status.assert_called_once()
mocked_requests.post.assert_called_once_with(
"https://cts.localhost.tld/api/1/composes/",
auth=mock.ANY,
json={"compose_info": self.ci_json, "parent_compose_ids": None},
json=expected_json,
)