def test_03_delete_orphans(self):
     delete_response = Orphans.delete(self.pulp)
     self.assertPulpOK()
     Task.wait_for_report(self.pulp, delete_response)
     info = Orphans.info(self.pulp)
     orphans = Orphans.get(self.pulp)
     self.assertPulpOK()
     for orphan_type_name in info.keys():
         self.assertEqual(len(orphans[orphan_type_name]), info[orphan_type_name]['count'])
         self.assertEqual(orphans[orphan_type_name], [])
 def test_01_orphan_info_data_integrity(self):
     info = Orphans.info(self.pulp)
     orphans = Orphans.get(self.pulp)
     self.assertPulpOK()
     for orphan_type_name in orphans.keys():
         # reported count info is the same as the orphans counted
         self.assertEqual(len(orphans[orphan_type_name]), info[orphan_type_name]['count'])
         orphan_type = UnitFactory.type_map.orphans[orphan_type_name]
         # '_href' is correct
         self.assertEqual(pulp_auto.path_join(pulp_auto.path, orphan_type.path), info[orphan_type_name]['_href'])
         # all orphans are of the same type
         for orphan in orphans[orphan_type_name]:
             self.assertTrue(isinstance(orphan, orphan_type), "different type: %s, %s" % (orphan_type_name, orphan.type_id))
 def test_02_delete_single_orphan(self):
     old_info = Orphans.info(self.pulp)
     rpm_orphans = RpmOrphan.list(self.pulp)
     assert rpm_orphans, "No orphans found; there might be other 'Zoo' repos in %s" % self.pulp
     rpm_orphans[0].delete(self.pulp)
     del rpm_orphans[0]
     self.assertPulpOK()
     new_info = Orphans.info(self.pulp)
     self.assertEqual(old_info['rpm']['count'], new_info['rpm']['count'] + 1)
     self.assertEqual(
         sorted(map(lambda x: x.data['name'], rpm_orphans)),
         sorted(map(lambda x: x.data['name'], RpmOrphan.list(self.pulp)))
     )
 def test_02_delete_single_orphan(self):
     old_info = Orphans.info(self.pulp)
     rpm_orphans = RpmOrphan.list(self.pulp)
     assert rpm_orphans, "No orphans found; there might be other 'Zoo' repos in %s" % self.pulp
     response = rpm_orphans[0].delete(self.pulp)
     Task.wait_for_report(self.pulp, response)
     del rpm_orphans[0]
     self.assertPulpOK()
     new_info = Orphans.info(self.pulp)
     self.assertEqual(old_info['rpm']['count'], new_info['rpm']['count'] + 1)
     self.assertEqual(
         sorted(map(lambda x: x.data['name'], rpm_orphans)),
         sorted(map(lambda x: x.data['name'], RpmOrphan.list(self.pulp)))
     )
 def tearDownClass(cls):
     for repo_id in ['SimpleRepoCopyTest_repo', 'SimpleRepoCopyTest_copy', 'SimpleRepoCopyTest_copy1']:
         Repo({'id': repo_id}).delete(cls.pulp)
     #orphans also should be deleted in cleanup
     delete_response = Orphans.delete(cls.pulp)
     delete_task = Task.from_response(delete_response)
     delete_task.wait(cls.pulp)
Example #6
0
 def tearDownClass(cls):
     with \
         cls.pulp.asserting(True), \
         cls.agent.catching(False), \
         cls.agent.running(cls.qpid_handle, frequency=10) \
     :
         Task.wait_for_report(cls.pulp, cls.repo.delete(cls.pulp))
         Task.wait_for_report(cls.pulp, Orphans.delete(cls.pulp))
         cls.consumer.delete(cls.pulp)
     super(ConsumerAgentPulpTest, cls).tearDownClass()
 def test_10_check_orphan_appears(self):
     # unasosciate same module that was unassocited in dest_repo1
     response = self.dest_repo2.unassociate_units(
         self.pulp, data={"criteria": {"type_ids": ["puppet_module"], "filters": {"unit": {"name": "tomcat7_rhel"}}}}
     )
     self.assertPulp(code=202)
     Task.wait_for_report(self.pulp, response)
     # check 1 orphan appeared
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info["puppet_module"]["count"], 1)
Example #8
0
 def test_06_delete_orphan_by_type_and_id_1092467(self):
     # https://bugzilla.redhat.com/show_bug.cgi?id=1092467
     response = Orphans.delete_by_type_id(
         self.pulp,
         data=[{
             'content_type_id': 'rpm',
             'unit_id': 'd0dc2044-1edc-4298-bf10-a472ea943fe1'
         }])
     self.assertPulpOK()
     Task.wait_for_report(self.pulp, response)
