Exemple #1
0
 def test_form_lookup_table(self):
     """
     Test that form_lookup_table creates a table with the latest rpm in the profile as a value
     corresponding to the rpm name and arch.
     """
     test_profile = self.get_test_profile_with_duplicate_packages()
     consumer_lookup = YumProfiler._form_lookup_table(test_profile[TYPE_ID_RPM])
     self.assertEqual(len(consumer_lookup), 2)
     self.assertEqual(consumer_lookup['patb x86_64'],
                      self.create_profile_entry("patb", 0, "0.0.2", "1", "x86_64", "Test Vendor"))
Exemple #2
0
 def test_form_lookup_table(self):
     """
     Test that form_lookup_table creates a table with the latest rpm in the profile as a value
     corresponding to the rpm name and arch.
     """
     test_profile = self.get_test_profile_with_duplicate_packages()
     consumer_lookup = YumProfiler._form_lookup_table(
         test_profile[TYPE_ID_RPM])
     self.assertEqual(len(consumer_lookup), 2)
     self.assertEqual(
         consumer_lookup['patb x86_64'],
         self.create_profile_entry("patb", 0, "0.0.2", "1", "x86_64",
                                   "Test Vendor"))
Exemple #3
0
 def test_rpm_applicable_with_profile_containing_duplicate_packages(self):
     """
     If a consumer profile contains multiple rpms with same name and arch (eg. in case of
     kernel rpms), make sure that the applicability calculations take into consideration
     the newest rpm installed.
     """
     consumer_profile = self.get_test_profile_with_duplicate_packages()
     test_consumer_lookup = YumProfiler._form_lookup_table(consumer_profile[TYPE_ID_RPM])
     rpm = self.create_profile_entry("patb", 0, "0.0.2", "1", "x86_64", "Test Vendor")
     yum_profiler = YumProfiler()
     applicable = yum_profiler._is_rpm_applicable(rpm, test_consumer_lookup)
     self.assertFalse(applicable)
     newer_rpm = self.create_profile_entry("patb", 0, "0.0.3", "1", "x86_64", "Test Vendor")
     applicable = yum_profiler._is_rpm_applicable(newer_rpm, test_consumer_lookup)
     self.assertTrue(applicable)
Exemple #4
0
 def test_rpm_applicable_with_profile_containing_duplicate_packages(self):
     """
     If a consumer profile contains multiple rpms with same name and arch (eg. in case of
     kernel rpms), make sure that the applicability calculations take into consideration
     the newest rpm installed.
     """
     consumer_profile = self.get_test_profile_with_duplicate_packages()
     test_consumer_lookup = YumProfiler._form_lookup_table(
         consumer_profile[TYPE_ID_RPM])
     rpm = self.create_profile_entry("patb", 0, "0.0.2", "1", "x86_64",
                                     "Test Vendor")
     yum_profiler = YumProfiler()
     applicable = yum_profiler._is_rpm_applicable(rpm, test_consumer_lookup)
     self.assertFalse(applicable)
     newer_rpm = self.create_profile_entry("patb", 0, "0.0.3", "1",
                                           "x86_64", "Test Vendor")
     applicable = yum_profiler._is_rpm_applicable(newer_rpm,
                                                  test_consumer_lookup)
     self.assertTrue(applicable)
Exemple #5
0
 def setUp(self):
     super(TestYumProfilerRPM, self).setUp()
     self.data_dir = DATA_DIR
     self.temp_dir = tempfile.mkdtemp()
     self.working_dir = os.path.join(self.temp_dir, "working")
     if not os.path.exists(self.working_dir):
         os.makedirs(self.working_dir)
     self.consumer_id = "test_errata_profiler_consumer_id"
     self.profiles = self.get_test_profile()
     self.test_consumer = Consumer(self.consumer_id, self.profiles)
     self.test_consumer_lookup = YumProfiler._form_lookup_table(self.profiles[TYPE_ID_RPM])
     # i386 version of consumer to test arch issues
     self.consumer_id_i386 = "%s.i386" % (self.consumer_id)
     self.profiles_i386 = self.get_test_profile(arch="i386")
     self.test_consumer_i386 = Consumer(self.consumer_id_i386, self.profiles_i386)
     # consumer has been updated, and has the updated rpms installed
     self.consumer_id_been_updated = "%s.been_updated" % (self.consumer_id)
     self.profiles_been_updated = self.get_test_profile_been_updated()
     self.test_consumer_been_updated = Consumer(self.consumer_id_been_updated, self.profiles_been_updated)
Exemple #6
0
 def setUp(self):
     super(TestYumProfilerRPM, self).setUp()
     self.data_dir = DATA_DIR
     self.temp_dir = tempfile.mkdtemp()
     self.working_dir = os.path.join(self.temp_dir, "working")
     if not os.path.exists(self.working_dir):
         os.makedirs(self.working_dir)
     self.consumer_id = "test_errata_profiler_consumer_id"
     self.profiles = self.get_test_profile()
     self.test_consumer = Consumer(self.consumer_id, self.profiles)
     self.test_consumer_lookup = YumProfiler._form_lookup_table(
         self.profiles[TYPE_ID_RPM])
     # i386 version of consumer to test arch issues
     self.consumer_id_i386 = "%s.i386" % (self.consumer_id)
     self.profiles_i386 = self.get_test_profile(arch="i386")
     self.test_consumer_i386 = Consumer(self.consumer_id_i386,
                                        self.profiles_i386)
     # consumer has been updated, and has the updated rpms installed
     self.consumer_id_been_updated = "%s.been_updated" % (self.consumer_id)
     self.profiles_been_updated = self.get_test_profile_been_updated()
     self.test_consumer_been_updated = Consumer(
         self.consumer_id_been_updated, self.profiles_been_updated)