Пример #1
0
def test_13_delete_select_0():
    '''
    add a CDS and see if no issue occurs if it and "a zeroth" (ghost) CDSs are selected for deletion
    '''
    # for RHBZ#1305612
    # choose a random CDS and add it
    cds = random.choice(CDS_HOSTNAMES)
    RHUIManagerInstance.add_instance(RHUA, "cds", cds)
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_not_equal(cds_list, [])

    # try the deletion
    RHUIManager.screen(RHUA, "cds")
    Expect.enter(RHUA, "d")
    Expect.expect(RHUA, "Enter value")
    Expect.enter(RHUA, "0")
    Expect.expect(RHUA, "Enter value")
    Expect.enter(RHUA, "1")
    Expect.expect(RHUA, "Enter value")
    Expect.enter(RHUA, "c")
    state = Expect.expect_list(RHUA,
                               [(re.compile(".*Are you sure.*", re.DOTALL), 1),
                                (re.compile(".*An unexpected error.*", re.DOTALL), 2)])
    if state == 1:
        Expect.enter(RHUA, "y")
        RHUIManager.quit(RHUA, timeout=180)
    else:
        Expect.enter(RHUA, "q")

    # the CDS list ought to be empty now; if not, delete the CDS and fail
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    if cds_list:
        RHUIManagerInstance.delete_all(RHUA, "cds")
        raise AssertionError("The CDS list is not empty after the deletion attempt: %s." % cds_list)
Пример #2
0
def test_11_add_cds_uppercase():
    '''
        add (and delete) a CDS with uppercase characters
    '''
    # for RHBZ#1572623
    # choose a random CDS hostname from the list
    cds_up = random.choice(CDS_HOSTNAMES).replace("cds", "CDS")
    RHUIManagerInstance.add_instance(RHUA, "cds", cds_up)
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_equal(len(cds_list), 1)
    RHUIManagerInstance.delete(RHUA, "cds", [cds_up])
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_equal(len(cds_list), 0)
Пример #3
0
def test_14_verbose_reporting():
    '''
    check if a failure is reported properly (if puppet is 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 check for the specific error message in the output
    error_msg = "change from stopped to running failed"
    RHUIManager.screen(RHUA, "cds")
    Expect.enter(RHUA, "a")
    Expect.expect(RHUA, "Hostname")
    Expect.enter(RHUA, cds.hostname)
    Expect.expect(RHUA, "Username")
    Expect.enter(RHUA, SUDO_USER_NAME)
    Expect.expect(RHUA, "Absolute")
    Expect.enter(RHUA, SUDO_USER_KEY)
    Expect.expect(RHUA, "Proceed")
    Expect.enter(RHUA, "y")
    state = Expect.expect_list(RHUA,
                               [(re.compile(".*%s.*" % error_msg, re.DOTALL), 1),
                                (re.compile(".*Aborting.*", re.DOTALL), 2),
                                (re.compile(".*was successfully configured.*", re.DOTALL), 3)],
                               timeout=180)
    # quit rhui-manager, clean up, fail if the error message didn't appear
    Expect.enter(RHUA, "q")
    Expect.enter(cds, CTRL_C)
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    if cds_list:
        RHUIManagerInstance.delete_all(RHUA, "cds")
    if state != 1:
        raise AssertionError("The expected error message was not seen in rhui-manager's output.")
 def test_03_add_hap():
     '''
        add an HAProxy Load-balancer
     '''
     hap_list = RHUIManagerInstance.list(RHUA, "loadbalancers")
     nose.tools.assert_equal(hap_list, [])
     RHUIManagerInstance.add_instance(RHUA, "loadbalancers")
 def test_02_add_cds():
     '''
        add a CDS
     '''
     cds_list = RHUIManagerInstance.list(RHUA, "cds")
     nose.tools.assert_equal(cds_list, [])
     RHUIManagerInstance.add_instance(RHUA, "cds")
 def test_04_add_hap():
     '''
         add an HAProxy Load-balancer
     '''
     if not getenv("RHUISKIPSETUP"):
         hap_list = RHUIManagerInstance.list(RHUA, "loadbalancers")
         nose.tools.assert_equal(hap_list, [])
         RHUIManagerInstance.add_instance(RHUA, "loadbalancers")
 def test_03_add_cds():
     '''
         add a CDS
     '''
     if not getenv("RHUISKIPSETUP"):
         cds_list = RHUIManagerInstance.list(RHUA, "cds")
         nose.tools.assert_equal(cds_list, [])
         RHUIManagerInstance.add_instance(RHUA, "cds")
Пример #8
0
def test_12_delete_unreachable():
    '''
    add a CDS, make it unreachable, and see if it can still be deleted from the RHUA
    '''
    # for RHBZ#1639996
    # choose a random CDS hostname from the list
    cds = random.choice(CDS_HOSTNAMES)
    RHUIManagerInstance.add_instance(RHUA, "cds", cds)
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_not_equal(cds_list, [])

    Helpers.break_hostname(RHUA, cds)

    # delete it
    RHUIManagerInstance.delete(RHUA, "cds", [cds])
    # check it
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_equal(cds_list, [])

    Helpers.unbreak_hostname(RHUA)

    # the node remains configured (RHUI mount point, httpd)... unconfigure it properly
    RHUIManagerInstance.add_instance(RHUA, "cds", cds)
    RHUIManagerInstance.delete(RHUA, "cds", [cds])
Пример #9
0
def test_09_list_cds():
    '''
        list CDSs, expect none
    '''
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_equal(cds_list, [])
Пример #10
0
def test_06_list_cds():
    '''
        check if the CDSs are still tracked
    '''
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_equal(len(cds_list), len(CDS_HOSTNAMES))
Пример #11
0
def test_04_list_cds():
    '''
        list CDSs, expect as many as there are in /etc/hosts
    '''
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_equal(len(cds_list), len(CDS_HOSTNAMES))
Пример #12
0
def test_02_list_empty_cds():
    '''
        check if there are no CDSs
    '''
    cds_list = RHUIManagerInstance.list(RHUA, "cds")
    nose.tools.assert_equal(cds_list, [])