diff --git a/pubtools/_pulp/tasks/copy_repo.py b/pubtools/_pulp/tasks/copy_repo.py index ad8fd957..4ad96f8d 100644 --- a/pubtools/_pulp/tasks/copy_repo.py +++ b/pubtools/_pulp/tasks/copy_repo.py @@ -1,17 +1,23 @@ import logging +from collections import namedtuple from functools import partial +from itertools import chain import attr -from more_executors.futures import f_map, f_sequence +from more_executors.futures import f_map, f_sequence, f_proxy from pubtools.pulplib import ( ContainerImageRepository, Criteria, - ErratumUnit, + Matcher, FileUnit, - ModulemdUnit, RpmUnit, + ErratumUnit, + ModulemdUnit, + ModulemdDefaultsUnit, + YumRepoMetadataFileUnit, ) + from pubtools._pulp.arguments import SplitAndExtend from pubtools._pulp.services import CollectorService, PulpClientService from pubtools._pulp.task import PulpTask @@ -21,6 +27,52 @@ LOG = logging.getLogger("pubtools.pulp") +ContentType = namedtuple( + "ContentType", ["content_type_ids", "klass", "fields"], defaults=[None, None] +) + +_RPM_FIELDS = ( + "name", + "version", + "release", + "arch", + "sha256sum", + "md5sum", + "signing_key", +) +_MODULEMD_FIELDS = ( + "name", + "stream", + "version", + "context", + "arch", +) +_FILE_FIELDS = ( + "path", + "sha256sum", +) +_MINIMAL_FIELDS = ("unit_id",) + +CONTENT_TYPES = ( + ContentType(("iso",), FileUnit, _FILE_FIELDS), + ContentType( + ( + "rpm", + "srpm", + ), + RpmUnit, + _RPM_FIELDS, + ), + ContentType(("erratum",), ErratumUnit, _MINIMAL_FIELDS), + ContentType(("modulemd",), ModulemdUnit, _MODULEMD_FIELDS), + ContentType(("modulemd_defaults",), ModulemdDefaultsUnit, _MINIMAL_FIELDS), + ContentType(("yum_repo_metadata_file",), YumRepoMetadataFileUnit, _MINIMAL_FIELDS), + ContentType(("package_group",)), + ContentType(("package_category",)), + ContentType(("package_environment",)), + ContentType(("package_langpacks",)), +) + @attr.s(slots=True) class RepoCopy(object): @@ -35,26 +87,62 @@ class RepoCopy(object): class CopyRepo(CollectorService, PulpClientService, PulpRepositoryOperation): @property - def content_type(self): + def content_type_criteria(self): # Only return non-None if there were really any types given. # Otherwise, return None to let library defaults apply - c = self.args.content_type or None - # Normalize content types (e.g., "ISO" -> "iso"). - if c: - c = [t.lower() for t in c] - return c + out = None + + def str_to_content_type(content_type_id): + out = None + for item in CONTENT_TYPES: + if content_type_id in item.content_type_ids: + out = item + break + + if out is None: + self.fail("Unsupported content type: %s", content_type_id) + + return out + + if self.args.content_type: + # replace srpm with rpm - we don't need to specify it separately and remove duplicated entries + content_types = set( + map(lambda x: x.replace("srpm", "rpm"), self.args.content_type) + ) + content_types = [ + str_to_content_type(t.lower().strip()) for t in content_types + ] + criteria = [] + in_matcher = [] # to aggregate content types for Criteria.with_field() + + for item in sorted(content_types): + if item.klass: + criteria.append( + Criteria.with_unit_type(item.klass, unit_fields=item.fields) + ) + else: + in_matcher.extend(item.content_type_ids) + if in_matcher: + criteria.append( + Criteria.with_field("content_type_id", Matcher.in_(in_matcher)) + ) + + out = criteria + return out @property def repo_pairs(self): - out = [] + out = set() for pair in self.args.repopairs: - pair = list(map(str, pair.split(","))) - if not len(pair) == 2 or any([not r_id.strip() for r_id in pair]): + parsed = tuple(pair.split(",")) + out.add(parsed) + + if not len(parsed) == 2 or any([not r_id.strip() for r_id in pair]): self.fail( - "Pair(s) must contain two repository IDs, source and destination. Got: %s", + "Pair(s) must contain two repository IDs, source and destination. Got: '%s'", pair, ) - out.append(pair) + return out def add_args(self): @@ -80,34 +168,15 @@ def get_repos(self): # Eagerly loads the repos so we fail early if the user passed any nonexistent # repo. repo_ids = [] - found_repos = [] - repo_pairs = [] + repo_ids = set(chain.from_iterable(self.repo_pairs)) # Eagerly load all repos to fail early if the user passed any nonexistent repo. - for id_pair in self.repo_pairs: - # We'll need a flat list of given IDs later. - repo_ids.extend(id_pair) - - search = self.pulp_client.search_repository(Criteria.with_id(id_pair)) - - src = None - dest = None - for repo in search.result(): - # We'll need a flat list of all search results later. - found_repos.append(repo) - - if repo.id == id_pair[0]: - src = repo - if repo.id == id_pair[1]: - dest = repo - - repo_pairs.append((src, dest)) - + search = self.pulp_client.search_repository(Criteria.with_id(repo_ids)) + found_repos_map = {repo.id: repo for repo in search.result()} # Bail out if user requested repos which don't exist - missing = set(repo_ids) - {repo.id for repo in found_repos} - missing = sorted(list(missing)) + missing = repo_ids - set(found_repos_map) if missing: - self.fail("Requested repo(s) don't exist: %s", ", ".join(missing)) + self.fail("Requested repo(s) don't exist: %s", ", ".join(sorted(missing))) # Bail out if we'd be processing any container image repos. # We don't support this now because: @@ -121,7 +190,7 @@ def get_repos(self): container_repo_ids = sorted( [ repo.id - for repo in found_repos + for repo in found_repos_map.values() if isinstance(repo, ContainerImageRepository) ] ) @@ -131,29 +200,33 @@ def get_repos(self): % ", ".join(sorted(container_repo_ids)) ) - return repo_pairs + return [ + (found_repos_map[repo_id_src], found_repos_map[repo_id_dest]) + for repo_id_src, repo_id_dest in self.repo_pairs + ] @step("Copy content") - def copy_content(self, src_repo, dest_repo): - futures = [] - content_types = self.content_type or ["None"] - for t in content_types: - crit = None - if t == "iso": - crit = Criteria.with_unit_type(FileUnit) - if t in ("rpm", "srpm"): - crit = Criteria.with_unit_type(RpmUnit) - if t == "erratum": - crit = Criteria.with_unit_type(ErratumUnit) - if t == "modulemd": - crit = Criteria.with_unit_type(ModulemdUnit) - - f = self.pulp_client.copy_content(src_repo, dest_repo, criteria=crit) - f = f_map(f, partial(RepoCopy, repo=dest_repo)) + def copy_content(self, repo_pairs): + fts = [] + criteria = self.content_type_criteria + + def repo_copy(copy_tasks, repo): + tasks = list(chain.from_iterable(copy_tasks)) + return RepoCopy(tasks=tasks, repo=repo) + + for src_repo, dest_repo in repo_pairs: + one_pair_copies = [] + for item in criteria or [None]: + tasks_f = self.pulp_client.copy_content( + src_repo, dest_repo, criteria=item + ) + one_pair_copies.append(tasks_f) + + f = f_map(f_sequence(one_pair_copies), partial(repo_copy, repo=dest_repo)) f = f_map(f, self.log_copy) - futures.append(f) + fts.append(f) - return futures + return fts def run(self): # Get a list of repo pairs we'll be dealing with. @@ -161,24 +234,16 @@ def run(self): repo_pairs = self.get_repos() # Start copying repos. - repos_to_flush = [] - repo_copies_fs = [] - - for pair in repo_pairs: - repo_copies_fs.extend(self.copy_content(pair[0], pair[1])) - - # We shouldn't need to flush the source repos, just the updated dest. - repos_to_flush.append(pair[1]) + repo_copies_fs = self.copy_content(repo_pairs) # As copying completes, record pushitem info on what was copied. # We don't have to wait on this before continuing. to_await = self.record_push_items(repo_copies_fs, "PUSHED") # Don't need the repo copying tasks for anything more. - repos_fs = [f_map(f, lambda cr: cr.repo) for f in repo_copies_fs] + repos_fs = [f_proxy(f_map(f, lambda cr: cr.repo)) for f in repo_copies_fs] # Now move repos into the desired state: - # They should be published. publish_fs = self.publish(repos_fs) @@ -189,10 +254,10 @@ def run(self): f_sequence(publish_fs).result() # They should have UD cache flushed. - to_await.extend(self.flush_ud(repos_to_flush)) + to_await.extend(self.flush_ud(repos_fs)) # They should have CDN cache flushed. - to_await.extend(self.flush_cdn(repos_to_flush)) + to_await.extend(self.flush_cdn(repos_fs)) # Now make sure we wait for everything to finish. for f in to_await: diff --git a/tests/copy_repo/test_copy_repo.py b/tests/copy_repo/test_copy_repo.py index 86a5029c..2c083402 100644 --- a/tests/copy_repo/test_copy_repo.py +++ b/tests/copy_repo/test_copy_repo.py @@ -9,6 +9,8 @@ ModulemdUnit, RpmUnit, YumRepository, + Criteria, + Matcher, ) import pubtools._pulp.tasks.copy_repo @@ -73,7 +75,7 @@ def test_missing_repos(command_tester): ) -def test_invalid_repo_pair(command_tester, caplog): +def test_invalid_repo_pair(command_tester): command_tester.test( lambda: pubtools._pulp.tasks.copy_repo.entry_point(FakeCopyRepo), [ @@ -83,10 +85,6 @@ def test_invalid_repo_pair(command_tester, caplog): "repo1, ", ], ) - assert ( - "Pair(s) must contain two repository IDs, source and destination. Got: ['repo1', ' ']" - in caplog.text - ) def test_copy_empty_repo(command_tester, fake_collector): @@ -113,6 +111,34 @@ def test_copy_empty_repo(command_tester, fake_collector): assert not fake_collector.items +def test_copy_invalid_content_type(command_tester, fake_collector): + """Running command with invalid content type fails""" + + with FakeCopyRepo() as task_instance: + repoA = FileRepository(id="some-filerepo") + repoB = FileRepository(id="another-filerepo") + + task_instance.pulp_client_controller.insert_repository(repoA) + task_instance.pulp_client_controller.insert_repository(repoB) + + command_tester.test( + task_instance.main, + [ + "test-copy-repo", + "--pulp-url", + "https://pulp.example.com/", + "some-filerepo,another-filerepo", + "--content-type", + "rpm", + "--content-type", + "container", + ], + ) + + # No push items recorded + assert not fake_collector.items + + def test_copy_file_repo(command_tester, fake_collector): """Copying a repo with file content succeeds.""" @@ -330,8 +356,8 @@ def test_copy_container_repo(command_tester): """Copying a container image repo is not allowed.""" with FakeCopyRepo() as task_instance: - repoA = ContainerImageRepository(id="some-containerrepo") - repoB = ContainerImageRepository(id="another-containerrepo") + repoA = ContainerImageRepository(id="some-container-repo") + repoB = ContainerImageRepository(id="another-container-repo") task_instance.pulp_client_controller.insert_repository(repoA) task_instance.pulp_client_controller.insert_repository(repoB) @@ -343,7 +369,7 @@ def test_copy_container_repo(command_tester): "test-copy-repo", "--pulp-url", "https://pulp.example.com/", - "some-containerrepo,another-containerrepo", + "some-container-repo,another-container-repo", ], ) @@ -399,7 +425,7 @@ def test_copy_repo_multiple_content_types(command_tester, fake_collector): ], ) - # test the new ClearRepo argument handling for --content-type + # test the CopyRepo argument handling for --content-type # produces the expected output assert task_instance.args.content_type == ["rpm", "modulemd", "iso", "erratum"] @@ -426,3 +452,90 @@ def test_copy_repo_multiple_content_types(command_tester, fake_collector): "build": None, }, ] + + +def test_copy_repo_criteria(command_tester): + repoA = YumRepository( + id="some-yumrepo", relative_url="some/publish/url", mutable_urls=["repomd.xml"] + ) + repoB = YumRepository( + id="another-yumrepo", + relative_url="another/publish/url", + mutable_urls=["repomd.xml"], + ) + with FakeCopyRepo() as task_instance: + task_instance.pulp_client_controller.insert_repository(repoA) + task_instance.pulp_client_controller.insert_repository(repoB) + # It should run with expected output. + command_tester.test( + task_instance.main, + [ + "test-copy-repo", + "--pulp-url", + "https://pulp.example.com/", + "--content-type", + "rpm", + "--content-type", + "srpm", # will be coerced to rpm (and deduplicated) + "--content-type", + "modulemd", + "--content-type", # duplicate + "modulemd", + "--content-type", + "iso", + "--content-type", + "erratum", + "--content-type", + "package_group", + "--content-type", + "package_langpacks", + "some-yumrepo,another-yumrepo", + ], + ) + + # we passed 8 content types to command + assert len(task_instance.args.content_type) == 8 + # while creating criteria, content types are sanitized: + # 1. srpm coerced to rpm + # 2. deduplicated + # and converted to list of Criteria + criteria = sorted([str(item) for item in task_instance.content_type_criteria]) + # there should be mix of Criteria.with_unit_type and Criteria.with_field + # but we will try at least check that proper content types are queried + + expected_criteria = sorted( + [ + str(item) + for item in [ + Criteria.with_unit_type( + RpmUnit, + unit_fields=( + "name", + "version", + "release", + "arch", + "sha256sum", + "md5sum", + "signing_key", + ), + ), + Criteria.with_unit_type(ErratumUnit, unit_fields=("unit_id",)), + Criteria.with_unit_type( + ModulemdUnit, + unit_fields=( + "name", + "stream", + "version", + "context", + "arch", + ), + ), + Criteria.with_unit_type(FileUnit, unit_fields=("unit_id",)), + Criteria.with_field( + "content_type_id", + Matcher.in_(["package_group", "package_langpacks"]), + ), + ] + ] + ) + assert criteria == expected_criteria diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_container_repo.jsonl b/tests/logs/copy_repo/test_copy_repo/test_copy_container_repo.jsonl new file mode 100644 index 00000000..24f1caa5 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_container_repo.jsonl @@ -0,0 +1,2 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-error"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_container_repo.txt b/tests/logs/copy_repo/test_copy_repo/test_copy_container_repo.txt new file mode 100644 index 00000000..e385347c --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_container_repo.txt @@ -0,0 +1,4 @@ +[ INFO] Check repos: started +[ ERROR] Container image repo(s) provided, not supported: another-container-repo, some-container-repo +[ ERROR] Check repos: failed +# Raised: 30 diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_empty_repo.jsonl b/tests/logs/copy_repo/test_copy_repo/test_copy_empty_repo.jsonl new file mode 100644 index 00000000..830aad13 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_empty_repo.jsonl @@ -0,0 +1,12 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-end"}} +{"event": {"type": "copy-content-start"}} +{"event": {"type": "copy-content-end"}} +{"event": {"type": "record-push-items-start"}} +{"event": {"type": "record-push-items-end"}} +{"event": {"type": "publish-start"}} +{"event": {"type": "publish-end"}} +{"event": {"type": "flush-ud-cache-start"}} +{"event": {"type": "flush-ud-cache-end"}} +{"event": {"type": "flush-cdn-cache-start"}} +{"event": {"type": "flush-cdn-cache-end"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_empty_repo.txt b/tests/logs/copy_repo/test_copy_repo/test_copy_empty_repo.txt new file mode 100644 index 00000000..dba09944 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_empty_repo.txt @@ -0,0 +1,15 @@ +[ INFO] Check repos: started +[ INFO] Check repos: finished +[ INFO] Copy content: started +[ WARNING] another-filerepo: no content copied, tasks: e3e70682-c209-4cac-629f-6fbed82c07cd +[ INFO] Copy content: finished +[ INFO] Record push items: started +[ INFO] Record push items: finished +[ INFO] Publish: started +[ INFO] Publish: finished +[ INFO] Flush UD cache: started +[ INFO] UD cache flush is not enabled. +[ INFO] Flush UD cache: finished +[ INFO] Flush CDN cache: started +[ INFO] CDN cache flush is not enabled. +[ INFO] Flush CDN cache: finished diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_file_repo.jsonl b/tests/logs/copy_repo/test_copy_repo/test_copy_file_repo.jsonl new file mode 100644 index 00000000..830aad13 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_file_repo.jsonl @@ -0,0 +1,12 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-end"}} +{"event": {"type": "copy-content-start"}} +{"event": {"type": "copy-content-end"}} +{"event": {"type": "record-push-items-start"}} +{"event": {"type": "record-push-items-end"}} +{"event": {"type": "publish-start"}} +{"event": {"type": "publish-end"}} +{"event": {"type": "flush-ud-cache-start"}} +{"event": {"type": "flush-ud-cache-end"}} +{"event": {"type": "flush-cdn-cache-start"}} +{"event": {"type": "flush-cdn-cache-end"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_file_repo.txt b/tests/logs/copy_repo/test_copy_repo/test_copy_file_repo.txt new file mode 100644 index 00000000..e02f0ee6 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_file_repo.txt @@ -0,0 +1,14 @@ +[ INFO] Check repos: started +[ INFO] Check repos: finished +[ INFO] Copy content: started +[ INFO] another-filerepo: copied 2 iso(s), tasks: e3e70682-c209-4cac-629f-6fbed82c07cd +[ INFO] Copy content: finished +[ INFO] Record push items: started +[ INFO] Record push items: finished +[ INFO] Publish: started +[ INFO] Publish: finished +[ INFO] Flush UD cache: started +[ INFO] Flush UD cache: finished +[ INFO] Flush CDN cache: started +[ INFO] CDN cache flush is not enabled. +[ INFO] Flush CDN cache: finished diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_file_skip_publish.jsonl b/tests/logs/copy_repo/test_copy_repo/test_copy_file_skip_publish.jsonl new file mode 100644 index 00000000..62af6c1d --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_file_skip_publish.jsonl @@ -0,0 +1,10 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-end"}} +{"event": {"type": "copy-content-start"}} +{"event": {"type": "copy-content-end"}} +{"event": {"type": "record-push-items-start"}} +{"event": {"type": "record-push-items-end"}} +{"event": {"type": "publish-skip"}} +{"event": {"type": "flush-ud-cache-start"}} +{"event": {"type": "flush-ud-cache-end"}} +{"event": {"type": "flush-cdn-cache-skip"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_file_skip_publish.txt b/tests/logs/copy_repo/test_copy_repo/test_copy_file_skip_publish.txt new file mode 100644 index 00000000..62eddb7c --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_file_skip_publish.txt @@ -0,0 +1,12 @@ +[ INFO] Check repos: started +[ INFO] Check repos: finished +[ INFO] Copy content: started +[ INFO] another-filerepo: copied 1 iso(s), tasks: e3e70682-c209-4cac-629f-6fbed82c07cd +[ INFO] Copy content: finished +[ INFO] Record push items: started +[ INFO] Record push items: finished +[ INFO] Publish: skipped +[ INFO] Flush UD cache: started +[ INFO] UD cache flush is not enabled. +[ INFO] Flush UD cache: finished +[ INFO] Flush CDN cache: skipped diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_repo_criteria.jsonl b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_criteria.jsonl new file mode 100644 index 00000000..830aad13 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_criteria.jsonl @@ -0,0 +1,12 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-end"}} +{"event": {"type": "copy-content-start"}} +{"event": {"type": "copy-content-end"}} +{"event": {"type": "record-push-items-start"}} +{"event": {"type": "record-push-items-end"}} +{"event": {"type": "publish-start"}} +{"event": {"type": "publish-end"}} +{"event": {"type": "flush-ud-cache-start"}} +{"event": {"type": "flush-ud-cache-end"}} +{"event": {"type": "flush-cdn-cache-start"}} +{"event": {"type": "flush-cdn-cache-end"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_repo_criteria.txt b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_criteria.txt new file mode 100644 index 00000000..4f93aae3 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_criteria.txt @@ -0,0 +1,15 @@ +[ INFO] Check repos: started +[ INFO] Check repos: finished +[ INFO] Copy content: started +[ WARNING] another-yumrepo: no content copied, tasks: 23a7711a-8133-2876-37eb-dcd9e87a1613, 82e2e662-f728-b4fa-4248-5e3a0a5d2f34, d4713d60-c8a7-0639-eb11-67b367a9c378, e3e70682-c209-4cac-629f-6fbed82c07cd, e6f4590b-9a16-4106-cf6a-659eb4862b21 +[ INFO] Copy content: finished +[ INFO] Record push items: started +[ INFO] Record push items: finished +[ INFO] Publish: started +[ INFO] Publish: finished +[ INFO] Flush UD cache: started +[ INFO] UD cache flush is not enabled. +[ INFO] Flush UD cache: finished +[ INFO] Flush CDN cache: started +[ INFO] CDN cache flush is not enabled. +[ INFO] Flush CDN cache: finished diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_repo_multiple_content_types.jsonl b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_multiple_content_types.jsonl new file mode 100644 index 00000000..830aad13 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_multiple_content_types.jsonl @@ -0,0 +1,12 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-end"}} +{"event": {"type": "copy-content-start"}} +{"event": {"type": "copy-content-end"}} +{"event": {"type": "record-push-items-start"}} +{"event": {"type": "record-push-items-end"}} +{"event": {"type": "publish-start"}} +{"event": {"type": "publish-end"}} +{"event": {"type": "flush-ud-cache-start"}} +{"event": {"type": "flush-ud-cache-end"}} +{"event": {"type": "flush-cdn-cache-start"}} +{"event": {"type": "flush-cdn-cache-end"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_repo_multiple_content_types.txt b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_multiple_content_types.txt new file mode 100644 index 00000000..f104c4db --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_repo_multiple_content_types.txt @@ -0,0 +1,15 @@ +[ INFO] Check repos: started +[ INFO] Check repos: finished +[ INFO] Copy content: started +[ INFO] another-yumrepo: copied 1 modulemd(s), 1 rpm(s), tasks: 23a7711a-8133-2876-37eb-dcd9e87a1613, 82e2e662-f728-b4fa-4248-5e3a0a5d2f34, d4713d60-c8a7-0639-eb11-67b367a9c378, e3e70682-c209-4cac-629f-6fbed82c07cd +[ INFO] Copy content: finished +[ INFO] Record push items: started +[ INFO] Record push items: finished +[ INFO] Publish: started +[ INFO] Publish: finished +[ INFO] Flush UD cache: started +[ INFO] UD cache flush is not enabled. +[ INFO] Flush UD cache: finished +[ INFO] Flush CDN cache: started +[ INFO] CDN cache flush is not enabled. +[ INFO] Flush CDN cache: finished diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_yum_repo.jsonl b/tests/logs/copy_repo/test_copy_repo/test_copy_yum_repo.jsonl new file mode 100644 index 00000000..830aad13 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_yum_repo.jsonl @@ -0,0 +1,12 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-end"}} +{"event": {"type": "copy-content-start"}} +{"event": {"type": "copy-content-end"}} +{"event": {"type": "record-push-items-start"}} +{"event": {"type": "record-push-items-end"}} +{"event": {"type": "publish-start"}} +{"event": {"type": "publish-end"}} +{"event": {"type": "flush-ud-cache-start"}} +{"event": {"type": "flush-ud-cache-end"}} +{"event": {"type": "flush-cdn-cache-start"}} +{"event": {"type": "flush-cdn-cache-end"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_copy_yum_repo.txt b/tests/logs/copy_repo/test_copy_repo/test_copy_yum_repo.txt new file mode 100644 index 00000000..b9c59764 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_copy_yum_repo.txt @@ -0,0 +1,15 @@ +[ INFO] Check repos: started +[ INFO] Check repos: finished +[ INFO] Copy content: started +[ INFO] another-yumrepo: copied 1 erratum(s), 1 modulemd(s), 1 rpm(s), tasks: e3e70682-c209-4cac-629f-6fbed82c07cd +[ INFO] Copy content: finished +[ INFO] Record push items: started +[ INFO] Record push items: finished +[ INFO] Publish: started +[ INFO] Publish: finished +[ INFO] Flush UD cache: started +[ INFO] UD cache flush is not enabled. +[ INFO] Flush UD cache: finished +[ INFO] Flush CDN cache: started +[ INFO] CDN cache flush is not enabled. +[ INFO] Flush CDN cache: finished diff --git a/tests/logs/copy_repo/test_copy_repo/test_invalid_content_type.jsonl b/tests/logs/copy_repo/test_copy_repo/test_invalid_content_type.jsonl new file mode 100644 index 00000000..0ba3f6fd --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_invalid_content_type.jsonl @@ -0,0 +1,4 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-end"}} +{"event": {"type": "copy-content-start"}} +{"event": {"type": "copy-content-error"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_invalid_content_type.txt b/tests/logs/copy_repo/test_copy_repo/test_invalid_content_type.txt new file mode 100644 index 00000000..e86cf551 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_invalid_content_type.txt @@ -0,0 +1,6 @@ +[ INFO] Check repos: started +[ INFO] Check repos: finished +[ INFO] Copy content: started +[ ERROR] Unsupported content type: container +[ ERROR] Copy content: failed +# Raised: 30 diff --git a/tests/logs/copy_repo/test_copy_repo/test_invalid_repo_pair.jsonl b/tests/logs/copy_repo/test_copy_repo/test_invalid_repo_pair.jsonl new file mode 100644 index 00000000..24f1caa5 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_invalid_repo_pair.jsonl @@ -0,0 +1,2 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-error"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_invalid_repo_pair.txt b/tests/logs/copy_repo/test_copy_repo/test_invalid_repo_pair.txt new file mode 100644 index 00000000..65b4dd2e --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_invalid_repo_pair.txt @@ -0,0 +1,4 @@ +[ INFO] Check repos: started +[ ERROR] Pair(s) must contain two repository IDs, source and destination. Got: 'repo1, ' +[ ERROR] Check repos: failed +# Raised: 30 diff --git a/tests/logs/copy_repo/test_copy_repo/test_missing_repos.jsonl b/tests/logs/copy_repo/test_copy_repo/test_missing_repos.jsonl new file mode 100644 index 00000000..24f1caa5 --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_missing_repos.jsonl @@ -0,0 +1,2 @@ +{"event": {"type": "check-repos-start"}} +{"event": {"type": "check-repos-error"}} diff --git a/tests/logs/copy_repo/test_copy_repo/test_missing_repos.txt b/tests/logs/copy_repo/test_copy_repo/test_missing_repos.txt new file mode 100644 index 00000000..b4e8226b --- /dev/null +++ b/tests/logs/copy_repo/test_copy_repo/test_missing_repos.txt @@ -0,0 +1,4 @@ +[ INFO] Check repos: started +[ ERROR] Requested repo(s) don't exist: repo1, repo2, repo3, repo4 +[ ERROR] Check repos: failed +# Raised: 30