Example #9
0
 def test_10_check_orphan_appears(self):
     #unasosciate same module that was unassocited in dest_repo1
     response = self.dest_repo2.unassociate_units(
         self.pulp,
         data={"criteria": {"type_ids": ["puppet_module"], "filters": {"unit": {"name": "tomcat7_rhel"}}}}
     )
     self.assertPulp(code=202)
     Task.wait_for_report(self.pulp, response)
     #check 1 orphan appeared
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['puppet_module']['count'], 1)
    def tearDownClass(cls):
        # delete repo
        with cls.pulp.asserting(True):
            response = cls.repo.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, response)
        
        # delete orphans
        with cls.pulp.asserting(True):
            response = Orphans.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, response)

        # unregister consumer
        cls.consumer.cli.unregister()
        super(RegRepoNoFeedTest, cls).tearDownClass()
    def tearDownClass(cls):
        # delete repo
        with cls.pulp.asserting(True):
            response = cls.repo.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, response)

        # delete orphans
        with cls.pulp.asserting(True):
            response = Orphans.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, response)

        # unregister consumer
        cls.consumer.cli.unregister()
        super(RegRepoFeedTest, cls).tearDownClass()
 def test_09_check_orphan_appears(self):
     #delete source repo
     self.source_repo.delete(self.pulp)
     self.assertPulpOK()
     #unasosciate same module that was unassocited in dest_repo1
     response = self.dest_repo2.unassociate_units(
         self.pulp,
         data={"criteria": {"type_ids": ["iso"], "filters": {"unit": {"name": "test.iso"}}}}
     )
     self.assertPulp(code=202)
     Task.wait_for_report(self.pulp, response)
     #check 1 orphan appeared
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['iso']['count'], 1)
Example #13
0
    def tearDownClass(cls):
        with cls.pulp.asserting(True):
            response = cls.repo1.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, response)

        with cls.pulp.asserting(True):
            response = cls.repo2.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, response)

        # delete orphans
        with cls.pulp.asserting(True):
            response = Orphans.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, response)

        super(PackageCategoryTest, cls).tearDownClass()
 def test_09_check_orphan_appears(self):
     #delete source repo
     self.source_repo.delete(self.pulp)
     self.assertPulpOK()
     #unasosciate same module that was unassocited in dest_repo1
     response = self.dest_repo2.unassociate_units(
         self.pulp,
         data={"criteria": {"type_ids": ["puppet_module"], "filters": {"unit": {"name": "tomcat7_rhel"}}}}
     )
     self.assertPulp(code=202)
     task = Task.from_response(response)
     task.wait(self.pulp)
     #check 1 orphan appeared
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['puppet_module']['count'], 1)
Example #15
0
 def test_09_check_orphan_appears(self):
     #delete source repo
     response = self.source_repo.delete(self.pulp)
     self.assertPulpOK()
     Task.wait_for_report(self.pulp, response)
     #unasosciate same module that was unassocited in dest_repo1
     response = self.dest_repo2.unassociate_units(self.pulp,
                                                  data={
                                                      "criteria": {
                                                          "type_ids":
                                                          ["iso"],
                                                          "filters": {
                                                              "unit": {
                                                                  "name":
                                                                  "test.iso"
                                                              }
                                                          }
                                                      }
                                                  })
     self.assertPulp(code=202)
     Task.wait_for_report(self.pulp, response)
     #check 1 orphan appeared
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['iso']['count'], 1)
 def test_10_delete_orphans(self):
     delete_response = Orphans.delete(self.pulp)
     self.assertPulpOK()
     task = Task.from_response(delete_response)
     task.wait(self.pulp)
