From 1dbc317bda36f68e415e90e1a49bf1f40a48e3f9 Mon Sep 17 00:00:00 2001 From: Tobias Grigo Date: Tue, 14 Nov 2023 12:20:19 +0100 Subject: [PATCH] Add performance tests for pulp deb closes #970 --- CHANGES/970.misc | 1 + pulp_deb/tests/conftest.py | 233 ++++++++++++++++++ pulp_deb/tests/functional/conftest.py | 231 ----------------- pulp_deb/tests/functional/constants.py | 16 ++ pulp_deb/tests/performance/test_publish.py | 53 ++++ .../tests/performance/test_pulp_to_pulp.py | 66 +++++ pulp_deb/tests/performance/test_sync.py | 47 ++++ template_config.yml | 5 +- 8 files changed, 420 insertions(+), 232 deletions(-) create mode 100644 CHANGES/970.misc create mode 100644 pulp_deb/tests/conftest.py create mode 100644 pulp_deb/tests/performance/test_publish.py create mode 100644 pulp_deb/tests/performance/test_pulp_to_pulp.py create mode 100644 pulp_deb/tests/performance/test_sync.py diff --git a/CHANGES/970.misc b/CHANGES/970.misc new file mode 100644 index 000000000..cc2257d73 --- /dev/null +++ b/CHANGES/970.misc @@ -0,0 +1 @@ +Added sync, publish and pulp2pulp performance tests to run with the nightly CI. diff --git a/pulp_deb/tests/conftest.py b/pulp_deb/tests/conftest.py new file mode 100644 index 000000000..2b318e67a --- /dev/null +++ b/pulp_deb/tests/conftest.py @@ -0,0 +1,233 @@ +import pytest +from pathlib import Path + +from pulp_deb.tests.functional.utils import gen_deb_remote, gen_distribution, gen_repo +from pulp_deb.tests.functional.constants import DEB_FIXTURE_STANDARD_REPOSITORY_NAME + +from pulpcore.client.pulp_deb import ( + ApiClient, + AptRepositorySyncURL, + DebAptPublication, + DistributionsAptApi, + PublicationsAptApi, + RemotesAptApi, + RepositoriesAptApi, + RepositoriesAptVersionsApi, +) + + +@pytest.fixture(scope="session") +def apt_client(_api_client_set, bindings_cfg): + """Fixture for APT client.""" + api_client = ApiClient(bindings_cfg) + _api_client_set.add(api_client) + yield api_client + _api_client_set.remove(api_client) + + +@pytest.fixture(scope="session") +def apt_distribution_api(apt_client): + """Fixture for APT distribution API.""" + return DistributionsAptApi(apt_client) + + +@pytest.fixture(scope="session") +def apt_publication_api(apt_client): + """Fixture for APT publication API.""" + return PublicationsAptApi(apt_client) + + +@pytest.fixture(scope="session") +def apt_remote_api(apt_client): + """Fixture for APT remote API.""" + return RemotesAptApi(apt_client) + + +@pytest.fixture(scope="session") +def apt_repository_api(apt_client): + """Fixture for APT repositories API.""" + return RepositoriesAptApi(apt_client) + + +@pytest.fixture(scope="session") +def apt_repository_versions_api(apt_client): + """Fixture for APT repository versions API.""" + return RepositoriesAptVersionsApi(apt_client) + + +@pytest.fixture(scope="class") +def deb_distribution_factory(apt_distribution_api, gen_object_with_cleanup): + """Fixture that generates a deb distribution with cleanup from a given publication.""" + + def _deb_distribution_factory(publication): + """Create a deb distribution. + + :param publication: The publication the distribution is based on. + :returns: The created distribution. + """ + body = gen_distribution() + body["publication"] = publication.pulp_href + return gen_object_with_cleanup(apt_distribution_api, body) + + return _deb_distribution_factory + + +@pytest.fixture(scope="class") +def deb_publication_factory(apt_publication_api, gen_object_with_cleanup): + """Fixture that generates a deb publication with cleanup from a given repository.""" + + def _deb_publication_factory(repo, **kwargs): + """Create a deb publication. + + :param repo: The repository the publication is based on. + :returns: The created publication. + """ + publication_data = DebAptPublication(repository=repo.pulp_href, **kwargs) + return gen_object_with_cleanup(apt_publication_api, publication_data) + + return _deb_publication_factory + + +@pytest.fixture(scope="class") +def deb_repository_factory(apt_repository_api, gen_object_with_cleanup): + """Fixture that generates a deb repository with cleanup.""" + + def _deb_repository_factory(**kwargs): + """Create a deb repository. + + :returns: The created repository. + """ + return gen_object_with_cleanup(apt_repository_api, gen_repo(**kwargs)) + + return _deb_repository_factory + + +@pytest.fixture(scope="class") +def deb_remote_factory(apt_remote_api, gen_object_with_cleanup): + """Fixture that generates a deb remote with cleanup.""" + + def _deb_remote_factory(url, **kwargs): + """Creats a remote from the given url. + + :param url: The name of the local data repository. + :returns: The created remote. + """ + return gen_object_with_cleanup(apt_remote_api, gen_deb_remote(url=str(url), **kwargs)) + + return _deb_remote_factory + + +@pytest.fixture +def deb_sync_repository(apt_repository_api, monitor_task): + """Fixture that synchronizes a given repository with a given remote + and returns the monitored task. + """ + + def _deb_sync_repository(remote, repo, mirror=False, optimize=True): + """Sync a given remote and repository. + + :param remote: The remote where to sync from. + :param repo: The repository that needs syncing. + :param mirror: Whether the sync should use mirror mode. Default False. + :param optimize: Whether the sync should use optimize mode. Default True. + :returns: The task of the sync operation. + """ + repository_sync_data = AptRepositorySyncURL( + remote=remote.pulp_href, mirror=mirror, optimize=optimize + ) + sync_response = apt_repository_api.sync(repo.pulp_href, repository_sync_data) + return monitor_task(sync_response.task) + + return _deb_sync_repository + + +@pytest.fixture +def deb_fixture_server(gen_fixture_server): + """A fixture that spins up a local web server to serve test data.""" + p = Path(__file__).parent.absolute() + fixture_path = p.joinpath("data/") + yield gen_fixture_server(fixture_path, None) + + +@pytest.fixture +def deb_get_fixture_server_url(deb_fixture_server): + """A fixture that provides the url of the local web server.""" + + def _deb_get_fixture_server_url(repo_name=DEB_FIXTURE_STANDARD_REPOSITORY_NAME): + """Generate the URL to the local data repository. + + :param repo_name: Name of the local data repository. Default /debian/. + :returns: The URL of the local data repository. + """ + return deb_fixture_server.make_url(repo_name) + + return _deb_get_fixture_server_url + + +@pytest.fixture +def deb_init_and_sync( + apt_repository_api, + deb_get_fixture_server_url, + deb_repository_factory, + deb_remote_factory, + deb_sync_repository, +): + """Initialize a new repository and remote and sync the content from the passed URL.""" + + def _deb_init_and_sync( + repository=None, + remote=None, + url=None, + remote_args={}, + repo_args={}, + sync_args={}, + return_task=False, + ): + """Initializes and syncs a repository and remote. + + :param repository: An existing repository. Default: None. + :param remote: An existing remote. Default: None. + :param url: The name of the data repository. Default: None -> /debian/. + :param remote_args: Parameters for the remote creation. Default {}. + :param repo_args: Parameters for the repository creation. Default {}. + :param sync_args: Parameters for the sync API call. Default {}. + :param return_task: Whether to include the sync task to the return value. Default: False. + :returns: A tuple containing the repository and remote and optionally the sync task. + """ + if url is None: + url = deb_get_fixture_server_url() + elif url.startswith("http"): + url = url + else: + url = deb_get_fixture_server_url(url) + if repository is None: + repository = deb_repository_factory(**repo_args) + if remote is None: + remote = deb_remote_factory(url=url, **remote_args) + + task = deb_sync_repository(remote, repository, **sync_args) + + repository = apt_repository_api.read(repository.pulp_href) + return (repository, remote) if not return_task else (repository, remote, task) + + return _deb_init_and_sync + + +@pytest.fixture +def deb_get_content_summary(apt_repository_versions_api): + """A fixture that fetches the content summary from a repository.""" + + def _deb_get_content_summary(repo, version_href=None): + """Fetches the content summary from a given repository. + + :param repo: The repository where the content is fetched from. + :param version_href: The repository version from where the content should be fetched from. + Default: latest repository version. + :returns: The content summary of the repository. + """ + version_href = version_href or repo.latest_version_href + if version_href is None: + return {} + return apt_repository_versions_api.read(version_href).content_summary + + return _deb_get_content_summary diff --git a/pulp_deb/tests/functional/conftest.py b/pulp_deb/tests/functional/conftest.py index 04b772030..792e0aff8 100644 --- a/pulp_deb/tests/functional/conftest.py +++ b/pulp_deb/tests/functional/conftest.py @@ -1,5 +1,4 @@ from urllib.parse import urlsplit -from pathlib import Path from uuid import uuid4 import pytest import os @@ -7,15 +6,7 @@ import stat import subprocess -from pulp_deb.tests.functional.utils import gen_deb_remote, gen_distribution, gen_repo -from pulp_deb.tests.functional.constants import ( - DEB_FIXTURE_STANDARD_REPOSITORY_NAME, - DEB_SIGNING_SCRIPT_STRING, -) - from pulpcore.client.pulp_deb import ( - ApiClient, - AptRepositorySyncURL, ContentGenericContentsApi, ContentPackagesApi, ContentPackageIndicesApi, @@ -27,47 +18,15 @@ DebAptPublication, DebCopyApi, DebVerbatimPublication, - DistributionsAptApi, - PublicationsAptApi, PublicationsVerbatimApi, - RemotesAptApi, - RepositoriesAptApi, - RepositoriesAptVersionsApi, ) -@pytest.fixture(scope="session") -def apt_client(_api_client_set, bindings_cfg): - """Fixture for APT client.""" - api_client = ApiClient(bindings_cfg) - _api_client_set.add(api_client) - yield api_client - _api_client_set.remove(api_client) - - -@pytest.fixture(scope="session") -def apt_repository_api(apt_client): - """Fixture for APT repositories API.""" - return RepositoriesAptApi(apt_client) - - -@pytest.fixture(scope="session") -def apt_repository_versions_api(apt_client): - """Fixture for APT repository versions API.""" - return RepositoriesAptVersionsApi(apt_client) - - @pytest.fixture(scope="session") def apt_release_file_api(apt_client): return ContentReleaseFilesApi(apt_client) -@pytest.fixture(scope="session") -def apt_remote_api(apt_client): - """Fixture for APT remote API.""" - return RemotesAptApi(apt_client) - - @pytest.fixture(scope="session") def apt_package_indices_api(apt_client): """Fixture for APT package indices API.""" @@ -80,12 +39,6 @@ def apt_package_release_components_api(apt_client): return ContentPackageReleaseComponentsApi(apt_client) -@pytest.fixture(scope="session") -def apt_publication_api(apt_client): - """Fixture for APT publication API.""" - return PublicationsAptApi(apt_client) - - @pytest.fixture(scope="session") def apt_verbatim_publication_api(apt_client): """Fixture for Verbatim publication API.""" @@ -98,12 +51,6 @@ def apt_copy_api(apt_client): return DebCopyApi(apt_client) -@pytest.fixture(scope="session") -def apt_distribution_api(apt_client): - """Fixture for APT distribution API.""" - return DistributionsAptApi(apt_client) - - @pytest.fixture(scope="session") def apt_package_api(apt_client): """Fixture for APT package API.""" @@ -128,23 +75,6 @@ def apt_generic_content_api(apt_client): return ContentGenericContentsApi(apt_client) -@pytest.fixture(scope="class") -def deb_distribution_factory(apt_distribution_api, gen_object_with_cleanup): - """Fixture that generates a deb distribution with cleanup from a given publication.""" - - def _deb_distribution_factory(publication): - """Create a deb distribution. - - :param publication: The publication the distribution is based on. - :returns: The created distribution. - """ - body = gen_distribution() - body["publication"] = publication.pulp_href - return gen_object_with_cleanup(apt_distribution_api, body) - - return _deb_distribution_factory - - @pytest.fixture(scope="class") def deb_generic_content_factory(apt_generic_content_api, gen_object_with_cleanup): """Fixture that generates deb generic content with cleanup.""" @@ -173,22 +103,6 @@ def _deb_package_factory(**kwargs): return _deb_package_factory -@pytest.fixture(scope="class") -def deb_publication_factory(apt_publication_api, gen_object_with_cleanup): - """Fixture that generates a deb publication with cleanup from a given repository.""" - - def _deb_publication_factory(repo, **kwargs): - """Create a deb publication. - - :param repo: The repository the publication is based on. - :returns: The created publication. - """ - publication_data = DebAptPublication(repository=repo.pulp_href, **kwargs) - return gen_object_with_cleanup(apt_publication_api, publication_data) - - return _deb_publication_factory - - @pytest.fixture def deb_publication_by_version_factory(apt_publication_api, gen_object_with_cleanup): """Fixture that generates a deb publication with cleanup from a given repository version.""" @@ -219,20 +133,6 @@ def _deb_delete_publication(publication): return _deb_delete_publication -@pytest.fixture(scope="class") -def deb_repository_factory(apt_repository_api, gen_object_with_cleanup): - """Fixture that generates a deb repository with cleanup.""" - - def _deb_repository_factory(**kwargs): - """Create a deb repository. - - :returns: The created repository. - """ - return gen_object_with_cleanup(apt_repository_api, gen_repo(**kwargs)) - - return _deb_repository_factory - - @pytest.fixture def deb_repository_get_versions(apt_repository_versions_api): """Fixture that lists the repository versions of a given repository href.""" @@ -270,21 +170,6 @@ def _deb_modify_repository(repo, body): return _deb_modify_repository -@pytest.fixture(scope="class") -def deb_remote_factory(apt_remote_api, gen_object_with_cleanup): - """Fixture that generates a deb remote with cleanup.""" - - def _deb_remote_factory(url, **kwargs): - """Creats a remote from the given url. - - :param url: The name of the local data repository. - :returns: The created remote. - """ - return gen_object_with_cleanup(apt_remote_api, gen_deb_remote(url=str(url), **kwargs)) - - return _deb_remote_factory - - @pytest.fixture def deb_delete_repository(apt_repository_api, monitor_task): """Fixture that deletes a deb repository.""" @@ -445,30 +330,6 @@ def _deb_put_remote(remote, content): return _deb_put_remote -@pytest.fixture -def deb_sync_repository(apt_repository_api, monitor_task): - """Fixture that synchronizes a given repository with a given remote - and returns the monitored task. - """ - - def _deb_sync_repository(remote, repo, mirror=False, optimize=True): - """Sync a given remote and repository. - - :param remote: The remote where to sync from. - :param repo: The repository that needs syncing. - :param mirror: Whether the sync should use mirror mode. Default False. - :param optimize: Whether the sync should use optimize mode. Default True. - :returns: The task of the sync operation. - """ - repository_sync_data = AptRepositorySyncURL( - remote=remote.pulp_href, mirror=mirror, optimize=optimize - ) - sync_response = apt_repository_api.sync(repo.pulp_href, repository_sync_data) - return monitor_task(sync_response.task) - - return _deb_sync_repository - - @pytest.fixture(scope="class") def deb_copy_content(apt_copy_api, monitor_task): """Fixture that copies deb content from a source repository version to a target repository.""" @@ -552,98 +413,6 @@ def deb_signing_service_factory( assert process.returncode == 0 -@pytest.fixture -def deb_fixture_server(gen_fixture_server): - """A fixture that spins up a local web server to serve test data.""" - p = Path(__file__).parent.absolute() - fixture_path = p.joinpath("data/") - yield gen_fixture_server(fixture_path, None) - - -@pytest.fixture -def deb_get_fixture_server_url(deb_fixture_server): - """A fixture that provides the url of the local web server.""" - - def _deb_get_fixture_server_url(repo_name=DEB_FIXTURE_STANDARD_REPOSITORY_NAME): - """Generate the URL to the local data repository. - - :param repo_name: Name of the local data repository. Default /debian/. - :returns: The URL of the local data repository. - """ - return deb_fixture_server.make_url(repo_name) - - return _deb_get_fixture_server_url - - -@pytest.fixture -def deb_init_and_sync( - apt_repository_api, - deb_get_fixture_server_url, - deb_repository_factory, - deb_remote_factory, - deb_sync_repository, -): - """Initialize a new repository and remote and sync the content from the passed URL.""" - - def _deb_init_and_sync( - repository=None, - remote=None, - url=None, - remote_args={}, - repo_args={}, - sync_args={}, - return_task=False, - ): - """Initializes and syncs a repository and remote. - - :param repository: An existing repository. Default: None. - :param remote: An existing remote. Default: None. - :param url: The name of the data repository. Default: None -> /debian/. - :param remote_args: Parameters for the remote creation. Default {}. - :param repo_args: Parameters for the repository creation. Default {}. - :param sync_args: Parameters for the sync API call. Default {}. - :param return_task: Whether to include the sync task to the return value. Default: False. - :returns: A tuple containing the repository and remote and optionally the sync task. - """ - if url is None: - url = deb_get_fixture_server_url() - elif url.startswith("http"): - url = url - else: - url = deb_get_fixture_server_url(url) - if repository is None: - repository = deb_repository_factory(**repo_args) - if remote is None: - remote = deb_remote_factory(url=url, **remote_args) - - task = deb_sync_repository(remote, repository, **sync_args) - - repository = apt_repository_api.read(repository.pulp_href) - return (repository, remote) if not return_task else (repository, remote, task) - - return _deb_init_and_sync - - -@pytest.fixture -def deb_get_content_summary(apt_repository_versions_api): - """A fixture that fetches the content summary from a repository.""" - - def _deb_get_content_summary(repo, version_href=None): - """Fetches the content summary from a given repository. - - :param repo: The repository where the content is fetched from. - :param version_href: The repository version from where the content should be fetched from. - Default: latest repository version. - :returns: The content summary of the repository. - """ - version_href = version_href or repo.latest_version_href - if version_href is None: - return {} - return apt_repository_versions_api.read(version_href).content_summary - - return _deb_get_content_summary - - @pytest.fixture def deb_get_content_types(deb_get_content_summary, request): """A fixture that fetches content by type.""" diff --git a/pulp_deb/tests/functional/constants.py b/pulp_deb/tests/functional/constants.py index 966dc5c1a..7f7d8efb8 100644 --- a/pulp_deb/tests/functional/constants.py +++ b/pulp_deb/tests/functional/constants.py @@ -195,6 +195,22 @@ def _clean_dict(d): } ) +DEB_PERF_DEBIAN_URL = "https://ftp.debian.org/debian/" +DEB_PERF_BOOKWORN = { + "distributions": "bookworm", + "components": "main", + "architectures": "ppc64", + "policy": "on_demand", +} + +DEB_PERF_UBUNTU_URL = "http://archive.ubuntu.com/ubuntu/" +DEB_PERF_JAMMY = { + "distributions": "jammy", + "components": "main", + "policy": "on_demand", + "ignore_missing_package_indices": True, +} + DEB_FIXTURE_PACKAGE_COUNT = DEB_FIXTURE_SUMMARY.get(DEB_PACKAGE_NAME, 0) DEB_REPORT_CODE_SKIP_RELEASE = "sync.release_file.was_skipped" diff --git a/pulp_deb/tests/performance/test_publish.py b/pulp_deb/tests/performance/test_publish.py new file mode 100644 index 000000000..1cc35fa9d --- /dev/null +++ b/pulp_deb/tests/performance/test_publish.py @@ -0,0 +1,53 @@ +"""Tests that publish deb plugin repositories.""" +import pytest + +from pulp_deb.tests.functional.constants import ( + DEB_PACKAGE_NAME, + DEB_PERF_BOOKWORN, + DEB_PERF_DEBIAN_URL, + DEB_PERF_JAMMY, + DEB_PERF_UBUNTU_URL +) + + +@pytest.mark.parametrize( + "url,remote_args", + [ + (DEB_PERF_UBUNTU_URL, DEB_PERF_JAMMY), + (DEB_PERF_DEBIAN_URL, DEB_PERF_BOOKWORN), + ] +) +def test_deb_publish( + apt_publication_api, + apt_repository_versions_api, + deb_init_and_sync, + monitor_task, + url, + remote_args, + delete_orphans_pre, +): + """Publish repositories with the deb plugin.""" + repo, _, task = deb_init_and_sync(url=url, remote_args=remote_args, return_task=True) + task_duration = task.finished_at - task.started_at + waiting_time = task.started_at - task.pulp_created + print( + "\n-> Sync => Waiting time (s): {wait} | Service time (s): {service}".format( + wait=waiting_time.total_seconds(), service=task_duration.total_seconds() + ) + ) + + # Check that we have the correct content counts + repo_ver = apt_repository_versions_api.read(repo.latest_version_href) + assert DEB_PACKAGE_NAME in repo_ver.content_summary.present.keys() + assert DEB_PACKAGE_NAME in repo_ver.content_summary.added.keys() + + # Publishing + response = apt_publication_api.create({"repository": repo.pulp_href}) + task = monitor_task(response.task) + task_duration = task.finished_at - task.started_at + waiting_time = task.started_at - task.pulp_created + print( + "\n-> Publish => Waiting time (s): {wait} | Service time (s): {service}".format( + wait=waiting_time.total_seconds(), service=task_duration.total_seconds() + ) + ) diff --git a/pulp_deb/tests/performance/test_pulp_to_pulp.py b/pulp_deb/tests/performance/test_pulp_to_pulp.py new file mode 100644 index 000000000..d5a0dbcac --- /dev/null +++ b/pulp_deb/tests/performance/test_pulp_to_pulp.py @@ -0,0 +1,66 @@ +"""Tests that verify download of deb content served by Pulp.""" +import pytest + +from pulp_deb.tests.functional.utils import get_counts_from_content_summary +from pulp_deb.tests.functional.constants import ( + DEB_PACKAGE_NAME, + DEB_PERF_BOOKWORN, + DEB_PERF_DEBIAN_URL, + DEB_PERF_JAMMY, + DEB_PERF_UBUNTU_URL, +) + + +@pytest.mark.parallel +@pytest.mark.parametrize( + "url,remote_args", + [ + (DEB_PERF_UBUNTU_URL, DEB_PERF_JAMMY), + (DEB_PERF_DEBIAN_URL, DEB_PERF_BOOKWORN), + ] +) +def test_pulp_to_pulp( + deb_distribution_factory, + deb_get_content_summary, + deb_init_and_sync, + deb_publication_factory, + url, + remote_args +): + """Verify whether content served by pulp can be synced.""" + repo, _, task = deb_init_and_sync(url=url, remote_args=remote_args, return_task=True) + task_duration = task.finished_at - task.started_at + waiting_time = task.started_at - task.pulp_created + print( + "\n-> Sync => Waiting time (s): {wait} | Service time (s): {service}".format( + wait=waiting_time.total_seconds(), service=task_duration.total_seconds() + ) + ) + + # Create a publication and distribution + publication = deb_publication_factory(repo) + distribution = deb_distribution_factory(publication) + + # Create another repo pointing to distribution base_url + repo2, _, task = deb_init_and_sync( + url=distribution.base_url, + remote_args=remote_args, + return_task=True + ) + task_duration = task.finished_at - task.started_at + waiting_time = task.started_at - task.pulp_created + print( + "\n-> Sync => Waiting time (s): {wait} | Service time (s): {service}".format( + wait=waiting_time.total_seconds(), service=task_duration.total_seconds() + ) + ) + + repo_summary = deb_get_content_summary(repo) + repo2_summary = deb_get_content_summary(repo2) + present = get_counts_from_content_summary(repo_summary.present) + present2 = get_counts_from_content_summary(repo2_summary.present) + assert present[DEB_PACKAGE_NAME] == present2[DEB_PACKAGE_NAME] + + added = get_counts_from_content_summary(repo_summary.added) + added2 = get_counts_from_content_summary(repo2_summary.added) + assert added[DEB_PACKAGE_NAME] == added2[DEB_PACKAGE_NAME] diff --git a/pulp_deb/tests/performance/test_sync.py b/pulp_deb/tests/performance/test_sync.py new file mode 100644 index 000000000..20c069340 --- /dev/null +++ b/pulp_deb/tests/performance/test_sync.py @@ -0,0 +1,47 @@ +"""Tests that sync deb plugin repositories.""" +import pytest + +from pulp_deb.tests.functional.constants import ( + DEB_PERF_BOOKWORN, + DEB_PERF_DEBIAN_URL, + DEB_PERF_JAMMY, + DEB_PERF_UBUNTU_URL, +) + + +@pytest.mark.parallel +@pytest.mark.parametrize( + "url,remote_args,resync", + [ + (DEB_PERF_UBUNTU_URL, DEB_PERF_JAMMY, True), + (DEB_PERF_DEBIAN_URL, DEB_PERF_BOOKWORN, True), + ], +) +def test_deb_sync(deb_init_and_sync, url, remote_args, resync): + """Sync repositories with the deb plugin.""" + # Create repository & remote and sync + repo, remote, task = deb_init_and_sync(url=url, remote_args=remote_args, return_task=True) + + task_duration = task.finished_at - task.started_at + waiting_time = task.started_at - task.pulp_created + print( + "\n-> Sync => Waiting time (s): {wait} | Service time (s): {service}".format( + wait=waiting_time.total_seconds(), service=task_duration.total_seconds() + ) + ) + + if resync: + # Sync the repository again. + latest_version_href = repo.latest_version_href + repo, _, task = deb_init_and_sync(repository=repo, remote=remote, return_task=True) + + task_duration = task.finished_at - task.started_at + waiting_time = task.started_at - task.pulp_created + print( + "\n-> Re-sync => Waiting time (s): {wait} | Service time (s): {service}".format( + wait=waiting_time.total_seconds(), service=task_duration.total_seconds() + ) + ) + + # Check that nothing has changed since the last sync. + assert latest_version_href == repo.latest_version_href diff --git a/template_config.yml b/template_config.yml index 9eb17e811..8078f99ae 100644 --- a/template_config.yml +++ b/template_config.yml @@ -77,7 +77,10 @@ test_cli: true test_deprecations: true test_gcp: false test_lowerbounds: true -test_performance: false +test_performance: +- sync +- publish +- pulp_to_pulp test_reroute: true test_s3: true use_issue_template: true