def test_all(self): """Verify whether content served by pulp can be downloaded. The process of publishing content is more involved in Pulp 3 than it was under Pulp 2. Given a repository, the process is as follows: 1. Create a publication from the repository. (The latest repository version is selected if no version is specified.) A publication is a repository version plus metadata. 2. Create a distribution from the publication. The distribution defines at which URLs a publication is available, e.g. ``http://example.com/content/foo/`` and ``http://example.com/content/bar/``. Do the following: 1. Create, populate, publish, and distribute a repository. 2. Select a random content unit in the distribution. Download that content unit from Pulp, and verify that the content unit has the same checksum when fetched directly from Pulp-Fixtures. This test targets the following issues: * `Pulp #2895 <https://pulp.plan.io/issues/2895>`_ * `Pulp Smash #872 <https://github.com/pulp/pulp-smash/issues/872>`_ """ remote = self._create_remote() repo = self._create_repo_and_sync_with_remote(remote) pub = self._create_publication(repo) distro = self._create_distribution_from_publication(pub) # Pick a content unit (of each type), and download it from both Pulp Fixtures… unit_paths = [ choice(paths) for paths in get_python_content_paths(repo.to_dict()).values() ] fixtures_hashes = [ hashlib.sha256( utils.http_get( urljoin(urljoin(PYTHON_FIXTURE_URL, "packages/"), unit_path[0]))).hexdigest() for unit_path in unit_paths ] # …and Pulp. pulp_hashes = [] for unit_path in unit_paths: content = download_content_unit(cfg, distro.to_dict(), unit_path[1]) pulp_hashes.append(hashlib.sha256(content).hexdigest()) self.assertEqual(fixtures_hashes, pulp_hashes)
def test_all(self): """ Verify whether content served by pulp can be downloaded. The process of publishing content is more involved in Pulp 3 than it was under Pulp 2. Given a repository, the process is as follows: 1. Create a publication from the repository. (The latest repository version is selected if no version is specified.) A publication is a repository version plus metadata. 2. Create a distribution from the publication. The distribution defines at which URLs a publication is available, e.g. ``http://example.com/content/pub-name/`` and ``https://example.com/content/pub-name/``. Do the following: 1. Create, populate, publish, and distribute a repository. 2. Select a random content unit in the distribution. Download that content unit from Pulp, and verify that the content unit has the same checksum when fetched directly from Pulp-Fixtures. This test targets the following issues: * `Pulp #2895 <https://pulp.plan.io/issues/2895>`_ * `Pulp Smash #872 <https://github.com/PulpQE/pulp-smash/issues/872>`_ """ cfg = config.get_config() client = api.Client(cfg, api.json_handler) repo = client.post(REPO_PATH, gen_repo()) self.addCleanup(client.delete, repo['_href']) body = gen_python_remote(PYTHON_FIXTURES_URL) remote = client.post(PYTHON_REMOTE_PATH, body) self.addCleanup(client.delete, remote['_href']) sync(cfg, remote, repo) repo = client.get(repo['_href']) # Create a publication publication = gen_python_publication(cfg, repository=repo) self.addCleanup(client.delete, publication['_href']) # Create a distribution. body = gen_distribution() body['publication'] = publication['_href'] distribution = client.using_handler(api.task_handler).post( PYTHON_DISTRIBUTION_PATH, body) self.addCleanup(client.delete, distribution['_href']) # Pick a file, and download it from both Pulp Fixtures… unit_path = choice(get_python_content_paths(repo)) fixtures_hash = hashlib.sha256( utils.http_get( urljoin(urljoin(PYTHON_FIXTURES_URL, 'packages/'), unit_path))).hexdigest() # …and Pulp. content = download_content_unit(cfg, distribution, unit_path) pulp_hash = hashlib.sha256(content).hexdigest() self.assertEqual(fixtures_hash, pulp_hash)
def test_all(self): """Verify whether content served by pulp can be downloaded. The process of publishing content is more involved in Pulp 3 than it was under Pulp 2. Given a repository, the process is as follows: 1. Create a publication from the repository. (The latest repository version is selected if no version is specified.) A publication is a repository version plus metadata. 2. Create a distribution from the publication. The distribution defines at which URLs a publication is available, e.g. ``http://example.com/content/foo/`` and ``http://example.com/content/bar/``. Do the following: 1. Create, populate, publish, and distribute a repository. 2. Select a random content unit in the distribution. Download that content unit from Pulp, and verify that the content unit has the same checksum when fetched directly from Pulp-Fixtures. This test targets the following issues: * `Pulp #2895 <https://pulp.plan.io/issues/2895>`_ * `Pulp Smash #872 <https://github.com/pulp/pulp-smash/issues/872>`_ """ client = gen_python_client() repo_api = RepositoriesPythonApi(client) remote_api = RemotesPythonApi(client) publications = PublicationsPypiApi(client) distributions = DistributionsPypiApi(client) repo = repo_api.create(gen_repo()) self.addCleanup(repo_api.delete, repo.pulp_href) body = gen_python_remote() remote = remote_api.create(body) self.addCleanup(remote_api.delete, remote.pulp_href) # Sync a Repository repository_sync_data = RepositorySyncURL(remote=remote.pulp_href) sync_response = repo_api.sync(repo.pulp_href, repository_sync_data) monitor_task(sync_response.task) repo = repo_api.read(repo.pulp_href) # Create a publication. publish_data = PythonPythonPublication(repository=repo.pulp_href) publish_response = publications.create(publish_data) created_resources = monitor_task(publish_response.task) publication_href = created_resources[0] self.addCleanup(publications.delete, publication_href) # Create a distribution. body = gen_distribution() body["publication"] = publication_href distribution_response = distributions.create(body) created_resources = monitor_task(distribution_response.task) distribution = distributions.read(created_resources[0]) self.addCleanup(distributions.delete, distribution.pulp_href) # Pick a content unit (of each type), and download it from both Pulp Fixtures… unit_paths = [ choice(paths) for paths in get_python_content_paths(repo.to_dict()).values() ] fixtures_hashes = [ hashlib.sha256( utils.http_get( urljoin(urljoin(PYTHON_FIXTURE_URL, "packages/"), unit_path[0]))).hexdigest() for unit_path in unit_paths ] # …and Pulp. pulp_hashes = [] cfg = config.get_config() for unit_path in unit_paths: content = download_content_unit(cfg, distribution.to_dict(), unit_path[1]) pulp_hashes.append(hashlib.sha256(content).hexdigest()) self.assertEqual(fixtures_hashes, pulp_hashes)
def test_all(self): """ Verify whether content served by pulp can be downloaded. The process of publishing content is more involved in Pulp 3 than it was under Pulp 2. Given a repository, the process is as follows: 1. Create a publication from the repository. (The latest repository version is selected if no version is specified.) A publication is a repository version plus metadata. 2. Create a distribution from the publication. The distribution defines at which URLs a publication is available, e.g. ``http://example.com/content/pub-name/`` and ``https://example.com/content/pub-name/``. Do the following: 1. Create, populate, publish, and distribute a repository. 2. Select a random content unit in the distribution. Download that content unit from Pulp, and verify that the content unit has the same checksum when fetched directly from Pulp-Fixtures. This test targets the following issues: * `Pulp #2895 <https://pulp.plan.io/issues/2895>`_ * `Pulp Smash #872 <https://github.com/PulpQE/pulp-smash/issues/872>`_ """ cfg = config.get_config() client = api.Client(cfg, api.json_handler) repo = client.post(REPO_PATH, gen_repo()) self.addCleanup(client.delete, repo['_href']) body = gen_python_remote(PYTHON_FIXTURES_URL) remote = client.post(PYTHON_REMOTE_PATH, body) self.addCleanup(client.delete, remote['_href']) sync(cfg, remote, repo) repo = client.get(repo['_href']) # Create a publication publication = gen_python_publication(cfg, repository=repo) self.addCleanup(client.delete, publication['_href']) # Create a distribution. body = gen_distribution() body['publication'] = publication['_href'] distribution = client.using_handler(api.task_handler).post( DISTRIBUTION_PATH, body ) self.addCleanup(client.delete, distribution['_href']) # Pick a file, and download it from both Pulp Fixtures… unit_path = choice(get_python_content_paths(repo)) fixtures_hash = hashlib.sha256( utils.http_get(urljoin(urljoin(PYTHON_FIXTURES_URL, 'packages/'), unit_path)) ).hexdigest() # …and Pulp. content = download_content_unit(cfg, distribution, unit_path) pulp_hash = hashlib.sha256(content).hexdigest() self.assertEqual(fixtures_hash, pulp_hash)