Example #17
0
 def test_07_delete_orphans(self):
     response = Orphans.delete(self.pulp)
     Task.wait_for_report(self.pulp, response)
 def test_10_delete_orphans(self):
     delete_response = Orphans.delete(self.pulp)
     self.assertPulpOK()
     Task.wait_for_report(self.pulp, delete_response)
 def test_08_check_no_orphan_appeared(self):
     #check that after unassociation of module it did not appered among orphans as it is still referenced to other repo
     orphans = Orphans.get(self.pulp)
     self.assertEqual(orphans['iso'], [])
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['iso']['count'], 0)
 def test_13_check_deleted_orphans(self):
     # check that all puppet_module orphans were successfully deleted
     orphans = Orphans.get(self.pulp)
     self.assertEqual(orphans['iso'], [])
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['iso']['count'], 0)
Example #21
0
class SimpleRepoCopyTest(pulp_test.PulpTest):
    @classmethod
    def setUpClass(cls):
        super(SimpleRepoCopyTest, cls).setUpClass()
        #Destination repo
        # make sure repos don't exist
        # no need to wait for repos.delete to happen
        feed = None
        dest_repo_name = cls.__name__ + '_copy'
        dest_repo1 = Repo({'id': dest_repo_name})
        dest_repo1.delete(cls.pulp)
        cls.dest_repo1, _, _ = create_yum_repo(cls.pulp, dest_repo_name, feed)

        #2nd Destination Repo
        dest_repo_name = cls.__name__ + '_copy1'
        dest_repo2 = Repo({'id': dest_repo_name})
        dest_repo2.delete(cls.pulp)
        cls.dest_repo2, _, _ = create_yum_repo(cls.pulp, dest_repo_name, feed)

        # Source repo
        default_repo_config = [
            repo for repo in ROLES.repos if repo.type == 'rpm'
        ][0]
        source_repo_name = cls.__name__ + '_repo'
        source_repo = Repo({'id': source_repo_name})
        source_repo.delete(cls.pulp)
        cls.source_repo, _, _ = create_yum_repo(cls.pulp, source_repo_name,
                                                default_repo_config.feed)
        Task.wait_for_report(cls.pulp, cls.source_repo.sync(cls.pulp))

    def test_01_copy_repo_all(self):
        response = self.dest_repo1.copy(self.pulp,
                                        self.source_repo.id,
                                        data={})
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_02_copy_1_rpm(self):
        # copy 1 rpm
        response = self.dest_repo2.copy(self.pulp,
                                        self.source_repo.id,
                                        data={
                                            'criteria': {
                                                'type_ids': ['rpm'],
                                                'filters': {
                                                    "unit": {
                                                        "name": "cow"
                                                    }
                                                }
                                            },
                                        })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_03_check_that_one_rpm(self):
        # check that there is precisly one module
        dest_repo2 = Repo.get(self.pulp, self.dest_repo2.id)
        self.assertEqual(dest_repo2.data['content_unit_counts']['rpm'], 1)
        # check that one exact module copied i.e. perform the search by modules name
        response = self.dest_repo2.within_repo_search(self.pulp,
                                                      data={
                                                          "criteria": {
                                                              "type_ids":
                                                              ["rpm"],
                                                              "filters": {
                                                                  "unit": {
                                                                      "name":
                                                                      "cow"
                                                                  }
                                                              }
                                                          }
                                                      })
        self.assertPulp(code=200)
        result = Association.from_response(response)
        # this means that only one module found with that name
        self.assertTrue(len(result) == 1)

    def test_04_unassociate_rpm_from_copied_repo(self):
        # unassociate unit from a copied repo
        response = self.dest_repo1.unassociate_units(self.pulp,
                                                     data={
                                                         "criteria": {
                                                             "type_ids":
                                                             ["rpm"],
                                                             "filters": {
                                                                 "unit": {
                                                                     "name":
                                                                     "cow"
                                                                 }
                                                             }
                                                         }
                                                     })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_05_check_rpm_was_unassociated(self):
        #perform a search within the repo
        response = self.dest_repo1.within_repo_search(self.pulp,
                                                      data={
                                                          "criteria": {
                                                              "type_ids":
                                                              ["rpm"],
                                                              "filters": {
                                                                  "unit": {
                                                                      "name":
                                                                      "cow"
                                                                  }
                                                              }
                                                          }
                                                      })
        self.assertPulp(code=200)
        result = Association.from_response(response)
        self.assertTrue(result == [])

    def test_06_copy_rpm(self):
        response = self.dest_repo2.copy(self.pulp,
                                        self.source_repo.id,
                                        data={
                                            'criteria': {
                                                'type_ids': ['rpm']
                                            },
                                        })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_07_copy_category(self):
        response = self.dest_repo2.copy(self.pulp,
                                        self.source_repo.id,
                                        data={
                                            'criteria': {
                                                'type_ids':
                                                ['package_category']
                                            },
                                        })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_08_copy_group(self):
        response = self.dest_repo2.copy(self.pulp,
                                        self.source_repo.id,
                                        data={
                                            'criteria': {
                                                'type_ids': ['package_group']
                                            },
                                        })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_09_copy_distribution(self):
        response = self.dest_repo2.copy(self.pulp,
                                        self.source_repo.id,
                                        data={
                                            'criteria': {
                                                'type_ids': ['distribution']
                                            },
                                        })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_10_copy_erratum(self):
        response = self.dest_repo2.copy(self.pulp,
                                        self.source_repo.id,
                                        data={
                                            'criteria': {
                                                'type_ids': ['erratum']
                                            },
                                        })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    def test_11_copy_srpm(self):
        response = self.dest_repo2.copy(self.pulp,
                                        self.source_repo.id,
                                        data={
                                            'criteria': {
                                                'type_ids': ['srpm']
                                            },
                                        })
        self.assertPulp(code=202)
        Task.wait_for_report(self.pulp, response)

    @classmethod
    def tearDownClass(cls):
        with cls.pulp. async ():
            for repo_id in [
                    'SimpleRepoCopyTest_repo', 'SimpleRepoCopyTest_copy',
                    'SimpleRepoCopyTest_copy1'
            ]:
                Repo({'id': repo_id}).delete(cls.pulp)
        for response in list(cls.pulp.last_response):
            Task.wait_for_report(cls.pulp, response)
        #orphans also should be deleted in cleanup
        delete_response = Orphans.delete(cls.pulp)
        Task.wait_for_report(cls.pulp, delete_response)
 def test_08_delete_orphans(self):
     delete_response = Orphans.delete(self.pulp)
     self.assertPulpOK()
     Task.wait_for_report(self.pulp, delete_response)
 def test_00_get_orphan_info(self):
     Orphans.info(self.pulp)
     self.assertPulpOK()
 def test_07_delete_orphans(self):
     response = Orphans.delete(self.pulp)
     Task.wait_for_report(self.pulp, response)
