#50527 Issue: 48055 - CI test-(Plugin configuration should throw proper error messages if not configured properly)
Closed 3 years ago by spichugi. Opened 4 years ago by aborah.
aborah/389-ds-base bz834056  into  master

@@ -0,0 +1,58 @@ 

+ # --- BEGIN COPYRIGHT BLOCK ---

+ # Copyright (C) 2019 Red Hat, Inc.

+ # All rights reserved.

+ #

+ # License: GPL (version 3 or any later version).

+ # See LICENSE for details.

+ # --- END COPYRIGHT BLOCK ---

+ 

+ import os

+ import pytest

+ 

+ from lib389.topologies import topology_st as topo

+ from lib389.plugins import AutoMembershipPlugin, AutoMembershipDefinitions, MemberOfPlugin

+ import ldap

+ 

+ pytestmark = pytest.mark.tier1

+ 

+ 

+ @pytest.mark.bz834056

+ def test_configuration(topo):

+     """

+     Automembership plugin and mixed in the plugin configuration

+     :id: 45a5a8f8-e800-11e8-ab16-8c16451d917b

+     :setup: Single Instance

+     :steps:

+         1. Automembership plugin fails in a MMR setup, if data and config

+         area mixed in the plugin configuration

+         2. Plugin configuration should throw proper error messages if not configured properly

+     :expected results:

+         1. Should success

+         2. Should success

+     """

+     # Configure pluginConfigArea for PLUGIN_AUTO

+     AutoMembershipPlugin(topo.standalone).set("nsslapd-pluginConfigArea", 'cn=config')

+     # Enable MemberOf plugin

+     MemberOfPlugin(topo.standalone).enable()

+     topo.standalone.restart()

+     # Add invalid configuration, which mixes data and config area: All will fail

+     automembers = AutoMembershipDefinitions(topo.standalone)

+     with pytest.raises(ldap.UNWILLING_TO_PERFORM):

+         automembers.create(properties={

+             'cn': 'autouserGroups',

+             'autoMemberScope': f'ou=Employees,cn=config',

+             'autoMemberFilter': "objectclass=posixAccount",

+             'autoMemberDefaultGroup': [f'cn=SuffDef1,ou=autouserGroups,cn=config',

+                                        f'cn=SuffDef2,ou=autouserGroups,cn=config'],

+             'autoMemberGroupingAttr': 'member:dn'

+         })

+     # Search in error logs

+     assert topo.standalone.ds_error_log.match('.*ERR - auto-membership-plugin - '

+                                               'automember_parse_config_entry - The default group '

+                                               '"cn=SuffDef1,ou=autouserGroups,cn=config" '

+                                               'can not be a child of the plugin config area "cn=config"')

+ 

+ 

+ if __name__ == "__main__":

+     CURRENT_FILE = os.path.realpath(__file__)

+     pytest.main("-s -v %s" % CURRENT_FILE)

CI test-(Plugin configuration should throw proper error messages if not configured properly)

Relates: https://pagure.io/389-ds-base/issue/48055

Author: aborah

Reviewed by: ???

rebased onto 5e789a8ecdda824fefcabdf55d2d2945ad525d75

4 years ago

rebased onto 48a040dae891931d7e88daa4f1022c54108a5eeb

4 years ago

rebased onto 8b1ba638eb74827c825c0c4dac35424504682ffb

4 years ago

rebased onto b5c41a969542cf0990a5bb081df2a71bf6326556

4 years ago

it is also about mixing the suffixes for autoMemberDefaultGroup

What do you need replication for? Why not use 'standalone'?

Please, use lib389/dirsrv_log.
We will deprecate searchErrorsLog soon

Please, use lib389/dirsrv_log.
We will deprecate searchErrorsLog soon

(Pdb) dirlog1 = DirsrvLog(topo.standalone)
(Pdb) DirsrvErrorLog(dirlog1)
<lib389.dirsrv_log.DirsrvErrorLog object at 0x7f830081c3c8>
(Pdb) DirsrvErrorLog(dirlog1).parse_line('ERR - auto-membership-plugin')
*** AttributeError: 'NoneType' object has no attribute 'groupdict'

Looks like lib389/dirsrv_log. does not work properly

(Pdb) dirlog1 = DirsrvLog(topo.standalone)
(Pdb) DirsrvErrorLog(dirlog1)
<lib389.dirsrv_log.dirsrverrorlog object="" at="" 0x7f830081c3c8="">

I am not sure what you are doing here...

Try to search for the examples in our code (basically lib389/dirsrv_log is used only for creating an alias in DirSrv() object)

And you can use these aliases to perform tasks (once again, you can find a lot of examples through the code).

1 new commit added

  • finxing simon's comments
4 years ago

@spichugi changes are done as your suggestion

The test module name still has the bz number in it dirsrvtests/tests/suites/automember_plugin/bz834056_test.py ...

test_mmr_setup_mixed_the_plugin_configuration can be misinterpreted...
Like mmr_setup mixed the_plugin_configuration...

rebased onto 5a35ff13baae89d6221d26279bb2e304a8cc46d5

4 years ago

The test module name still has the bz number in it dirsrvtests/tests/suites/automember_plugin/bz834056_test.py ...
test_mmr_setup_mixed_the_plugin_configuration can be misinterpreted...
Like mmr_setup mixed the_plugin_configuration...

renamed test case and module name.

automembership_plugin is already in the test dir name.
So I think it can be removed from the module name and from the test case name.

rebased onto ca7b405aa9af7011ac089e4bd8c410c3c1b7a21e

4 years ago

rebased onto 46639d5190ee93f7457e4dc3afdaaf80a170c0c8

4 years ago

automembership_plugin is already in the test dir name.
So I think it can be removed from the module name and from the test case name.

renamed both (module and test case )

rebased onto 723b88a

4 years ago

Pull-Request has been merged by vashirov

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3583

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata