def test_15_gzip(): """try using a compressed comps XML file, should be handled well""" # first force the RHUA to cache RHEL Optional repodata, which contains extra groups Expect.expect_retval(RHUA, "yum --enablerepo=%s repolist enabled" % ZIP_REPO, timeout=20) # get all groups from the cached file original_comps_xml = "/var/cache/yum/x86_64/7Server/%s/*comps.xml" % ZIP_REPO original_groups = Yummy.comps_xml_grouplist(RHUA, original_comps_xml, False) # prepare a temporary file and compress the original comps into it compressed_comps_xml = Util.mktemp_remote(RHUA, ".xml.gz") Expect.expect_retval( RHUA, "gzip -c %s > %s" % (original_comps_xml, compressed_comps_xml)) # create another test repo and add the compressed comps to it RHUIManagerCLI.repo_create_custom(RHUA, ZIP_REPO) RHUIManagerCLI.repo_add_comps(RHUA, ZIP_REPO, compressed_comps_xml) # get all groups from the imported metadata processed_comps_xml = Yummy.repodata_location(RHUA, ZIP_REPO, "group") processed_groups = Yummy.comps_xml_grouplist(RHUA, processed_comps_xml, False) # compare the groups nose.tools.eq_(original_groups, processed_groups) Expect.expect_retval(RHUA, "rm -f %s" % compressed_comps_xml)
def test_09_check_groups(self): """compare client's available groups with the 2nd original comps file, check a test group""" groups_on_client = Yummy.yum_grouplist(CLI) original_comps_xml = "/tmp/extra_rhui_files/%s/comps.xml" % self.test_repos[ 1] groups_in_xml = Yummy.comps_xml_grouplist(RHUA, original_comps_xml) nose.tools.eq_(groups_on_client, groups_in_xml) nose.tools.ok_(self.test_groups[1] in groups_on_client)
def test_11_check_langpacks(self): """check available langpacks in the processed comps files""" for repo, langpack in zip(self.test_repos, self.test_langpacks): langpacks = Yummy.comps_xml_langpacks( RHUA, Yummy.repodata_location(RHUA, repo, "group")) if not langpacks: nose.tools.ok_(not langpack, msg="a test langpack is defined, " + "but there are no langpacks for %s" % repo) else: nose.tools.ok_(tuple(langpack.split()) in langpacks, msg="%s not found in %s" % (langpack.split()[0], langpacks))
def test_14_empty_comps(): """import a comps file containing no group and expect no problem and no repodata refresh""" # use the cached comps file for RH-Common, which is known to be empty original_comps_xml = "/var/cache/yum/x86_64/7Server/%s/*comps.xml" % EMP_REPO # re-use the big repo for testing # get the current comps file name for that repo in RHUI processed_comps_xml_before = Yummy.repodata_location( RHUA, BIG_REPO, "group") # import the empty comps; should be accepted RHUIManagerCLI.repo_add_comps(RHUA, BIG_REPO, original_comps_xml) # re-get the comps file in RHUI name after the import processed_comps_xml_after = Yummy.repodata_location( RHUA, BIG_REPO, "group") # should be the same; comparing just the file names as the directory is definitely identical nose.tools.eq_(basename(processed_comps_xml_before), basename(processed_comps_xml_after))
def test_13_big_comps(): """import comps for the (big) RHEL 7Server repo and check if all its groups get processed""" # first force the RHUA to cache RHEL repodata # (using a recent 3.x AWS client RPM; remove this when such an RPM is common in RHEL 7 AMIs) Expect.expect_retval(RHUA, "yum -y update rh-amazon-rhui-client", timeout=60) Expect.expect_retval(RHUA, "yum repolist enabled", timeout=60) # get all groups from this repodata; using a wildcard as there's only one cached comps file original_comps_xml = "/var/cache/yum/x86_64/7Server/%s/*comps.xml" % BIG_REPO original_groups = Yummy.comps_xml_grouplist(RHUA, original_comps_xml, False) # create a custom repo for the 7Server repo, import the cached comps file RHUIManagerCLI.repo_create_custom(RHUA, BIG_REPO) RHUIManagerCLI.repo_add_comps(RHUA, BIG_REPO, original_comps_xml) # this can actually take a while to get fully processed, so better check for Pulp tasks RHUIManagerSync.wait_till_pulp_tasks_finish(RHUA) # get all groups from the imported metadata processed_comps_xml = Yummy.repodata_location(RHUA, BIG_REPO, "group") processed_groups = Yummy.comps_xml_grouplist(RHUA, processed_comps_xml, False) # compare the groups nose.tools.eq_(original_groups, processed_groups)
def test_12_additional_group(self): """import a comps file containing one more group and expect the group to be added""" # and nothing lost... # import the "updated" comps file repo = self.repo_with_mod_groups modified_comps_xml = "/tmp/extra_rhui_files/%s/mod-comps.xml" % repo RHUIManagerCLI.repo_add_comps(RHUA, repo, modified_comps_xml) # create a client configuration RPM, install it on the client RHUIManagerCLI.client_rpm(RHUA, [repo], [repo, "2.1"], "/tmp") Util.remove_rpm(CLI, [self.test_repos[1]]) Util.install_pkg_from_rhua(RHUA, CLI, "/tmp/%s-2.1/build/RPMS/noarch/%s-2.1-1.noarch.rpm" % \ (repo, repo)) # compare client's available groups with the *original* comps file, # expecting all the original groups plus the extra group groups_on_client = Yummy.yum_grouplist(CLI) original_comps_xml = "/tmp/extra_rhui_files/%s/comps.xml" % repo groups_in_xml = Yummy.comps_xml_grouplist(RHUA, original_comps_xml) # trick: put the extra group to the right place in the sorted list insort(groups_in_xml, self.test_group_mod) nose.tools.eq_(groups_on_client, groups_in_xml) nose.tools.ok_(self.test_group_mod in groups_on_client)
def test_10_check_test_package(self): """check if the client can see the 2nd test package as available in group information""" packages = Yummy.yum_group_packages(CLI, self.test_groups[1]) nose.tools.ok_(self.test_packages[1] in packages, msg="%s not found in %s" % (self.test_packages[1], packages))