def test_abort(automember_fixture, topo):
    """Test the abort rebuild task

    :id: 24763279-48ec-4c34-91b3-f681679dec3a
    :setup: Standalone Instance
    :steps:
        1. Setup automember and create a bunch of users
        2. Start rebuild task
        3. Abort rebuild task
        4. Verify rebuild task was aborted
    :expectedresults:
        1. Success
        2. Success
        3. Success
        4. Success
    """

    automemberplugin = AutoMembershipPlugin(topo.standalone)

    # Run rebuild task
    task = automemberplugin.fixup(DEFAULT_SUFFIX, "objectclass=top")
    time.sleep(1)

    # Abort rebuild task
    automemberplugin.abort_fixup()

    # Wait for rebuild task to finish
    task.wait()

    # Check errors log for abort message
    assert topo.standalone.searchErrorsLog("task was intentionally aborted")
Example #2
0
def abort(inst, basedn, log, args):
    plugin = AutoMembershipPlugin(inst)
    log.info(
        'Attempting to add abort task entry... This will fail if Automembership plug-in is not enabled.'
    )
    if not plugin.status():
        log.error(
            "'%s' is disabled. Abort rebuild membership task can't be executed"
            % plugin.rdn)
    fixup_task = plugin.abort_fixup(args.DN, args.filter)
    fixup_task.wait()
    exitcode = fixup_task.get_exit_code()
    if exitcode != 0:
        log.error(
            'Abort rebuild membership task for %s has failed. Please, check logs'
        )
    else:
        log.info('Successfully added abort task entry')