Beispiel #1
0
def test_backend_cli(topology):
    # 
    args = FakeArgs()
    backend_list(topology.standalone, None, topology.logcap.log, None)
    # Assert none.
    assert(topology.logcap.contains("No objects to display"))
    topology.logcap.flush()
    # Add a backend
    # We need to fake the args
    args.extra = ['dc=example,dc=com', 'userRoot']
    backend_create(topology.standalone, None, topology.logcap.log, args)
    # Assert one.
    backend_list(topology.standalone, None, topology.logcap.log, None)
    # Assert none.
    assert(topology.logcap.contains("userRoot"))
    topology.logcap.flush()
    # Assert we can get by name, suffix, dn
    args.selector = 'userRoot'
    backend_get(topology.standalone, None, topology.logcap.log, args)
    # Assert none.
    assert(topology.logcap.contains("userRoot"))
    topology.logcap.flush()
    # Assert we can get by name, suffix, dn
    args.dn = 'cn=userRoot,cn=ldbm database,cn=plugins,cn=config'
    backend_get_dn(topology.standalone, None, topology.logcap.log, args)
    # Assert none.
    assert(topology.logcap.contains("userRoot"))
    topology.logcap.flush()
    # delete it
    backend_delete(topology.standalone, None, topology.logcap.log, args, warn=False)
    backend_list(topology.standalone, None, topology.logcap.log, None)
    # Assert none.
    assert(topology.logcap.contains("No objects to display"))
    topology.logcap.flush()
Beispiel #2
0
    def fin():
        sys.stdout = io.StringIO()
        args = FakeArgs()
        args.cn = BE_NAME
        args.be_name = BE_NAME
        args.suffix = SUFFIX
        args.skip_subsuffixes = False
        args.json = False

        # Delete backend
        backend_delete(topology_st.standalone, None, None, args, warn=False)
        check_output("successfully deleted")

        # Verify it's removed
        args.suffix = False
        backend_list(topology_st.standalone, None, None, args)
        check_output("backendroot", missing=True)
def test_backend_cli(topology):
    #
    args = FakeArgs()
    backend_list(topology.standalone, None, topology.logcap.log, None)
    # Assert none.
    assert (topology.logcap.contains("No objects to display"))
    topology.logcap.flush()
    # Add a backend
    # We need to fake the args
    args.cn = 'userRoot'
    args.nsslapd_suffix = 'dc=example,dc=com'
    backend_create(topology.standalone, None, topology.logcap.log, args)
    # Assert one.
    backend_list(topology.standalone, None, topology.logcap.log, None)
    # Assert none.
    assert (topology.logcap.contains("userRoot"))
    topology.logcap.flush()
    # Assert we can get by name, suffix, dn
    args.selector = 'userRoot'
    backend_get(topology.standalone, None, topology.logcap.log, args)
    # Assert none.
    assert (topology.logcap.contains("userRoot"))
    topology.logcap.flush()
    # Assert we can get by name, suffix, dn
    args.dn = 'cn=userRoot,cn=ldbm database,cn=plugins,cn=config'
    backend_get_dn(topology.standalone, None, topology.logcap.log, args)
    # Assert none.
    assert (topology.logcap.contains("userRoot"))
    topology.logcap.flush()
    # delete it
    backend_delete(topology.standalone,
                   None,
                   topology.logcap.log,
                   args,
                   warn=False)
    backend_list(topology.standalone, None, topology.logcap.log, None)
    # Assert none.
    assert (topology.logcap.contains("No objects to display"))
    topology.logcap.flush()
Beispiel #4
0
def test_backend_cli(topology_st, create_backend):
    """Test creating, listing, getting, and deleting a backend (and subsuffix)
    :id: 800f432a-52ab-4661-ac66-a2bdd9b984d7
    :setup: Standalone instance
    :steps:
        1. List backends
        2. Get backend by suffix
        3. Get backend by DN
        4. Add subsuffix
        5. Verify subsuffix
        6. Modify subsuffix
        7. Delete subsuffix
        8. Verify subsuffix is removed
        9. Modify backend
        10. Verify modify worked
        11. Test monitor works
    :expectedresults:
        1. Success
        2. Success
        3. Success
        4. Success
        5. Success
        6. Success
        7. Success
        8. Success
        9. Success
        10. Success
        11. Success
    """
    topology_st.logcap = LogCapture()
    sys.stdout = io.StringIO()

    args = FakeArgs()
    args.cn = BE_NAME
    args.be_name = BE_NAME
    args.suffix = False
    args.nsslapd_suffix = SUFFIX
    args.skip_subsuffixes = False
    args.json = False
    args.parent_suffix = False
    args.create_entries = True

    # List backend
    backend_list(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output(SUFFIX)

    # Get backend by by name
    args.selector = BE_NAME
    backend_get(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output(BE_NAME)

    # Get backend by DN
    args.dn = 'cn=backendRoot,cn=ldbm database,cn=plugins,cn=config'
    backend_get_dn(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output(BE_NAME)

    # Add subsuffix
    args.parent_suffix = SUFFIX
    args.suffix = SUB_SUFFIX
    args.be_name = SUB_BE_NAME
    backend_create(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output("The database was successfully created")

    # Verify subsuffix
    args.suffix = False
    backend_list(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output(SUB_SUFFIX)

    # Modify subsuffix
    args.enable = False
    args.disable = False
    args.add_referral = False
    args.del_referral = False
    args.cache_size = False
    args.cache_memsize = False
    args.dncache_memsize = False
    args.enable_readonly = True  # Setting nsslapd-readonly to "on"
    args.disable_readonly = False
    backend_set(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output("successfully updated")

    # Verify modified worked
    args.selector = SUB_BE_NAME
    backend_get(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output("nsslapd-readonly: on")

    # Delete subsuffix
    args.suffix = SUB_SUFFIX
    backend_delete(topology_st.standalone,
                   None,
                   topology_st.logcap.log,
                   args,
                   warn=False)
    check_output("successfully deleted")

    # Verify it is deleted
    args.suffix = False
    backend_list(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output(SUB_BE_NAME, missing=True)

    # Modify backend (use same args from subsuffix modify)
    args.be_name = BE_NAME
    backend_set(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output("successfully updated")

    # Verify modified worked
    args.selector = BE_NAME
    backend_get(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output("nsslapd-readonly: on")

    # Run database monitor
    args.suffix = SUFFIX
    get_monitor(topology_st.standalone, None, topology_st.logcap.log, args)
    check_output("entrycachetries")