Example #25
0
 def test_13_check_deleted_orphans(self):
     # check that all puppet_module orphans were successfully deleted
     orphans = Orphans.get(self.pulp)
     self.assertEqual(orphans['iso'], [])
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['iso']['count'], 0)
Example #26
0
 def test_08_check_no_orphan_appeared(self):
     #check that after unassociation of module it did not appered among orphans as it is still referenced to other repo
     orphans = Orphans.get(self.pulp)
     self.assertEqual(orphans['iso'], [])
     orphan_info = Orphans.info(self.pulp)
     self.assertEqual(orphan_info['iso']['count'], 0)
 def test_07_delete_orphans(self):
     response = Orphans.delete(self.pulp)
     task = Task.from_response(response)
     task.wait(self.pulp)
 def test_06_delete_orphan_by_type_and_id_1092467(self):
     # https://bugzilla.redhat.com/show_bug.cgi?id=1092467
     response = Orphans.delete_by_type_id(self.pulp, data=[{'content_type_id': 'rpm', 'unit_id': 'd0dc2044-1edc-4298-bf10-a472ea943fe1'}]
                                         )
     self.assertPulpOK()
     Task.wait_for_report(self.pulp, response)
 def test_00_view_all_orphaned_content(self):
     Orphans.info(self.pulp)
     self.assertPulpOK()
 def test_01_view_orphaned_content_by_type(self):
     rpm_orphans = RpmOrphan.list(self.pulp)
     self.assertPulpOK()
     all_orphans = Orphans.info(self.pulp)
     self.assertEqual(len(rpm_orphans), all_orphans['rpm']['count'])