示例#1
0
 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)
示例#2
0
 def test_16_wrong_input_files():
     """try using an invalid XML file and a file with an invalid extension"""
     # create a bad XML file and use a known non-XML file; reuse the big repo
     bad_xml = Util.mktemp_remote(RHUA, ".xml")
     not_xml = "/etc/motd"
     Expect.expect_retval(RHUA, "echo '<foo></bar>' > %s" % bad_xml)
     for comps_file in [bad_xml, not_xml]:
         nose.tools.assert_raises(ExpectFailed,
                                  RHUIManagerCLI.repo_add_comps, RHUA,
                                  BIG_REPO, comps_file)
     Expect.expect_retval(RHUA, "rm -f %s" % bad_xml)
def test_22_verbose_reporting():
    '''
    check if a failure is reported properly (if puppet is run with --verbose)
    '''
    # for RHBZ#1751378
    # choose a random CDS and open port 443 on it, which will later prevent Apache from starting
    cds = random.choice(CDS)
    Expect.enter(cds, "ncat -l 443 --keep-open")
    # try adding the CDS and capture the output
    error_msg = "change from stopped to running failed"
    out = Util.mktemp_remote(RHUA)
    cmd = "rhui cds add %s %s %s -u &> %s" % (cds.hostname, SUDO_USER_NAME,
                                              SUDO_USER_KEY, out)
    RHUA.recv_exit_status(cmd, timeout=120)
    # delete the CDS and free the port
    RHUICLI.delete(RHUA, "cds", [cds.hostname], force=True)
    Expect.enter(cds, CTRL_C)
    # check if the failure is in the output
    Expect.expect_retval(RHUA, "grep '%s' %s" % (error_msg, out))
    Expect.expect_retval(RHUA, "rm -f %s" % out)