def setUpClass(cls):
        super(SimpleRepoCopyTest, cls).setUpClass()
        #Destination repo
        # make sure repos don't exist
        # no need to wait for repos.delete to happen
        dest_repo_name = cls.__name__ + '_copy'
        dest_repo1 = Repo({'id': dest_repo_name})
        dest_repo1.delete(cls.pulp)
        cls.dest_repo1, _, _ = YumRepo(
            id=dest_repo_name,
            importer=YumImporter(None),
            distributors=[YumDistributor(relative_url='abc')]).create(cls.pulp)

        #2nd Destination Repo
        dest_repo_name = cls.__name__ + '_copy1'
        dest_repo2 = Repo({'id': dest_repo_name})
        dest_repo2.delete(cls.pulp)
        cls.dest_repo2, _, _ = YumRepo(
            id=dest_repo_name,
            importer=YumImporter(None),
            distributors=[YumDistributor(relative_url='xyz')]).create(cls.pulp)

        # Source repo
        default_repo_config = [
            repo for repo in ROLES.repos if repo.type == 'rpm'
        ][0]
        cls.source_repo, _, _ = YumRepo.from_role(default_repo_config).create(
            cls.pulp)
        Task.wait_for_report(cls.pulp, cls.source_repo.sync(cls.pulp))
 def setUpClass(cls):
     super(PuppetCopyRepoTest, cls).setUpClass()
     # this repo role is hardwired because of the search strings
     # refering to exact names as e.g. tomcat7_rhel
     # The proxy role is considered
     repo = {
         'id': cls.__name__,
         'feed': 'https://forge.puppetlabs.com',
         'queries': ['tomcat'],
         'proxy': ROLES.get('proxy'),
     }
     # create source repo and sync it to have modules fetched
     cls.source_repo, _, _ = PuppetRepo.from_role(repo).create(cls.pulp)
     Task.wait_for_report(cls.pulp, cls.source_repo.sync(cls.pulp))
     # create two destinations repos for copy purpose
     importer = PuppetImporter(feed=None, queries=[])
     distributors = [PuppetDistributor()]
     cls.dest_repo1, _, _ = PuppetRepo(id=cls.__name__ + '1',
                                       importer=importer,
                                       distributors=distributors).create(
                                           cls.pulp)
     cls.dest_repo2, _, _ = PuppetRepo(id=cls.__name__ + '2',
                                       importer=importer,
                                       distributors=distributors).create(
                                           cls.pulp)
     # create data for repo
     cls.invalid_repo = Repo(data={'id': cls.__name__ + "_invalidrepo"})
     # create yum repo
     cls.yumrepo, _, _ = YumRepo(
         id=cls.__name__ + 'yum',
         importer=YumImporter(feed=None),
         distributors=[YumDistributor(relative_url='xyz')]).create(cls.pulp)
Ejemplo n.º 3
0
 def testcase_02_upload_rpm(self):
     # create yum-repo, -importer, -distributor
     repo, importer, [distributor] = YumRepo(id='upload_test_rpm_repo', importer=YumImporter(feed=None),
                                         distributors=[YumDistributor(relative_url='xyz')]).create(self.pulp)
     with deleting(self.pulp, repo, importer, distributor) as (repo, importer, distributor):
         # create and perform an rpm url upload
         self.rpm_uploader(self.pulp, self.rpm_url_bear, repo, distributor)
Ejemplo n.º 4
0
 def test_01_repo_sync_finish(self):
     self.el.update(self.pulp, {'event_types': ['repo.sync.finish']})
     self.el.reload(self.pulp)
     repo_role = [repo for repo in ROLES.repos if repo.type == 'rpm'][0]
     repo, importer, [distributor] = YumRepo(
         id='sync_error_repo',
         importer=YumImporter(feed='http://example.com/repos/none'),
         distributors=[YumDistributor(relative_url='/repos/none')
                       ]).create(self.pulp)
     with deleting(self.pulp, repo, importer, distributor):
         response = repo.sync(self.pulp)
         self.assertPulpOK()
         with self.assertRaises(TaskFailure):
             # make sure the sync did not succeed
             Task.wait_for_report(self.pulp, response)
         tasks = Task.from_report(self.pulp, response)
         # assert the bin contains request with a failed task in body
         self.bin.reload()
         assert self.bin.request_count == 1, 'invalid bin.request count: %s' % self.bin.request_count
         el_request = self.bin.requests[0]
         assert el_request.method == 'POST', 'invalid bin request method: %s' % el_request.method
         el_task = Task.from_call_report_data(json.loads(el_request.body))
         # doesn't work and won't get fixed --- disabling
         # assert el_task.state == TASK_ERROR_STATE, 'invalid request.body:Task.state: %s' % el_task.state
         assert el_task.id in [
             task.id for task in tasks
         ], 'invalid request.body:Task.id: %s' % el_task.id
Ejemplo n.º 5
0
 def test_06_associate_importer(self):
     data = YumImporter.from_role(self.repo_role).as_data()
     response = self.repo.associate_importer(self.pulp, data=data)
     self.assertPulp(code=202)
     Task.wait_for_report(self.pulp, response)
     importer = self.repo.get_importer(self.pulp, data['id'])
     # fixed as a doc bug https://bugzilla.redhat.com/show_bug.cgi?id=1076225
     self.assertEqual(importer.id, data['id'])
Ejemplo n.º 6
0
 def test_06_associate_importer(self):
     data = YumImporter.from_role(self.repo_role).as_data()
     response = self.repo.associate_importer(self.pulp, data=data)
     self.assertPulp(code=202)
     Task.wait_for_report(self.pulp, response)
     importer = self.repo.get_importer(self.pulp, data['id'])
     # fixed as a doc bug https://bugzilla.redhat.com/show_bug.cgi?id=1076225
     self.assertEqual(importer.id, data['id'])
