def test_healthcheck_RI_plugin_is_misconfigured(topology_st):
    """Check if HealthCheck returns DSRILE0001 code

    :id: de2e90a2-89fe-472c-acdb-e13cbca5178d
    :setup: Standalone instance
    :steps:
        1. Create DS instance
        2. Configure the instance with Integrity Plugin
        3. Set the referint-update-delay attribute of the RI plugin, to a value upper than 0
        4. Use HealthCheck without --json option
        5. Use HealthCheck with --json option
        6. Set the referint-update-delay attribute to 0
        7. Use HealthCheck without --json option
        8. Use HealthCheck with --json option
    :expectedresults:
        1. Success
        2. Success
        3. Success
        4. Healthcheck reports DSRILE0001 code and related details
        5. Healthcheck reports DSRILE0001 code and related details
        6. Success
        7. Healthcheck reports no issue found
        8. Healthcheck reports no issue found
    """

    RET_CODE = 'DSRILE0001'

    standalone = topology_st.standalone

    plugin = ReferentialIntegrityPlugin(standalone)
    plugin.disable()
    plugin.enable()

    log.info('Set the referint-update-delay attribute to a value upper than 0')
    plugin.replace('referint-update-delay', '5')

    run_healthcheck_and_flush_log(topology_st,
                                  standalone,
                                  json=False,
                                  searched_code=RET_CODE)
    run_healthcheck_and_flush_log(topology_st,
                                  standalone,
                                  json=True,
                                  searched_code=RET_CODE)

    log.info('Set the referint-update-delay attribute back to 0')
    plugin.replace('referint-update-delay', '0')

    run_healthcheck_and_flush_log(topology_st,
                                  standalone,
                                  json=False,
                                  searched_code=CMD_OUTPUT)
    run_healthcheck_and_flush_log(topology_st,
                                  standalone,
                                  json=True,
                                  searched_code=JSON_OUTPUT)
Beispiel #2
0
def referint_add_config(inst, basedn, log, args):
    log = log.getChild('referint_add_config')
    targetdn = args.DN
    config = generic_object_add(ReferentialIntegrityConfig,
                                inst,
                                log,
                                args,
                                arg_to_attr,
                                dn=targetdn)
    plugin = ReferentialIntegrityPlugin(inst)
    plugin.replace('nsslapd-pluginConfigArea', config.dn)
    log.info(
        'ReferentialIntegrity attribute nsslapd-pluginConfigArea (config-entry) '
        'was set in the main plugin config')
Beispiel #3
0
def configureRI(inst):
    plugin = ReferentialIntegrityPlugin(inst)
    plugin.enable()
    plugin.replace('referint-membership-attr', 'uniquemember')
Beispiel #4
0
def test_referential_false_failure(topo):
    """On MODRDN referential integrity can erroneously fail

    :id: f77aeb80-c4c4-471b-8c1b-4733b714778b
    :setup: Standalone Instance
    :steps:
        1. Configure the plugin
        2. Create a group
            - 1rst member the one that will be move
            - more than 128 members
            - last member is a DN containing escaped char
        3. Rename the 1rst member
    :expectedresults:
        1. should succeed
        2. should succeed
        3. should succeed
    """

    inst = topo[0]

    # stop the plugin, and start it
    plugin = ReferentialIntegrityPlugin(inst)
    plugin.disable()
    plugin.enable()

    ############################################################################
    # Configure plugin
    ############################################################################
    GROUP_CONTAINER = "ou=groups,%s" % DEFAULT_SUFFIX
    plugin.replace('referint-membership-attr', 'member')
    plugin.replace('nsslapd-plugincontainerscope', GROUP_CONTAINER)

    ############################################################################
    # Creates a group with members having escaped DN
    ############################################################################
    # Add some users and a group
    users = UserAccounts(inst, DEFAULT_SUFFIX, None)
    user1 = users.create_test_user(uid=1001)
    user2 = users.create_test_user(uid=1002)

    groups = Groups(inst, GROUP_CONTAINER, None)
    group = groups.create(properties={'cn': 'group'})
    group.add('member', user2.dn)
    group.add('member', user1.dn)

    # Add more than 128 members so that referint follows the buggy path
    for i in range(130):
        escaped_user = add_escaped_user(inst, i)
        group.add('member', escaped_user)

    ############################################################################
    # Check that the MODRDN succeeds
    ###########################################################################
    # Here we need to restart so that member values are taken in the right order
    # the last value is the escaped one
    inst.restart()

    # Here if the bug is fixed, referential is able to update the member value
    user1.rename('uid=new_test_user_1001',
                 newsuperior=DEFAULT_SUFFIX,
                 deloldrdn=False)