def setUpClass(cls): """ Create all the client instances needed to communicate with Pulp and run a migration. """ super().setUpClass() set_pulp2_snapshot(name="rpm_kickstart_immediate_no_rpm")
def setUpClass(cls): """ Create all the client instances needed to communicate with Pulp and run a migration. """ super().setUpClass() set_pulp2_snapshot(name="rpm_base_4repos") cls.run_migration(cls.plan_initial)
def setUpClass(cls): """ Create all the client instances needed to communicate with Pulp. """ configuration = Configuration(**BINDINGS_CONFIGURATION) migration_client = MigrationApiClient(configuration) # Create api clients for the resource types we need cls.migration_plans_api = MigrationPlansApi(migration_client) set_pulp2_snapshot(name='file_base_4repos')
def setUpClass(cls): """ Create all the client instances needed to communicate with Pulp and run migrations. """ super().setUpClass() def collect_migration_data(): """Collect data from a migration run to use later for comparison.""" data = { 'repos': defaultdict(dict), 'remotes': defaultdict(dict), 'publications': defaultdict(dict), 'distributions': defaultdict(dict), 'pulp2content': defaultdict(dict), } for repo in cls.rpm_repo_api.list().results: latest_version = cls.rpm_repo_versions_api.read( repo.latest_version_href) data['repos'][repo.name] = { 'created': repo.pulp_created, 'latest_version_number': latest_version.number, 'latest_version_created': latest_version.pulp_created, } for remote in cls.rpm_remote_api.list().results: data['remotes'][remote.name] = {'created': remote.pulp_created} for pub in cls.rpm_publication_api.list().results: data['publications'][pub.repository] = { 'created': pub.pulp_created } for dist in cls.rpm_distribution_api.list().results: data['distributions'][dist.name] = { 'created': dist.pulp_created } for pulp2content in cls.pulp2content_api.list().results: data['pulp2content'][pulp2content.pulp2_id] = { 'pulp3content': pulp2content.pulp3_content } return data set_pulp2_snapshot(name='rpm_base_4repos') cls.task_initial = cls.run_migration(cls.plan_initial) cls.first_migration_data = collect_migration_data() set_pulp2_snapshot(name='rpm_base_4repos_rerun_changes') cls.task_rerun = cls.run_migration(cls.plan_rerun)
def setUpClass(cls): """ Create all the client instances needed to communicate with Pulp. """ configuration = Configuration(**BINDINGS_CONFIGURATION) file_client = FileApiClient(configuration) migration_client = MigrationApiClient(configuration) # Create api clients for all resource types cls.file_repo_api = RepositoriesFileApi(file_client) cls.file_content_api = ContentFilesApi(file_client) cls.migration_plans_api = MigrationPlansApi(migration_client) cls.pulp2content_api = Pulp2ContentApi(migration_client) cls.pulp2repositories_api = Pulp2RepositoriesApi(migration_client) set_pulp2_snapshot(name='file_base_4repos')
def test_rpm_iso_migration_sequential(self): """Test migrating RPM plugin and ISO plugin in two separate runs""" set_pulp2_snapshot(name='rpm_base_4repos') self.run_migration(RPM_SIMPLE_PLAN) set_pulp2_snapshot(name='file_base_4repos') self.run_migration(FILE_SIMPLE_PLAN) rpm_repo_count = 3 file_repo_count = 4 self.assertEqual(self.rpm_repo_api.list().count, rpm_repo_count) self.assertEqual(self.rpm_publication_api.list().count, rpm_repo_count) self.assertEqual(self.rpm_distribution_api.list().count, rpm_repo_count) self.assertEqual(self.file_repo_api.list().count, file_repo_count) self.assertEqual(self.file_publication_api.list().count, file_repo_count) self.assertEqual(self.file_distribution_api.list().count, file_repo_count)
def test_migrate_copy_into_same_repo(self): """ Test the migration of a pulp 2 copy repo into the same pulp 3 repo as the original one. All advisories should be in place. """ set_pulp2_snapshot(name='rpm_base_4repos') self.task_initial = self.run_migration(self.plan_initial) set_pulp2_snapshot(name='rpm_base_4repos_rerun_copy') self.task_rerun = self.run_migration(COPY_INTO_SAME_REPO_PLAN) pulp2repo = self.pulp2repositories_api.list( pulp2_repo_id='rpm-with-modules').results[0] version_href = pulp2repo.pulp3_repository_version repo_advisories = self.rpm_content_apis['advisory'].list( repository_version=version_href) self.assertEqual(repo_advisories.count, 6) self.assertEqual( self.rpm_distribution_api.list( base_path='rpm-with-modules-copy').count, 1)
def test_migrate_copy_into_new_repo(self): """ Test the migration of a pulp 2 copy repo into the new pulp 3 repo. All advisories should be in place. """ set_pulp2_snapshot(name="rpm_base_4repos") self.task_initial = self.run_migration(self.plan_initial) set_pulp2_snapshot(name="rpm_base_4repos_rerun_copy") self.task_rerun = self.run_migration(COPY_INTO_NEW_REPO_PLAN) pulp2repo = self.pulp2repositories_api.list( pulp2_repo_id="rpm-with-modules-copy").results[0] version_href = pulp2repo.pulp3_repository_version repo_advisories = self.rpm_content_apis["advisory"].list( repository_version=version_href) self.assertEqual( self.rpm_repo_versions_api.read(version_href).number, 1) self.assertEqual(repo_advisories.count, 6) self.assertEqual( self.rpm_distribution_api.list( base_path="rpm-with-modules-copy").count, 1)
def setUpClass(cls): """ Populate needed pulp2 snapshot. """ super().setUpClass() set_pulp2_snapshot(name="file_base_4repos")