Ejemplo n.º 7
0
 def testcase_03_parallel_upload_rpms(self):
     import gevent
     repo, importer, [distributor] = YumRepo(id='upload_test_rpm_repo', importer=YumImporter(feed=None),
                                         distributors=[YumDistributor(relative_url='xyz')]).create(self.pulp)
     with deleting(self.pulp, repo, importer, distributor) as (repo, importer, distributor):
         # create and perform an rpm url upload
         jobs = [gevent.spawn(lambda: self.rpm_uploader(self.pulp, url, repo, distributor)) for url in \
                         [self.rpm_url_bear, self.rpm_url_mouse]]
         gevent.joinall(jobs, raise_error=True)
    def setUpClass(cls):
        super(RegRepoNoFeedTest, cls).setUpClass()

        # create repo
        cls.repo, cls.importer, [cls.distributor] = YumRepoFacade(
            id=cls.__name__ + "_repo",
            importer=YumImporter(feed=None),
            distributors=[YumDistributor(relative_url='foo')]).create(cls.pulp)

        # create consumer
        cls.consumer = Consumer(ROLES.consumers[0])
        setattr(cls.consumer, 'cli', Cli.ready_instance(**ROLES.consumers[0]))

        # rpm
        cls.rpm_url_pike = 'https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/pike-2.2-1.noarch.rpm'
Ejemplo n.º 9
0
    def setUpClass(cls):
        super(RegRepoCopyTest, cls).setUpClass()

        # create repo
        repo_role = [repo for repo in ROLES.repos
                     if repo.type == 'rpm'][0].copy()
        repo_role.id = cls.__name__ + '_repo1'
        cls.repo1, cls.importer1, [
            cls.distributor1
        ] = YumRepoFacade.from_role(repo_role).create(cls.pulp)
        cls.repo2, cls.importer2, [cls.distributor2] = YumRepoFacade(
            id=cls.__name__ + '_repo2',
            importer=YumImporter(feed=None),
            distributors=[YumDistributor(relative_url='xyz')]).create(cls.pulp)

        # create consumer
        cls.consumer = Consumer(ROLES.consumers[0])
        setattr(cls.consumer, 'cli', Cli.ready_instance(**ROLES.consumers[0]))
Ejemplo n.º 10
0
 def test_07_associate_importer_to_unexistant_repo(self):
     data = YumImporter.from_role(self.repo_role).as_data()
     self.repo2.associate_importer(self.pulp, data=data)
     self.assertPulp(code=404)
Ejemplo n.º 11
0
 def test_05_associate_importer_with_invalid_type(self):
     data = YumImporter.from_role(
         self.repo_role).as_data(importer_type_id='invalid_importer')
     self.repo.associate_importer(self.pulp, data=data)
     self.assertPulp(code=400)
Ejemplo n.º 12
0
    def setUpClass(cls):
        super(PackageCategoryTest, cls).setUpClass()
        repo_role = [repo for repo in ROLES.repos if repo.type == 'rpm'][0].copy()
        repo_role.id = cls.__name__ + '_repo1'
        cls.repo1, cls.importer1, [cls.distributor1] = YumRepo.from_role(repo_role).create(cls.pulp)
        cls.repo2, cls.importer2, [cls.distributor2] = YumRepo(id=cls.__name__ + '_repo2', importer=YumImporter(feed=None),
                        distributors=[YumDistributor(relative_url='xyz')]).create(cls.pulp)

        #sync
        with cls.pulp.asserting(True):
            response = cls.repo1.sync(cls.pulp)
        Task.wait_for_report(cls.pulp, response)
        #publish
        with cls.pulp.asserting(True):
            response = cls.repo1.publish(cls.pulp, cls.distributor1.id)
        Task.wait_for_report(cls.pulp, response)
Ejemplo n.º 13
0
 def testcase_01_upload_and_download_using_dnf_rpm(self):
     # create yum-repo, -importer, -distributor
     repo, importer, [distributor] = YumRepo(id='test_22_rpm_repo_for_dnf', importer=YumImporter(feed=None),
                                         distributors=[YumDistributor(relative_url='xyz')]).create(self.pulp)
     with deleting(self.pulp, repo, importer, distributor):
         # create and perform an rpm url upload
         with deleting(self.pulp, upload_url_rpm(self.pulp, self.rpm_url)) as (upload,):
             # assign the upload to the repo
             response = upload.import_to(self.pulp, repo)
             self.assertPulpOK()
             Task.wait_for_report(self.pulp, response)
             # check the content is accessible
             response = repo.publish(self.pulp, distributor.id)
             self.assertPulpOK()
             Task.wait_for_report(self.pulp, response)
             # fetch the package through the repo
             pulp_rpm_url = distributor.content_url(self.pulp, url_basename(self.rpm_url))
             pulp_repo = distributor.content_url(self.pulp)
             with closing(temp_url(pulp_rpm_url)) as tmpfile:
                 assert url_basename(self.rpm_url).startswith(rpm_metadata(tmpfile)['unit_key']['name'])
             assert "bear" == download_package_with_dnf(self.pulp, pulp_repo, "bear")
Ejemplo n.º 14
0
 def test_07_associate_importer_to_unexistant_repo(self):
     data = YumImporter.from_role(self.repo_role).as_data()
     self.repo2.associate_importer(self.pulp, data=data)
     self.assertPulp(code=404)
Ejemplo n.º 15
0
 def test_05_associate_importer_with_invalid_type(self):
     data = YumImporter.from_role(self.repo_role).as_data(importer_type_id='invalid_importer')
     self.repo.associate_importer(self.pulp, data=data)
     self.assertPulp(code=400)