dirsrvtests/create_test.py | 890
++++------
dirsrvtests/tests/suites/acct_usability_plugin/acct_usability_test.py | 84
dirsrvtests/tests/suites/acctpolicy_plugin/accpol_test.py | 136 -
dirsrvtests/tests/suites/acctpolicy_plugin/acctpolicy_test.py | 81
dirsrvtests/tests/suites/acl/acl_test.py | 863 ++++-----
dirsrvtests/tests/suites/attr_encryption/attr_encrypt_test.py | 84
dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py | 153 -
dirsrvtests/tests/suites/automember_plugin/automember_test.py | 84
dirsrvtests/tests/suites/basic/basic_test.py | 318 +--
dirsrvtests/tests/suites/betxns/betxn_test.py | 111 -
dirsrvtests/tests/suites/chaining_plugin/chaining_test.py | 81
dirsrvtests/tests/suites/clu/clu_test.py | 49
dirsrvtests/tests/suites/clu/db2ldif_test.py | 72
dirsrvtests/tests/suites/collation_plugin/collatation_test.py | 81
dirsrvtests/tests/suites/config/config_test.py | 246 --
dirsrvtests/tests/suites/cos_plugin/cos_test.py | 81
dirsrvtests/tests/suites/deref_plugin/deref_test.py | 81
dirsrvtests/tests/suites/disk_monitoring/disk_monitor_test.py | 81
dirsrvtests/tests/suites/distrib_plugin/distrib_test.py | 81
dirsrvtests/tests/suites/dna_plugin/dna_test.py | 124 -
dirsrvtests/tests/suites/ds_logs/ds_logs_test.py | 81
dirsrvtests/tests/suites/dynamic-plugins/plugin_tests.py | 2
dirsrvtests/tests/suites/dynamic-plugins/stress_tests.py | 2
dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py | 191 --
dirsrvtests/tests/suites/filter/filter_test.py | 57
dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py | 123 -
dirsrvtests/tests/suites/get_effective_rights/ger_test.py | 81
dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py | 130 -
dirsrvtests/tests/suites/ldapi/ldapi_test.py | 81
dirsrvtests/tests/suites/linkedattrs_plugin/linked_attrs_test.py | 81
dirsrvtests/tests/suites/mapping_tree/mapping_tree_test.py | 81
dirsrvtests/tests/suites/memberof_plugin/memberof_test.py | 139 -
dirsrvtests/tests/suites/memory_leaks/range_search_test.py | 98 -
dirsrvtests/tests/suites/monitor/monitor_test.py | 81
dirsrvtests/tests/suites/paged_results/paged_results_test.py | 632 +++----
dirsrvtests/tests/suites/pam_passthru_plugin/pam_test.py | 81
dirsrvtests/tests/suites/passthru_plugin/passthru_test.py | 81
dirsrvtests/tests/suites/password/password_test.py | 70
dirsrvtests/tests/suites/password/pwdAdmin_test.py | 143 -
dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py | 217 +-
dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py | 199 --
dirsrvtests/tests/suites/password/pwdPolicy_syntax_test.py | 95 -
dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py | 234 +-
dirsrvtests/tests/suites/password/pwd_algo_test.py | 114 -
dirsrvtests/tests/suites/password/pwp_history_test.py | 141 -
dirsrvtests/tests/suites/posix_winsync_plugin/posix_winsync_test.py | 81
dirsrvtests/tests/suites/psearch/psearch_test.py | 81
dirsrvtests/tests/suites/referint_plugin/referint_test.py | 81
dirsrvtests/tests/suites/replication/cleanallruv_test.py | 684 ++-----
dirsrvtests/tests/suites/replication/wait_for_async_feature_test.py | 197 --
dirsrvtests/tests/suites/replsync_plugin/repl_sync_test.py | 81
dirsrvtests/tests/suites/resource_limits/res_limits_test.py | 81
dirsrvtests/tests/suites/retrocl_plugin/retrocl_test.py | 81
dirsrvtests/tests/suites/reverpwd_plugin/reverpwd_test.py | 81
dirsrvtests/tests/suites/roles_plugin/roles_test.py | 81
dirsrvtests/tests/suites/rootdn_plugin/rootdn_plugin_test.py | 188 --
dirsrvtests/tests/suites/sasl/sasl_test.py | 81
dirsrvtests/tests/suites/schema/test_schema.py | 42
dirsrvtests/tests/suites/schema_reload_plugin/schema_reload_test.py | 81
dirsrvtests/tests/suites/snmp/snmp_test.py | 81
dirsrvtests/tests/suites/ssl/ssl_test.py | 81
dirsrvtests/tests/suites/syntax_plugin/syntax_test.py | 81
dirsrvtests/tests/suites/usn_plugin/usn_test.py | 81
dirsrvtests/tests/suites/views_plugin/views_test.py | 81
dirsrvtests/tests/suites/vlv/vlv_test.py | 81
dirsrvtests/tests/suites/whoami_plugin/whoami_test.py | 81
dirsrvtests/tests/tickets/finalizer.py | 2
dirsrvtests/tests/tickets/ticket47313_test.py | 2
dirsrvtests/tests/tickets/ticket47384_test.py | 2
dirsrvtests/tests/tickets/ticket47431_test.py | 2
dirsrvtests/tests/tickets/ticket47462_test.py | 2
dirsrvtests/tests/tickets/ticket47490_test.py | 2
dirsrvtests/tests/tickets/ticket47553_test.py | 2
dirsrvtests/tests/tickets/ticket47560_test.py | 2
dirsrvtests/tests/tickets/ticket47573_test.py | 2
dirsrvtests/tests/tickets/ticket47619_test.py | 2
dirsrvtests/tests/tickets/ticket47640_test.py | 2
dirsrvtests/tests/tickets/ticket47653MMR_test.py | 2
dirsrvtests/tests/tickets/ticket47653_test.py | 2
dirsrvtests/tests/tickets/ticket47669_test.py | 2
dirsrvtests/tests/tickets/ticket47676_test.py | 2
dirsrvtests/tests/tickets/ticket47714_test.py | 2
dirsrvtests/tests/tickets/ticket47721_test.py | 2
dirsrvtests/tests/tickets/ticket47781_test.py | 2
dirsrvtests/tests/tickets/ticket47787_test.py | 2
dirsrvtests/tests/tickets/ticket47808_test.py | 2
dirsrvtests/tests/tickets/ticket47815_test.py | 2
dirsrvtests/tests/tickets/ticket47819_test.py | 2
dirsrvtests/tests/tickets/ticket47823_test.py | 2
dirsrvtests/tests/tickets/ticket47828_test.py | 2
dirsrvtests/tests/tickets/ticket47829_test.py | 2
dirsrvtests/tests/tickets/ticket47833_test.py | 2
dirsrvtests/tests/tickets/ticket47838_test.py | 2
dirsrvtests/tests/tickets/ticket47869MMR_test.py | 2
dirsrvtests/tests/tickets/ticket47871_test.py | 2
dirsrvtests/tests/tickets/ticket47900_test.py | 2
dirsrvtests/tests/tickets/ticket47910_test.py | 2
dirsrvtests/tests/tickets/ticket47920_test.py | 2
dirsrvtests/tests/tickets/ticket47921_test.py | 2
dirsrvtests/tests/tickets/ticket47927_test.py | 2
dirsrvtests/tests/tickets/ticket47937_test.py | 2
dirsrvtests/tests/tickets/ticket47950_test.py | 2
dirsrvtests/tests/tickets/ticket47953_test.py | 2
dirsrvtests/tests/tickets/ticket47963_test.py | 2
dirsrvtests/tests/tickets/ticket47966_test.py | 2
dirsrvtests/tests/tickets/ticket47970_test.py | 2
dirsrvtests/tests/tickets/ticket47973_test.py | 2
dirsrvtests/tests/tickets/ticket47980_test.py | 2
dirsrvtests/tests/tickets/ticket47981_test.py | 2
dirsrvtests/tests/tickets/ticket47988_test.py | 2
dirsrvtests/tests/tickets/ticket48005_test.py | 2
dirsrvtests/tests/tickets/ticket48026_test.py | 2
dirsrvtests/tests/tickets/ticket48109_test.py | 2
dirsrvtests/tests/tickets/ticket48170_test.py | 2
dirsrvtests/tests/tickets/ticket48226_test.py | 2
dirsrvtests/tests/tickets/ticket48228_test.py | 2
dirsrvtests/tests/tickets/ticket48252_test.py | 2
dirsrvtests/tests/tickets/ticket48265_test.py | 2
dirsrvtests/tests/tickets/ticket48294_test.py | 2
dirsrvtests/tests/tickets/ticket48295_test.py | 2
dirsrvtests/tests/tickets/ticket48366_test.py | 2
dirsrvtests/tests/tickets/ticket48759_test.py | 2
dirsrvtests/tests/tickets/ticket48891_test.py | 2
dirsrvtests/tests/tickets/ticket48906_test.py | 2
dirsrvtests/tests/tickets/ticket548_test.py | 2
125 files changed, 2575 insertions(+), 7047 deletions(-)
New commits:
commit 82030d144e4a691beb1b3ce159d5ce1dc8095695
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Fri Nov 18 10:17:27 2016 +0100
Ticket 49055 - Clean up test suites
Description: Add all topology fixture imports
for all suites and refactor them accordingly.
Fix PEP8 and some logic issues.
Set 2016 date in licenses.
Fix create_test.py according to the new changes plus PEP8.
For now we have:
- topology_st - with topology_st.standalone inst;
- topology_m2 and topology_m4 - with dicts
topology_mN.ms["masterX"]
topology_mN.ms["masterX_agmts"]["mX_mY"]
Using this setup we can easily run through masters
and agreements in loops.
https://fedorahosted.org/389/ticket/49055
Reviewed by: wibrown (Thanks!)
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index 3898279..0eb3b01 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -13,15 +13,16 @@ import optparse
"""This script generates a template test script that handles the
non-interesting parts of a test script:
-- topology,
-- test (to be completed by the user),
-- final,
-- and run-isolated function
+- topology fixture (only for tickets),
+ for suites we have predefined fixtures in lib389/topologies.py
+- test function (to be completed by the user),
+- run-isolated function
"""
def displayUsage():
"""Display the usage"""
+
print ('\nUsage:\ncreate_ticket.py -t|--ticket <ticket number> ' +
'-s|--suite <suite name> ' +
'[ i|--instances <number of standalone instances> ' +
@@ -33,6 +34,9 @@ def displayUsage():
'can add mulitple standalone instances(maximum 10). However, you' +
' can not mix "-i" with the replication options(-m, -h , -c).
' +
'There is a maximum of 10 masters, 10 hubs, and 10 consumers.')
+ print('If "-s|--suite" option was chosen, then no topology would be
added ' +
+ 'to the test script. You can find predefined fixtures in the
lib389/topologies.py ' +
+ 'and usem them or write new one if you have special case.')
exit(1)
@@ -41,6 +45,7 @@ def writeFinalizer():
def writeInstanceOp(action):
"""Write instance finializer action"""
+
if repl_deployment:
for idx in range(masters):
idx += 1
@@ -64,16 +69,15 @@ def writeFinalizer():
TEST.write(' standalone' + idx + '.' + action
+
'()\n')
- TEST.write(' def fin():\n')
- TEST.write(' """')
- TEST.write('If we are debugging just stop the instances, ' +
- 'otherwise remove them\n')
- TEST.write(' """\n')
+ TEST.write('\n def fin():\n')
+ TEST.write(' """If we are debugging just stop the
instances,\n' +
+ ' otherwise remove them\n')
+ TEST.write(' """\n\n')
TEST.write(' if DEBUGGING:\n')
writeInstanceOp('stop')
TEST.write(' else:\n')
writeInstanceOp('delete')
- TEST.write(' request.addfinalizer(fin)')
+ TEST.write('\n request.addfinalizer(fin)')
TEST.write('\n\n')
@@ -158,14 +162,11 @@ if len(sys.argv) > 0:
instances = int(args.inst)
filename = args.filename
- #
# Create/open the new test script file
- #
if not filename:
if ticket:
filename = 'ticket' + ticket + '_test.py'
else:
- # suite
filename = suite + '_test.py'
try:
@@ -174,9 +175,7 @@ if len(sys.argv) > 0:
print("Can\'t open file:", filename)
exit(1)
- #
# Write the imports
- #
TEST.write('import os\nimport sys\nimport time\nimport ldap\n' +
'import logging\nimport pytest\n')
TEST.write('from lib389 import DirSrv, Entry, tools, tasks\nfrom ' +
@@ -184,306 +183,238 @@ if len(sys.argv) > 0:
'import *\nfrom lib389.properties import *\n' +
'from lib389.tasks import *\nfrom lib389.utils import *\n\n')
- #
- # Set the logger and other settings
- #
- TEST.write('DEBUGGING = False\n\n')
- TEST.write('if DEBUGGING:\n')
- TEST.write(' logging.getLogger(__name__).setLevel(logging.DEBUG)\n')
- TEST.write('else:\n')
- TEST.write(' logging.getLogger(__name__).setLevel(logging.INFO)\n')
- TEST.write('log = logging.getLogger(__name__)\n\n\n')
-
- #
- # Write the replication or standalone classes
- #
- repl_deployment = False
- if masters + hubs + consumers > 0:
- #
- # Write the replication class
- #
- repl_deployment = True
-
- TEST.write('class TopologyReplication(object):\n')
- TEST.write(' """The Replication Topology
Class"""\n')
- TEST.write(' def __init__(self')
- for idx in range(masters):
- TEST.write(', master' + str(idx + 1))
- for idx in range(hubs):
- TEST.write(', hub' + str(idx + 1))
- for idx in range(consumers):
- TEST.write(', consumer' + str(idx + 1))
- TEST.write('):\n')
- TEST.write(' """Init"""\n')
-
- for idx in range(masters):
- TEST.write(' master' + str(idx + 1) + '.open()\n')
- TEST.write(' self.master' + str(idx + 1) + ' = master'
+
- str(idx + 1) + '\n')
- for idx in range(hubs):
- TEST.write(' hub' + str(idx + 1) + '.open()\n')
- TEST.write(' self.hub' + str(idx + 1) + ' = hub' +
- str(idx + 1) + '\n')
- for idx in range(consumers):
- TEST.write(' consumer' + str(idx + 1) + '.open()\n')
- TEST.write(' self.consumer' + str(idx + 1) + ' =
consumer' +
- str(idx + 1) + '\n')
- TEST.write('\n\n')
- else:
- #
- # Write the standalone class
- #
- TEST.write('class TopologyStandalone(object):\n')
- TEST.write(' """The DS Topology
Class"""\n')
- TEST.write(' def __init__(self')
- for idx in range(instances):
- idx += 1
- if idx == 1:
- idx = ''
- else:
- idx = str(idx)
- TEST.write(', standalone' + idx)
- TEST.write('):\n')
- TEST.write(' """Init"""\n')
- for idx in range(instances):
- idx += 1
- if idx == 1:
- idx = ''
- else:
- idx = str(idx)
- TEST.write(' standalone' + idx + '.open()\n')
- TEST.write(' self.standalone' + idx + ' = standalone'
+
- idx + '\n')
- TEST.write('\n\n')
-
- #
- # Write the 'topology function'
- #
- TEST.write('(a)pytest.fixture(scope="module")\n')
- TEST.write('def topology(request):\n')
-
- if repl_deployment:
- #
- # Create the replication instances
- #
- TEST.write(' """Create Replication
Deployment"""\n\n')
- for idx in range(masters):
- idx = str(idx + 1)
- TEST.write(' # Creating master ' + idx + '...\n')
- TEST.write(' if DEBUGGING:\n')
- TEST.write(' master' + idx + ' =
DirSrv(verbose=True)\n')
- TEST.write(' else:\n')
- TEST.write(' master' + idx + ' =
DirSrv(verbose=False)\n')
- TEST.write(' args_instance[SER_HOST] = HOST_MASTER_' + idx +
- '\n')
- TEST.write(' args_instance[SER_PORT] = PORT_MASTER_' + idx +
- '\n')
- TEST.write(' args_instance[SER_SERVERID_PROP] = ' +
- 'SERVERID_MASTER_' + idx + '\n')
- TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
- 'DEFAULT_SUFFIX\n')
- TEST.write(' args_master = args_instance.copy()\n')
- TEST.write(' master' + idx + '.allocate(args_master)\n')
- TEST.write(' instance_master' + idx + ' = master' + idx +
- '.exists()\n')
- TEST.write(' if instance_master' + idx + ':\n')
- TEST.write(' master' + idx + '.delete()\n')
- TEST.write(' master' + idx + '.create()\n')
- TEST.write(' master' + idx + '.open()\n')
- TEST.write(' master' + idx + '.replica.enableReplication'
+
- '(suffix=SUFFIX, role=REPLICAROLE_MASTER, ' +
- 'replicaId=REPLICAID_MASTER_' + idx + ')\n\n')
-
- for idx in range(hubs):
- idx = str(idx + 1)
- TEST.write(' # Creating hub ' + idx + '...\n')
- TEST.write(' if DEBUGGING:\n')
- TEST.write(' hub' + idx + ' =
DirSrv(verbose=True)\n')
- TEST.write(' else:\n')
- TEST.write(' hub' + idx + ' =
DirSrv(verbose=False)\n')
- TEST.write(' args_instance[SER_HOST] = HOST_HUB_' + idx +
'\n')
- TEST.write(' args_instance[SER_PORT] = PORT_HUB_' + idx +
'\n')
- TEST.write(' args_instance[SER_SERVERID_PROP] = SERVERID_HUB_' +
- idx + '\n')
- TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
- 'DEFAULT_SUFFIX\n')
- TEST.write(' args_hub = args_instance.copy()\n')
- TEST.write(' hub' + idx + '.allocate(args_hub)\n')
- TEST.write(' instance_hub' + idx + ' = hub' + idx +
- '.exists()\n')
- TEST.write(' if instance_hub' + idx + ':\n')
- TEST.write(' hub' + idx + '.delete()\n')
- TEST.write(' hub' + idx + '.create()\n')
- TEST.write(' hub' + idx + '.open()\n')
- TEST.write(' hub' + idx + '.replica.enableReplication' +
- '(suffix=SUFFIX, role=REPLICAROLE_HUB, ' +
- 'replicaId=REPLICAID_HUB_' + idx + ')\n\n')
-
- for idx in range(consumers):
- idx = str(idx + 1)
- TEST.write(' # Creating consumer ' + idx + '...\n')
- TEST.write(' if DEBUGGING:\n')
- TEST.write(' consumer' + idx + ' =
DirSrv(verbose=True)\n')
- TEST.write(' else:\n')
- TEST.write(' consumer' + idx + ' =
DirSrv(verbose=False)\n')
- TEST.write(' args_instance[SER_HOST] = HOST_CONSUMER_' + idx +
- '\n')
- TEST.write(' args_instance[SER_PORT] = PORT_CONSUMER_' + idx +
- '\n')
- TEST.write(' args_instance[SER_SERVERID_PROP] = ' +
- 'SERVERID_CONSUMER_' + idx + '\n')
- TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
- 'DEFAULT_SUFFIX\n')
- TEST.write(' args_consumer = args_instance.copy()\n')
- TEST.write(' consumer' + idx +
'.allocate(args_consumer)\n')
- TEST.write(' instance_consumer' + idx + ' = consumer' +
idx +
- '.exists()\n')
- TEST.write(' if instance_consumer' + idx + ':\n')
- TEST.write(' consumer' + idx + '.delete()\n')
- TEST.write(' consumer' + idx + '.create()\n')
- TEST.write(' consumer' + idx + '.open()\n')
- TEST.write(' consumer' + idx +
'.replica.enableReplication' +
- '(suffix=SUFFIX, role=REPLICAROLE_CONSUMER, ' +
- 'replicaId=CONSUMER_REPLICAID)\n\n')
-
- writeFinalizer()
-
- #
- # Create the master agreements
- #
- TEST.write(' #\n')
- TEST.write(' # Create all the agreements\n')
- TEST.write(' #\n')
- agmt_count = 0
- for idx in range(masters):
- master_idx = idx + 1
+ # Add topology function for a ticket only.
+ # Suites have presetuped fixtures in lib389/topologies.py
+ if ticket:
+ TEST.write('DEBUGGING = False\n\n')
+ TEST.write('if DEBUGGING:\n')
+ TEST.write(' logging.getLogger(__name__).setLevel(logging.DEBUG)\n')
+ TEST.write('else:\n')
+ TEST.write(' logging.getLogger(__name__).setLevel(logging.INFO)\n')
+ TEST.write('log = logging.getLogger(__name__)\n\n\n')
+
+ # Write the replication or standalone classes
+ repl_deployment = False
+
+ if masters + hubs + consumers > 0:
+ repl_deployment = True
+
+ TEST.write('class TopologyReplication(object):\n')
+ TEST.write(' def __init__(self')
for idx in range(masters):
- #
- # Create agreements with the other masters (master -> master)
- #
- idx += 1
- if master_idx == idx:
- # skip ourselves
- continue
- TEST.write(' # Creating agreement from master ' +
- str(master_idx) + ' to master ' + str(idx) +
'\n')
- TEST.write(" properties = {RA_NAME: " +
- "'meTo_' + master" + str(idx) +
- ".host + ':' + str(master" + str(idx) +
- ".port),\n")
- TEST.write(" RA_BINDDN: " +
- "defaultProperties[REPLICATION_BIND_DN],\n")
- TEST.write(" RA_BINDPW: " +
- "defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
- "defaultProperties[REPLICATION_BIND_METHOD],\n")
- TEST.write(" RA_TRANSPORT_PROT: " +
- "defaultProperties[REPLICATION_TRANSPORT]}\n")
- TEST.write(' m' + str(master_idx) + '_m' + str(idx) +
- '_agmt = master' + str(master_idx) +
- '.agreement.create(suffix=SUFFIX, host=master' +
- str(idx) + '.host, port=master' + str(idx) +
- '.port, properties=properties)\n')
- TEST.write(' if not m' + str(master_idx) + '_m' +
str(idx) +
- '_agmt:\n')
- TEST.write(' log.fatal("Fail to create a master ->
' +
- 'master replica agreement")\n')
- TEST.write(' sys.exit(1)\n')
- TEST.write(' log.debug("%s created" % m' +
str(master_idx) +
- '_m' + str(idx) + '_agmt)\n\n')
- agmt_count += 1
+ TEST.write(', master' + str(idx + 1))
+ for idx in range(hubs):
+ TEST.write(', hub' + str(idx + 1))
+ for idx in range(consumers):
+ TEST.write(', consumer' + str(idx + 1))
+ TEST.write('):\n')
+ for idx in range(masters):
+ TEST.write(' master' + str(idx + 1) +
'.open()\n')
+ TEST.write(' self.master' + str(idx + 1) + ' =
master' +
+ str(idx + 1) + '\n')
for idx in range(hubs):
- idx += 1
- #
- # Create agmts from each master to each hub (master -> hub)
- #
- TEST.write(' # Creating agreement from master ' +
- str(master_idx) + ' to hub ' + str(idx) +
'\n')
- TEST.write(" properties = {RA_NAME: " +
- "'meTo_' + hub" + str(idx) +
- ".host + ':' + str(hub" + str(idx) +
- ".port),\n")
- TEST.write(" RA_BINDDN: " +
- "defaultProperties[REPLICATION_BIND_DN],\n")
- TEST.write(" RA_BINDPW: " +
- "defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
- "defaultProperties[REPLICATION_BIND_METHOD],\n")
- TEST.write(" RA_TRANSPORT_PROT: " +
- "defaultProperties[REPLICATION_TRANSPORT]}\n")
- TEST.write(' m' + str(master_idx) + '_h' + str(idx) +
- '_agmt = master' + str(master_idx) +
- '.agreement.create(suffix=SUFFIX, host=hub' +
- str(idx) + '.host, port=hub' + str(idx) +
- '.port, properties=properties)\n')
- TEST.write(' if not m' + str(master_idx) + '_h' +
str(idx) +
- '_agmt:\n')
- TEST.write(' log.fatal("Fail to create a master ->
' +
- 'hub replica agreement")\n')
- TEST.write(' sys.exit(1)\n')
- TEST.write(' log.debug("%s created" % m' +
str(master_idx) +
- '_h' + str(idx) + '_agmt)\n\n')
- agmt_count += 1
-
- #
- # Create the hub agreements
- #
- for idx in range(hubs):
- hub_idx = idx + 1
- #
- # Add agreements from each hub to each consumer (hub -> consumer)
- #
+ TEST.write(' hub' + str(idx + 1) + '.open()\n')
+ TEST.write(' self.hub' + str(idx + 1) + ' = hub'
+
+ str(idx + 1) + '\n')
for idx in range(consumers):
+ TEST.write(' consumer' + str(idx + 1) +
'.open()\n')
+ TEST.write(' self.consumer' + str(idx + 1) + ' =
consumer' +
+ str(idx + 1) + '\n')
+ TEST.write('\n\n')
+ else:
+ TEST.write('class TopologyStandalone(object):\n')
+ TEST.write(' def __init__(self')
+ for idx in range(instances):
idx += 1
- #
- # Create agreements from each hub to each consumer
- #
- TEST.write(' # Creating agreement from hub ' + str(hub_idx)
- + ' to consumer ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "'meTo_' + consumer" + str(idx) +
- ".host + ':' + str(consumer" + str(idx) +
- ".port),\n")
- TEST.write(" RA_BINDDN: " +
- "defaultProperties[REPLICATION_BIND_DN],\n")
- TEST.write(" RA_BINDPW: " +
- "defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
- "defaultProperties[REPLICATION_BIND_METHOD],\n")
- TEST.write(" RA_TRANSPORT_PROT: " +
- "defaultProperties[REPLICATION_TRANSPORT]}\n")
- TEST.write(' h' + str(hub_idx) + '_c' + str(idx) +
- '_agmt = hub' + str(hub_idx) +
- '.agreement.create(suffix=SUFFIX, host=consumer' +
- str(idx) + '.host, port=consumer' + str(idx) +
- '.port, properties=properties)\n')
- TEST.write(' if not h' + str(hub_idx) + '_c' +
str(idx) +
- '_agmt:\n')
- TEST.write(' log.fatal("Fail to create a hub -> '
+
- 'consumer replica agreement")\n')
- TEST.write(' sys.exit(1)\n')
- TEST.write(' log.debug("%s created" % h' +
str(hub_idx) +
- '_c' + str(idx) + '_agmt)\n\n')
- agmt_count += 1
-
- if hubs == 0:
- #
- # No Hubs, see if there are any consumers to create agreements to
- #
+ if idx == 1:
+ idx = ''
+ else:
+ idx = str(idx)
+ TEST.write(', standalone' + idx)
+ TEST.write('):\n')
+
+ for idx in range(instances):
+ idx += 1
+ if idx == 1:
+ idx = ''
+ else:
+ idx = str(idx)
+ TEST.write(' standalone' + idx + '.open()\n')
+ TEST.write(' self.standalone' + idx + ' =
standalone' +
+ idx + '\n')
+ TEST.write('\n\n')
+
+ # Write the 'topology function'
+ TEST.write('(a)pytest.fixture(scope="module")\n')
+ TEST.write('def topology(request):\n')
+
+ if repl_deployment:
+ TEST.write(' """Create Replication
Deployment"""\n')
+ for idx in range(masters):
+ idx = str(idx + 1)
+ TEST.write('\n # Creating master ' + idx + '...\n')
+ TEST.write(' if DEBUGGING:\n')
+ TEST.write(' master' + idx + ' =
DirSrv(verbose=True)\n')
+ TEST.write(' else:\n')
+ TEST.write(' master' + idx + ' =
DirSrv(verbose=False)\n')
+ TEST.write(' args_instance[SER_HOST] = HOST_MASTER_' + idx +
+ '\n')
+ TEST.write(' args_instance[SER_PORT] = PORT_MASTER_' + idx +
+ '\n')
+ TEST.write(' args_instance[SER_SERVERID_PROP] = ' +
+ 'SERVERID_MASTER_' + idx + '\n')
+ TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
+ 'DEFAULT_SUFFIX\n')
+ TEST.write(' args_master = args_instance.copy()\n')
+ TEST.write(' master' + idx +
'.allocate(args_master)\n')
+ TEST.write(' instance_master' + idx + ' = master' +
idx +
+ '.exists()\n')
+ TEST.write(' if instance_master' + idx + ':\n')
+ TEST.write(' master' + idx + '.delete()\n')
+ TEST.write(' master' + idx + '.create()\n')
+ TEST.write(' master' + idx + '.open()\n')
+ TEST.write(' master' + idx +
'.replica.enableReplication' +
+ '(suffix=SUFFIX, role=REPLICAROLE_MASTER, ' +
+ 'replicaId=REPLICAID_MASTER_' + idx + ')\n')
+
+ for idx in range(hubs):
+ idx = str(idx + 1)
+ TEST.write('\n # Creating hub ' + idx + '...\n')
+ TEST.write(' if DEBUGGING:\n')
+ TEST.write(' hub' + idx + ' =
DirSrv(verbose=True)\n')
+ TEST.write(' else:\n')
+ TEST.write(' hub' + idx + ' =
DirSrv(verbose=False)\n')
+ TEST.write(' args_instance[SER_HOST] = HOST_HUB_' + idx +
'\n')
+ TEST.write(' args_instance[SER_PORT] = PORT_HUB_' + idx +
'\n')
+ TEST.write(' args_instance[SER_SERVERID_PROP] = SERVERID_HUB_'
+
+ idx + '\n')
+ TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
+ 'DEFAULT_SUFFIX\n')
+ TEST.write(' args_hub = args_instance.copy()\n')
+ TEST.write(' hub' + idx + '.allocate(args_hub)\n')
+ TEST.write(' instance_hub' + idx + ' = hub' + idx +
+ '.exists()\n')
+ TEST.write(' if instance_hub' + idx + ':\n')
+ TEST.write(' hub' + idx + '.delete()\n')
+ TEST.write(' hub' + idx + '.create()\n')
+ TEST.write(' hub' + idx + '.open()\n')
+ TEST.write(' hub' + idx + '.replica.enableReplication'
+
+ '(suffix=SUFFIX, role=REPLICAROLE_HUB, ' +
+ 'replicaId=REPLICAID_HUB_' + idx + ')\n')
+
+ for idx in range(consumers):
+ idx = str(idx + 1)
+ TEST.write('\n # Creating consumer ' + idx + '...\n')
+ TEST.write(' if DEBUGGING:\n')
+ TEST.write(' consumer' + idx + ' =
DirSrv(verbose=True)\n')
+ TEST.write(' else:\n')
+ TEST.write(' consumer' + idx + ' =
DirSrv(verbose=False)\n')
+ TEST.write(' args_instance[SER_HOST] = HOST_CONSUMER_' + idx
+
+ '\n')
+ TEST.write(' args_instance[SER_PORT] = PORT_CONSUMER_' + idx
+
+ '\n')
+ TEST.write(' args_instance[SER_SERVERID_PROP] = ' +
+ 'SERVERID_CONSUMER_' + idx + '\n')
+ TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
+ 'DEFAULT_SUFFIX\n')
+ TEST.write(' args_consumer = args_instance.copy()\n')
+ TEST.write(' consumer' + idx +
'.allocate(args_consumer)\n')
+ TEST.write(' instance_consumer' + idx + ' = consumer'
+ idx +
+ '.exists()\n')
+ TEST.write(' if instance_consumer' + idx + ':\n')
+ TEST.write(' consumer' + idx + '.delete()\n')
+ TEST.write(' consumer' + idx + '.create()\n')
+ TEST.write(' consumer' + idx + '.open()\n')
+ TEST.write(' consumer' + idx +
'.replica.enableReplication' +
+ '(suffix=SUFFIX, role=REPLICAROLE_CONSUMER, ' +
+ 'replicaId=CONSUMER_REPLICAID)\n')
+
+ writeFinalizer()
+
+ # Create the master agreements
+ TEST.write(' # Create all the agreements\n')
+ agmt_count = 0
+
for idx in range(masters):
master_idx = idx + 1
- #
- # Create agreements with the consumers (master -> consumer)
- #
+
+ # Create agreements with the other masters (master -> master)
+ for idx in range(masters):
+ idx += 1
+
+ # Skip ourselves
+ if master_idx == idx:
+ continue
+
+ TEST.write('\n # Creating agreement from master ' +
+ str(master_idx) + ' to master ' + str(idx) +
'\n')
+ TEST.write(" properties = {RA_NAME: " +
+ "'meTo_' + master" + str(idx) +
+ ".host + ':' + str(master" + str(idx) +
+ ".port),\n")
+ TEST.write(" RA_BINDDN: " +
+ "defaultProperties[REPLICATION_BIND_DN],\n")
+ TEST.write(" RA_BINDPW: " +
+ "defaultProperties[REPLICATION_BIND_PW],\n")
+ TEST.write(" RA_METHOD: " +
+
"defaultProperties[REPLICATION_BIND_METHOD],\n")
+ TEST.write(" RA_TRANSPORT_PROT: " +
+ "defaultProperties[REPLICATION_TRANSPORT]}\n")
+ TEST.write(' m' + str(master_idx) + '_m' +
str(idx) +
+ '_agmt = master' + str(master_idx) +
+ '.agreement.create(suffix=SUFFIX, host=master' +
+ str(idx) + '.host, port=master' + str(idx) +
+ '.port, properties=properties)\n')
+ TEST.write(' if not m' + str(master_idx) + '_m' +
str(idx) +
+ '_agmt:\n')
+ TEST.write(' log.fatal("Fail to create a master ->
' +
+ 'master replica agreement")\n')
+ TEST.write(' sys.exit(1)\n')
+ TEST.write(' log.debug("%s created" % m' +
str(master_idx) +
+ '_m' + str(idx) + '_agmt)\n')
+ agmt_count += 1
+
+ # Create agmts from each master to each hub (master -> hub)
+ for idx in range(hubs):
+ idx += 1
+ TEST.write('\n # Creating agreement from master ' +
+ str(master_idx) + ' to hub ' + str(idx) +
'\n')
+ TEST.write(" properties = {RA_NAME: " +
+ "'meTo_' + hub" + str(idx) +
+ ".host + ':' + str(hub" + str(idx) +
+ ".port),\n")
+ TEST.write(" RA_BINDDN: " +
+ "defaultProperties[REPLICATION_BIND_DN],\n")
+ TEST.write(" RA_BINDPW: " +
+ "defaultProperties[REPLICATION_BIND_PW],\n")
+ TEST.write(" RA_METHOD: " +
+
"defaultProperties[REPLICATION_BIND_METHOD],\n")
+ TEST.write(" RA_TRANSPORT_PROT: " +
+ "defaultProperties[REPLICATION_TRANSPORT]}\n")
+ TEST.write(' m' + str(master_idx) + '_h' +
str(idx) +
+ '_agmt = master' + str(master_idx) +
+ '.agreement.create(suffix=SUFFIX, host=hub' +
+ str(idx) + '.host, port=hub' + str(idx) +
+ '.port, properties=properties)\n')
+ TEST.write(' if not m' + str(master_idx) + '_h' +
str(idx) +
+ '_agmt:\n')
+ TEST.write(' log.fatal("Fail to create a master ->
' +
+ 'hub replica agreement")\n')
+ TEST.write(' sys.exit(1)\n')
+ TEST.write(' log.debug("%s created" % m' +
str(master_idx) +
+ '_h' + str(idx) + '_agmt)\n')
+ agmt_count += 1
+
+ # Create the hub agreements
+ for idx in range(hubs):
+ hub_idx = idx + 1
+
+ # Add agreements from each hub to each consumer (hub -> consumer)
for idx in range(consumers):
idx += 1
- #
- # Create agreements from each master to each consumer
- #
- TEST.write(' # Creating agreement from master ' +
- str(master_idx) + ' to consumer ' + str(idx) +
- '\n')
+ TEST.write('\n # Creating agreement from hub ' +
str(hub_idx)
+ + ' to consumer ' + str(idx) + '\n')
TEST.write(" properties = {RA_NAME: " +
"'meTo_' + consumer" + str(idx) +
".host + ':' + str(consumer" + str(idx)
+
@@ -496,172 +427,195 @@ if len(sys.argv) > 0:
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
- TEST.write(' m' + str(master_idx) + '_c' +
str(idx) +
- '_agmt = master' + str(master_idx) +
- '.agreement.create(suffix=SUFFIX, ' +
- 'host=consumer' + str(idx) +
- '.host, port=consumer' + str(idx) +
+ TEST.write(' h' + str(hub_idx) + '_c' + str(idx)
+
+ '_agmt = hub' + str(hub_idx) +
+ '.agreement.create(suffix=SUFFIX, host=consumer'
+
+ str(idx) + '.host, port=consumer' + str(idx) +
'.port, properties=properties)\n')
- TEST.write(' if not m' + str(master_idx) + '_c' +
- str(idx) + '_agmt:\n')
+ TEST.write(' if not h' + str(hub_idx) + '_c' +
str(idx) +
+ '_agmt:\n')
TEST.write(' log.fatal("Fail to create a hub ->
' +
'consumer replica agreement")\n')
TEST.write(' sys.exit(1)\n')
- TEST.write(' log.debug("%s created" % m' +
- str(master_idx) + '_c' + str(idx) +
- '_agmt)\n\n')
+ TEST.write(' log.debug("%s created" % h' +
str(hub_idx) +
+ '_c' + str(idx) + '_agmt)\n')
agmt_count += 1
- #
- # Add sleep that allows all the agreemnts to get situated
- #
- TEST.write(' # Allow the replicas to get situated with the new ' +
- 'agreements...\n')
- TEST.write(' time.sleep(5)\n\n')
-
- #
- # Write the replication initializations
- #
- TEST.write(' #\n')
- TEST.write(' # Initialize all the agreements\n')
- TEST.write(' #\n')
-
- # Masters
- for idx in range(masters):
- idx += 1
- if idx == 1:
- continue
- TEST.write(' master1.agreement.init(SUFFIX, HOST_MASTER_' +
- str(idx) + ', PORT_MASTER_' + str(idx) + ')\n')
- TEST.write(' master1.waitForReplInit(m1_m' + str(idx) +
- '_agmt)\n')
-
- # Hubs
- consumers_inited = False
- for idx in range(hubs):
- idx += 1
- TEST.write(' master1.agreement.init(SUFFIX, HOST_HUB_' +
- str(idx) + ', PORT_HUB_' + str(idx) + ')\n')
- TEST.write(' master1.waitForReplInit(m1_h' + str(idx) +
- '_agmt)\n')
- for idx in range(consumers):
- if consumers_inited:
- continue
+ # No Hubs, see if there are any consumers to create agreements to
+ if hubs == 0:
+
+ # Create agreements with the consumers (master -> consumer)
+ for idx in range(masters):
+ master_idx = idx + 1
+
+ for idx in range(consumers):
+ idx += 1
+ TEST.write('\n # Creating agreement from master ' +
+ str(master_idx) + ' to consumer ' + str(idx)
+
+ '\n')
+ TEST.write(" properties = {RA_NAME: " +
+ "'meTo_' + consumer" + str(idx) +
+ ".host + ':' + str(consumer" +
str(idx) +
+ ".port),\n")
+ TEST.write(" RA_BINDDN: " +
+
"defaultProperties[REPLICATION_BIND_DN],\n")
+ TEST.write(" RA_BINDPW: " +
+
"defaultProperties[REPLICATION_BIND_PW],\n")
+ TEST.write(" RA_METHOD: " +
+
"defaultProperties[REPLICATION_BIND_METHOD],\n")
+ TEST.write(" RA_TRANSPORT_PROT: " +
+
"defaultProperties[REPLICATION_TRANSPORT]}\n")
+ TEST.write(' m' + str(master_idx) + '_c' +
str(idx) +
+ '_agmt = master' + str(master_idx) +
+ '.agreement.create(suffix=SUFFIX, ' +
+ 'host=consumer' + str(idx) +
+ '.host, port=consumer' + str(idx) +
+ '.port, properties=properties)\n')
+ TEST.write(' if not m' + str(master_idx) +
'_c' +
+ str(idx) + '_agmt:\n')
+ TEST.write(' log.fatal("Fail to create a hub
-> ' +
+ 'consumer replica agreement")\n')
+ TEST.write(' sys.exit(1)\n')
+ TEST.write(' log.debug("%s created" % m' +
+ str(master_idx) + '_c' + str(idx) +
+ '_agmt)\n')
+ agmt_count += 1
+
+ # Add sleep that allows all the agreements to get situated
+ TEST.write('\n # Allow the replicas to get situated with the new '
+
+ 'agreements...\n')
+ TEST.write(' time.sleep(5)\n')
+
+ # Write the replication initializations
+ TEST.write('\n # Initialize all the agreements\n')
+
+ # Masters
+ for idx in range(masters):
idx += 1
- TEST.write(' hub1.agreement.init(SUFFIX, HOST_CONSUMER_' +
- str(idx) + ', PORT_CONSUMER_' + str(idx) +
')\n')
- TEST.write(' hub1.waitForReplInit(h1_c' + str(idx) +
+ if idx == 1:
+ continue
+ TEST.write(' master1.agreement.init(SUFFIX, HOST_MASTER_' +
+ str(idx) + ', PORT_MASTER_' + str(idx) +
')\n')
+ TEST.write(' master1.waitForReplInit(m1_m' + str(idx) +
'_agmt)\n')
- consumers_inited = True
- # Consumers (master -> consumer)
- if hubs == 0:
- for idx in range(consumers):
+ # Hubs
+ consumers_inited = False
+ for idx in range(hubs):
idx += 1
- TEST.write(' master1.agreement.init(SUFFIX, ' +
- 'HOST_CONSUMER_' + str(idx) + ',
PORT_CONSUMER_' +
- str(idx) + ')\n')
- TEST.write(' master1.waitForReplInit(m1_c' + str(idx) +
+ TEST.write(' master1.agreement.init(SUFFIX, HOST_HUB_' +
+ str(idx) + ', PORT_HUB_' + str(idx) + ')\n')
+ TEST.write(' master1.waitForReplInit(m1_h' + str(idx) +
'_agmt)\n')
+ for idx in range(consumers):
+ if consumers_inited:
+ continue
+ idx += 1
+ TEST.write(' hub1.agreement.init(SUFFIX, HOST_CONSUMER_'
+
+ str(idx) + ', PORT_CONSUMER_' + str(idx) +
')\n')
+ TEST.write(' hub1.waitForReplInit(h1_c' + str(idx) +
+ '_agmt)\n')
+ consumers_inited = True
+
+ # Consumers (master -> consumer)
+ if hubs == 0:
+ for idx in range(consumers):
+ idx += 1
+ TEST.write(' master1.agreement.init(SUFFIX, ' +
+ 'HOST_CONSUMER_' + str(idx) + ',
PORT_CONSUMER_' +
+ str(idx) + ')\n')
+ TEST.write(' master1.waitForReplInit(m1_c' + str(idx) +
+ '_agmt)\n')
- TEST.write('\n')
-
- #
- # Write replicaton check
- #
- if agmt_count > 0:
- # Find the lowest replica type (consumer -> master)
- if consumers > 0:
- replica = 'consumer1'
- elif hubs > 0:
- replica = 'hub1'
- else:
- replica = 'master2'
- TEST.write(' # Check replication is working...\n')
- TEST.write(' if master1.testReplication(DEFAULT_SUFFIX, ' +
- replica + '):\n')
- TEST.write(" log.info('Replication is
working.')\n")
- TEST.write(' else:\n')
- TEST.write(" log.fatal('Replication is not
working.')\n")
- TEST.write(' assert False\n')
TEST.write('\n')
- #
- # Write the finals steps for replication
- #
- TEST.write(' # Clear out the tmp dir\n')
- TEST.write(' master1.clearTmpDir(__file__)\n\n')
- TEST.write(' return TopologyReplication(master1')
- for idx in range(masters):
- idx += 1
- if idx == 1:
- continue
- TEST.write(', master' + str(idx))
- for idx in range(hubs):
- TEST.write(', hub' + str(idx + 1))
- for idx in range(consumers):
- TEST.write(', consumer' + str(idx + 1))
- TEST.write(')\n')
- else:
- #
+ # Write replicaton check
+ if agmt_count > 0:
+ # Find the lowest replica type (consumer -> master)
+ if consumers > 0:
+ replica = 'consumer1'
+ elif hubs > 0:
+ replica = 'hub1'
+ else:
+ replica = 'master2'
+ TEST.write(' # Check replication is working...\n')
+ TEST.write(' if master1.testReplication(DEFAULT_SUFFIX, ' +
+ replica + '):\n')
+ TEST.write(" log.info('Replication is
working.')\n")
+ TEST.write(' else:\n')
+ TEST.write(" log.fatal('Replication is not
working.')\n")
+ TEST.write(' assert False\n')
+ TEST.write('\n')
+
+ # Write the finals steps for replication
+ TEST.write(' # Clear out the tmp dir\n')
+ TEST.write(' master1.clearTmpDir(__file__)\n\n')
+ TEST.write(' return TopologyReplication(master1')
+
+ for idx in range(masters):
+ idx += 1
+ if idx == 1:
+ continue
+ TEST.write(', master' + str(idx))
+ for idx in range(hubs):
+ TEST.write(', hub' + str(idx + 1))
+ for idx in range(consumers):
+ TEST.write(', consumer' + str(idx + 1))
+ TEST.write(')\n\n')
+
# Standalone servers
- #
-
- # Args for the standalone instance
- TEST.write(' """Create DS
Deployment"""\n\n')
- for idx in range(instances):
- idx += 1
- if idx == 1:
- idx = ''
- else:
- idx = str(idx)
- TEST.write(' # Creating standalone instance ' + idx +
'...\n')
- TEST.write(' if DEBUGGING:\n')
- TEST.write(' standalone' + idx +
- ' = DirSrv(verbose=True)\n')
- TEST.write(' else:\n')
- TEST.write(' standalone' + idx +
- ' = DirSrv(verbose=False)\n')
- TEST.write(' args_instance[SER_HOST] = HOST_STANDALONE' +
- idx + '\n')
- TEST.write(' args_instance[SER_PORT] = PORT_STANDALONE' +
- idx + '\n')
- TEST.write(' args_instance[SER_SERVERID_PROP] = ' +
- 'SERVERID_STANDALONE' + idx + '\n')
- TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
- 'DEFAULT_SUFFIX\n')
- TEST.write(' args_standalone' + idx + ' =
args_instance.copy' +
- '()\n')
- TEST.write(' standalone' + idx +
'.allocate(args_standalone' +
- idx + ')\n')
-
- # Get the status of the instance and restart it if it exists
- TEST.write(' instance_standalone' + idx + ' = standalone'
+
- idx + '.exists()\n')
-
- # Remove the instance
- TEST.write(' if instance_standalone' + idx + ':\n')
- TEST.write(' standalone' + idx + '.delete()\n')
-
- # Create and open the instance
- TEST.write(' standalone' + idx + '.create()\n')
- TEST.write(' standalone' + idx + '.open()\n\n')
-
- writeFinalizer()
-
- TEST.write(' return TopologyStandalone(standalone')
- for idx in range(instances):
- idx += 1
- if idx == 1:
- continue
- TEST.write(', standalone' + str(idx))
- TEST.write(')\n')
+ else:
+ TEST.write(' """Create DS
Deployment"""\n')
+ for idx in range(instances):
+ idx += 1
+ if idx == 1:
+ idx = ''
+ else:
+ idx = str(idx)
+ TEST.write('\n # Creating standalone instance ' + idx +
'...\n')
+ TEST.write(' if DEBUGGING:\n')
+ TEST.write(' standalone' + idx +
+ ' = DirSrv(verbose=True)\n')
+ TEST.write(' else:\n')
+ TEST.write(' standalone' + idx +
+ ' = DirSrv(verbose=False)\n')
+ TEST.write(' args_instance[SER_HOST] = HOST_STANDALONE' +
+ idx + '\n')
+ TEST.write(' args_instance[SER_PORT] = PORT_STANDALONE' +
+ idx + '\n')
+ TEST.write(' args_instance[SER_SERVERID_PROP] = ' +
+ 'SERVERID_STANDALONE' + idx + '\n')
+ TEST.write(' args_instance[SER_CREATION_SUFFIX] = ' +
+ 'DEFAULT_SUFFIX\n')
+ TEST.write(' args_standalone' + idx + ' =
args_instance.copy' +
+ '()\n')
+ TEST.write(' standalone' + idx +
'.allocate(args_standalone' +
+ idx + ')\n')
- TEST.write('\n\n')
+ # Get the status of the instance and restart it if it exists
+ TEST.write(' instance_standalone' + idx + ' =
standalone' +
+ idx + '.exists()\n')
+
+ # Remove the instance
+ TEST.write(' if instance_standalone' + idx + ':\n')
+ TEST.write(' standalone' + idx + '.delete()\n')
+
+ # Create and open the instance
+ TEST.write(' standalone' + idx + '.create()\n')
+ TEST.write(' standalone' + idx + '.open()\n')
+
+ writeFinalizer()
+
+ TEST.write(' return TopologyStandalone(standalone')
+ for idx in range(instances):
+ idx += 1
+ if idx == 1:
+ continue
+ TEST.write(', standalone' + str(idx))
+ TEST.write(')\n\n')
+ TEST.write('\n')
- #
# Write the test function
- #
if ticket:
TEST.write('def test_ticket' + ticket + '(topology):\n')
if repl_deployment:
@@ -678,33 +632,35 @@ if len(sys.argv) > 0:
TEST.write(' Also, if you need any testcase initialization,\n')
TEST.write(' please, write additional fixture for that' +
'(include finalizer).\n')
- TEST.write('\n """\n\n')
-
+ TEST.write(' """\n\n')
else:
- # Write the first initial empty test function
- TEST.write('def test_' + suite + '(topology):\n')
+ TEST.write('def test_something(topology_XX):\n')
TEST.write(' """Write a single test here...\n\n')
TEST.write(' Also, if you need any test suite initialization,\n')
- TEST.write(' please, write additional fixture for that(include ' +
- 'finalizer).\n """\n')
+ TEST.write(' please, write additional fixture for that(include
finalizer).\n' +
+ ' Topology for suites are predefined in
lib389/topologies.py.\n\n'
+ ' Choose one of the options:\n'
+ ' 1) topology_st for standalone\n'
+ ' topology.standalone\n'
+ ' 2) topology_m2 for two masters\n'
+ ' topology.ms["master{1,2}"]\n'
+ ' each master has agreements\n'
+ '
topology.ms["master{1,2}_agmts"][m{1,2}_m{2,1}]\n'
+ ' 3) topology_m4 for four masters\n'
+ ' the same as topology_m2 but has more masters and
agreements\n'
+ ' """\n\n')
TEST.write(' if DEBUGGING:\n')
TEST.write(' # Add debugging steps(if any)...\n')
- TEST.write(' pass\n\n')
- TEST.write(" log.info('Test PASSED')\n")
- TEST.write('\n\n')
+ TEST.write(' pass\n\n\n')
- #
# Write the main function
- #
TEST.write("if __name__ == '__main__':\n")
TEST.write(' # Run isolated\n')
TEST.write(' # -s for DEBUG mode\n')
TEST.write(' CURRENT_FILE = os.path.realpath(__file__)\n')
TEST.write(' pytest.main("-s %s" % CURRENT_FILE)\n\n')
- #
# Done, close things up
- #
TEST.close()
print('Created: ' + filename)
diff --git a/dirsrvtests/tests/suites/acct_usability_plugin/acct_usability_test.py
b/dirsrvtests/tests/suites/acct_usability_plugin/acct_usability_test.py
deleted file mode 100644
index b7ac869..0000000
--- a/dirsrvtests/tests/suites/acct_usability_plugin/acct_usability_test.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_acct_usability_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_acct_usability_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/acctpolicy_plugin/accpol_test.py
b/dirsrvtests/tests/suites/acctpolicy_plugin/accpol_test.py
index 22acc39..a005f3f 100644
--- a/dirsrvtests/tests/suites/acctpolicy_plugin/accpol_test.py
+++ b/dirsrvtests/tests/suites/acctpolicy_plugin/accpol_test.py
@@ -6,16 +6,14 @@ import logging
import pytest
import ldif
import ldap.modlist as modlist
-from ldif import LDIFParser,LDIFWriter
+from ldif import LDIFParser, LDIFWriter
from lib389 import DirSrv, Entry, tools, tasks
from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
+from lib389.topologies import topology_st
LOCAL_CONFIG = 'cn=AccountPolicy1,ou=people,dc=example,dc=com'
TEMPLT_COS = 'cn=TempltCoS,ou=people,dc=example,dc=com'
@@ -32,79 +30,45 @@ USR_DN = 'uid={},{},{}'.format(USR_RDN, SUBTREE, SUFFIX)
USER_PW = 'Secret1234'
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
@pytest.fixture(scope="module")
-def topology(request):
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- log.info("Instance detected")
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Delete each instance in the end
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
-
-(a)pytest.fixture(scope="module")
-def accpolicy_local(topology):
+def accpolicy_local(topology_st):
"""Configure account policy plugin based
on LDIF file and restart the server.
"""
log.info('Enabling account policy plugin and restarting the server')
try:
- topology.standalone.plugins.enable(name=PLUGIN_ACCT_POLICY)
- topology.standalone.modify_s(ACCPOL_DN, [(ldap.MOD_REPLACE,
'nsslapd-pluginarg0', CONFIG_DN)])
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'alwaysrecordlogin', 'yes')])
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'stateattrname',
'lastLoginTime')])
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'altstateattrname', 'createTimestamp')])
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'specattrname',
'acctPolicySubentry')])
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'limitattrname',
'accountInactivityLimit')])
+ topology_st.standalone.plugins.enable(name=PLUGIN_ACCT_POLICY)
+ topology_st.standalone.modify_s(ACCPOL_DN, [(ldap.MOD_REPLACE,
'nsslapd-pluginarg0', CONFIG_DN)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'alwaysrecordlogin', 'yes')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'stateattrname', 'lastLoginTime')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'altstateattrname', 'createTimestamp')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'specattrname', 'acctPolicySubentry')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'limitattrname', 'accountInactivityLimit')])
except ldap.LDAPError as e:
- log.error("Failed to modify account policy plugin attrs attrs")
+ log.error("Failed to modify account policy plugin attrs attrs")
raise
log.info("Adding Local account policy plugin configuration entries")
try:
- topology.standalone.add_s(Entry((LOCAL_CONFIG, {
- 'objectclass': ['top',
'ldapsubentry', 'extensibleObject', 'accountpolicy'],
- 'accountInactivityLimit': '15'})))
- topology.standalone.add_s(Entry((TEMPLT_COS, {
- 'objectclass': ['top',
'ldapsubentry', 'extensibleObject', 'cosTemplate'],
- 'acctPolicySubentry': LOCAL_CONFIG})))
- topology.standalone.add_s(Entry((DEFN_COS, {
- 'objectclass': ['top',
'ldapsubentry', 'cosSuperDefinition', 'cosPointerDefinition'],
- 'cosTemplateDn': TEMPLT_COS,
- 'cosAttribute': 'acctPolicySubentry default
operational-default'})))
+ topology_st.standalone.add_s(Entry((LOCAL_CONFIG, {
+ 'objectclass': ['top', 'ldapsubentry',
'extensibleObject', 'accountpolicy'],
+ 'accountInactivityLimit': '15'})))
+ topology_st.standalone.add_s(Entry((TEMPLT_COS, {
+ 'objectclass': ['top', 'ldapsubentry',
'extensibleObject', 'cosTemplate'],
+ 'acctPolicySubentry': LOCAL_CONFIG})))
+ topology_st.standalone.add_s(Entry((DEFN_COS, {
+ 'objectclass': ['top', 'ldapsubentry',
'cosSuperDefinition', 'cosPointerDefinition'],
+ 'cosTemplateDn': TEMPLT_COS,
+ 'cosAttribute': 'acctPolicySubentry default
operational-default'})))
except ldap.LDAPError as e:
- log.error('Failed to add entry ({}, {}, {}):'.format(LOCAL_CONFIG, TEMPLT_COS,
DEFN_COS))
- raise
- topology.standalone.restart(timeout=10)
+ log.error('Failed to add entry ({}, {}, {}):'.format(LOCAL_CONFIG,
TEMPLT_COS, DEFN_COS))
+ raise
+ topology_st.standalone.restart(timeout=10)
@pytest.fixture(scope="module")
-def users(topology, request):
+def users(topology_st, request):
"""Add users to the given SUFFIX and SUBTREE."""
log.info('Adding {} {} users to {} SUBTREE {} SUFFIX'.format(NOF_USERS,
USR_NAME, SUBTREE, SUFFIX))
@@ -112,33 +76,35 @@ def users(topology, request):
USR_RDN = '{}{}'.format(USR_NAME, NUM)
USR_DN = 'uid={},{},{}'.format(USR_RDN, SUBTREE, SUFFIX)
try:
- topology.standalone.add_s(Entry((USR_DN, {
- 'objectclass': 'top
person'.split(),
- 'objectclass':
'inetorgperson',
- 'cn': USR_RDN,
- 'sn': USR_RDN,
- 'userpassword':
'Secret1234',
- 'mail':
'{}(a)redhat.com'.format(USR_RDN)})))
+ topology_st.standalone.add_s(Entry((USR_DN, {
+ 'objectclass': 'top person'.split(),
+ 'objectclass': 'inetorgperson',
+ 'cn': USR_RDN,
+ 'sn': USR_RDN,
+ 'userpassword': 'Secret1234',
+ 'mail': '{}(a)redhat.com'.format(USR_RDN)})))
except ldap.LDAPError as e:
log.error('Failed to add {} user: error {}'.format(USR_DN,
e.message['desc']))
raise
def fin():
- log.info('Deleting {} {} users from {} {}'.format(NOF_USERS, USR_NAME,
SUBTREE, SUFFIX))
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- for NUM in range(1, NOF_USERS):
- USR_RDN = '{}{}'.format(USR_NAME, NUM)
- USR_DN = 'uid={},{},{}'.format(USR_RDN, SUBTREE, SUFFIX)
- try:
- topology.standalone.delete_s(USR_DN)
- except ldap.LDAPError as e:
- log.error('Failed to delete {} :error- {}'.format(USR_DN,
e.message['desc']))
- raise
+ log.info('Deleting {} {} users from {} {}'.format(NOF_USERS, USR_NAME,
SUBTREE, SUFFIX))
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ for NUM in range(1, NOF_USERS):
+ USR_RDN = '{}{}'.format(USR_NAME, NUM)
+ USR_DN = 'uid={},{},{}'.format(USR_RDN, SUBTREE, SUFFIX)
+ try:
+ topology_st.standalone.delete_s(USR_DN)
+ except ldap.LDAPError as e:
+ log.error('Failed to delete {} :error- {}'.format(USR_DN,
e.message['desc']))
+ raise
+
request.addfinalizer(fin)
-def test_inact_plugin(topology, accpolicy_local, users):
- """Verify if user account is inactivated when accountInactivityLimit
is exceeded. User is created in the default SUFFIX.
+def test_inact_plugin(topology_st, accpolicy_local, users):
+ """Verify if user account is inactivated when accountInactivityLimit
is exceeded.
+ User is created in the default SUFFIX.
:Feature: Account Policy Plugin
@@ -162,21 +128,21 @@ def test_inact_plugin(topology, accpolicy_local, users):
USR_RDN = '{}{}'.format(USR_NAME, NUM)
USR_DN = 'uid={},{},{}'.format(USR_RDN, SUBTREE, SUFFIX)
try:
- topology.standalone.simple_bind_s(USR_DN, USER_PW)
+ topology_st.standalone.simple_bind_s(USR_DN, USER_PW)
except ldap.LDAPError as e:
log.error('Checking if {} is inactivated: error {}'.format(USR_DN,
e.message['desc']))
raise
-
+
USR_DN = 'uid={}1,{},{}'.format(USR_NAME, SUBTREE, SUFFIX)
log.info("Sleeping for 4 more secs to check if {} is inactivated, expected error
19".format(USR_DN))
time.sleep(4)
with pytest.raises(ldap.CONSTRAINT_VIOLATION) as e:
- topology.standalone.simple_bind_s(USR_DN, USER_PW)
+ topology_st.standalone.simple_bind_s(USR_DN, USER_PW)
USR_DN = 'uid={}2,{},{}'.format(USR_NAME, SUBTREE, SUFFIX)
log.info("Checking if {} is not inactivated, expected value
0".format(USR_DN))
try:
- topology.standalone.simple_bind_s(USR_DN, USER_PW)
+ topology_st.standalone.simple_bind_s(USR_DN, USER_PW)
except ldap.LDAPError as e:
log.error('Checking if {} is inactivated : error {}'.format(USR_DN,
e.message['desc']))
raise
@@ -186,7 +152,7 @@ def test_inact_plugin(topology, accpolicy_local, users):
USR_DN = 'uid={},{},{}'.format(USR_RDN, SUBTREE, SUFFIX)
log.info("Checking if {} is inactivated, expected error
19".format(USR_DN))
with pytest.raises(ldap.CONSTRAINT_VIOLATION) as e:
- topology.standalone.simple_bind_s(USR_DN, USER_PW)
+ topology_st.standalone.simple_bind_s(USR_DN, USER_PW)
if __name__ == '__main__':
diff --git a/dirsrvtests/tests/suites/acctpolicy_plugin/acctpolicy_test.py
b/dirsrvtests/tests/suites/acctpolicy_plugin/acctpolicy_test.py
deleted file mode 100644
index 14c6851..0000000
--- a/dirsrvtests/tests/suites/acctpolicy_plugin/acctpolicy_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_acctpolicy_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_acctpolicy_(topology):
- '''
- Write a single test here...
- '''
- log.info('acctpolicy test suite PASSED')
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/acl/acl_test.py
b/dirsrvtests/tests/suites/acl/acl_test.py
index f42a584..cb58352 100644
--- a/dirsrvtests/tests/suites/acl/acl_test.py
+++ b/dirsrvtests/tests/suites/acl/acl_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -18,38 +18,33 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_m2
from ldap.controls.simple import GetEffectiveRightsControl
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-#
-# important part. We can deploy Master1 and Master2 on different versions
-#
-installation1_prefix = None
-installation2_prefix = None
-
TEST_REPL_DN = "cn=test_repl, %s" % SUFFIX
-STAGING_CN = "staged user"
-PRODUCTION_CN = "accounts"
-EXCEPT_CN = "excepts"
+STAGING_CN = "staged user"
+PRODUCTION_CN = "accounts"
+EXCEPT_CN = "excepts"
-STAGING_DN = "cn=%s,%s" % (STAGING_CN, SUFFIX)
+STAGING_DN = "cn=%s,%s" % (STAGING_CN, SUFFIX)
PRODUCTION_DN = "cn=%s,%s" % (PRODUCTION_CN, SUFFIX)
PROD_EXCEPT_DN = "cn=%s,%s" % (EXCEPT_CN, PRODUCTION_DN)
-STAGING_PATTERN = "cn=%s*,%s" % (STAGING_CN[:2], SUFFIX)
+STAGING_PATTERN = "cn=%s*,%s" % (STAGING_CN[:2], SUFFIX)
PRODUCTION_PATTERN = "cn=%s*,%s" % (PRODUCTION_CN[:2], SUFFIX)
-BAD_STAGING_PATTERN = "cn=bad*,%s" % (SUFFIX)
+BAD_STAGING_PATTERN = "cn=bad*,%s" % (SUFFIX)
BAD_PRODUCTION_PATTERN = "cn=bad*,%s" % (SUFFIX)
-BIND_CN = "bind_entry"
-BIND_DN = "cn=%s,%s" % (BIND_CN, SUFFIX)
-BIND_PW = "password"
+BIND_CN = "bind_entry"
+BIND_DN = "cn=%s,%s" % (BIND_CN, SUFFIX)
+BIND_PW = "password"
-NEW_ACCOUNT = "new_account"
-MAX_ACCOUNTS = 20
+NEW_ACCOUNT = "new_account"
+MAX_ACCOUNTS = 20
CONFIG_MODDN_ACI_ATTR = "nsslapd-moddn-aci"
@@ -61,127 +56,7 @@ SRC_ENTRY_DN = "cn=%s,%s" % (SRC_ENTRY_CN, SUFFIX)
DST_ENTRY_DN = "cn=%s,%s" % (DST_ENTRY_CN, SUFFIX)
-class TopologyMaster1Master2(object):
- def __init__(self, master1, master2):
- master1.open()
- self.master1 = master1
-
- master2.open()
- self.master2 = master2
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- """This fixture is used to create a replicated topology for the
'module'.
- The replicated topology is MASTER1 <-> Master2.
- """
-
- global installation1_prefix
- global installation2_prefix
-
- # allocate master1 on a given deployement
- master1 = DirSrv(verbose=False)
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Args for the master1 instance
- args_instance[SER_HOST] = HOST_MASTER_1
- args_instance[SER_PORT] = PORT_MASTER_1
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
- args_master = args_instance.copy()
- master1.allocate(args_master)
-
- # allocate master1 on a given deployement
- master2 = DirSrv(verbose=False)
- if installation2_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation2_prefix
-
- # Args for the consumer instance
- args_instance[SER_HOST] = HOST_MASTER_2
- args_instance[SER_PORT] = PORT_MASTER_2
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
- args_master = args_instance.copy()
- master2.allocate(args_master)
-
- # Get the status of the instance and restart it if it exists
- instance_master1 = master1.exists()
- instance_master2 = master2.exists()
-
- # Remove all the instances
- if instance_master1:
- master1.delete()
- if instance_master2:
- master2.delete()
-
- # Create the instances
- master1.create()
- master1.open()
- master2.create()
- master2.open()
-
- #
- # Now prepare the Master-Consumer topology
- #
- # First Enable replication
- master1.replica.enableReplication(suffix=SUFFIX,
- role=REPLICAROLE_MASTER,
- replicaId=REPLICAID_MASTER_1)
- master2.replica.enableReplication(suffix=SUFFIX,
- role=REPLICAROLE_MASTER,
- replicaId=REPLICAID_MASTER_2)
-
- # Initialize the supplier->consumer
-
- properties = {RA_NAME: r'meTo_$host:$port',
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- repl_agreement = master1.agreement.create(suffix=SUFFIX,
- host=master2.host,
- port=master2.port,
- properties=properties)
-
- if not repl_agreement:
- log.fatal("Fail to create a replica agreement")
- sys.exit(1)
-
- log.debug("%s created" % repl_agreement)
-
- properties = {RA_NAME: r'meTo_$host:$port',
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- master2.agreement.create(suffix=SUFFIX,
- host=master1.host,
- port=master1.port,
- properties=properties)
-
- master1.agreement.init(SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
- master1.waitForReplInit(repl_agreement)
-
- # Check replication is working fine
- if master1.testReplication(DEFAULT_SUFFIX, master2):
- log.info('Replication is working.')
- else:
- log.fatal('Replication is not working.')
- assert False
-
- def fin():
- master1.delete()
- master2.delete()
- request.addfinalizer(fin)
-
- # clear the tmp directory
- master1.clearTmpDir(__file__)
-
- # Here we have two instances master and consumer
- # with replication working.
- return TopologyMaster1Master2(master1, master2)
-
-
-def add_attr(topology, attr_name):
+def add_attr(topology_m2, attr_name):
"""Adds attribute to the schema"""
ATTR_VALUE = """(NAME '%s' \
@@ -190,7 +65,7 @@ def add_attr(topology, attr_name):
mod = [(ldap.MOD_ADD, 'attributeTypes', ATTR_VALUE)]
try:
- topology.master1.modify_s(DN_SCHEMA, mod)
+ topology_m2.ms["master1"].modify_s(DN_SCHEMA, mod)
except ldap.LDAPError as e:
log.fatal('Failed to add attr (%s): error (%s)' % (attr_name,
e.message['desc']))
@@ -198,7 +73,7 @@ def add_attr(topology, attr_name):
@pytest.fixture(params=["lang-ja", "binary", "phonetic"])
-def aci_with_attr_subtype(request, topology):
+def aci_with_attr_subtype(request, topology_m2):
"""Adds and deletes an ACI in the DEFAULT_SUFFIX"""
TARGET_ATTR = 'protectedOperation'
@@ -207,10 +82,10 @@ def aci_with_attr_subtype(request, topology):
log.info("========Executing test with '%s' subtype========" %
SUBTYPE)
log.info(" Add a target attribute")
- add_attr(topology, TARGET_ATTR)
+ add_attr(topology_m2, TARGET_ATTR)
log.info(" Add a user attribute")
- add_attr(topology, USER_ATTR)
+ add_attr(topology_m2, USER_ATTR)
ACI_TARGET = '(targetattr=%s;%s)' % (TARGET_ATTR, SUBTYPE)
ACI_ALLOW = '(version 3.0; acl "test aci for subtypes"; allow (read)
'
@@ -220,26 +95,27 @@ def aci_with_attr_subtype(request, topology):
log.info(" Add an ACI with attribute subtype")
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
try:
- topology.master1.modify_s(DEFAULT_SUFFIX, mod)
+ topology_m2.ms["master1"].modify_s(DEFAULT_SUFFIX, mod)
except ldap.LDAPError as e:
log.fatal('Failed to add ACI: error (%s)' % (e.message['desc']))
assert False
def fin():
log.info(" Finally, delete an ACI with the '%s' subtype"
%
- SUBTYPE)
+ SUBTYPE)
mod = [(ldap.MOD_DELETE, 'aci', ACI_BODY)]
try:
- topology.master1.modify_s(DEFAULT_SUFFIX, mod)
+ topology_m2.ms["master1"].modify_s(DEFAULT_SUFFIX, mod)
except ldap.LDAPError as e:
log.fatal('Failed to delete ACI: error (%s)' %
(e.message['desc']))
assert False
+
request.addfinalizer(fin)
return ACI_BODY
-def test_aci_attr_subtype_targetattr(topology, aci_with_attr_subtype):
+def test_aci_attr_subtype_targetattr(topology_m2, aci_with_attr_subtype):
"""Checks, that ACIs allow attribute subtypes in the targetattr
keyword
Test description:
@@ -254,9 +130,9 @@ def test_aci_attr_subtype_targetattr(topology,
aci_with_attr_subtype):
log.info(" Search for the added attribute")
try:
- entries = topology.master1.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_BASE,
- '(objectclass=*)',
['aci'])
+ entries = topology_m2.ms["master1"].search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_BASE,
+ '(objectclass=*)',
['aci'])
entry = str(entries[0])
assert aci_with_attr_subtype in entry
log.info(" The added attribute was found")
@@ -266,98 +142,97 @@ def test_aci_attr_subtype_targetattr(topology,
aci_with_attr_subtype):
assert False
-def _bind_manager(topology):
- topology.master1.log.info("Bind as %s " % DN_DM)
- topology.master1.simple_bind_s(DN_DM, PASSWORD)
+def _bind_manager(topology_m2):
+ topology_m2.ms["master1"].log.info("Bind as %s " % DN_DM)
+ topology_m2.ms["master1"].simple_bind_s(DN_DM, PASSWORD)
-def _bind_normal(topology):
+def _bind_normal(topology_m2):
# bind as bind_entry
- topology.master1.log.info("Bind as %s" % BIND_DN)
- topology.master1.simple_bind_s(BIND_DN, BIND_PW)
+ topology_m2.ms["master1"].log.info("Bind as %s" % BIND_DN)
+ topology_m2.ms["master1"].simple_bind_s(BIND_DN, BIND_PW)
-def _moddn_aci_deny_tree(topology, mod_type=None,
+def _moddn_aci_deny_tree(topology_m2, mod_type=None,
target_from=STAGING_DN, target_to=PROD_EXCEPT_DN):
"""It denies the access moddn_to in
cn=except,cn=accounts,SUFFIX"""
assert mod_type is not None
ACI_TARGET_FROM = ""
- ACI_TARGET_TO = ""
+ ACI_TARGET_TO = ""
if target_from:
ACI_TARGET_FROM = "(target_from = \"ldap:///%s\")" %
(target_from)
if target_to:
- ACI_TARGET_TO = "(target_to = \"ldap:///%s\")" %
(target_to)
+ ACI_TARGET_TO = "(target_to = \"ldap:///%s\")" %
(target_to)
- ACI_ALLOW = "(version 3.0; acl \"Deny MODDN to prod_except\";
deny (moddn)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_TARGET_TO + ACI_TARGET_FROM + ACI_ALLOW + ACI_SUBJECT
+ ACI_ALLOW = "(version 3.0; acl \"Deny MODDN to prod_except\"; deny
(moddn)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_TARGET_TO + ACI_TARGET_FROM + ACI_ALLOW + ACI_SUBJECT
mod = [(mod_type, 'aci', ACI_BODY)]
- #topology.master1.modify_s(SUFFIX, mod)
- topology.master1.log.info("Add a DENY aci under %s " % PROD_EXCEPT_DN)
- topology.master1.modify_s(PROD_EXCEPT_DN, mod)
+ # topology_m2.ms["master1"].modify_s(SUFFIX, mod)
+ topology_m2.ms["master1"].log.info("Add a DENY aci under %s " %
PROD_EXCEPT_DN)
+ topology_m2.ms["master1"].modify_s(PROD_EXCEPT_DN, mod)
-def _write_aci_staging(topology, mod_type=None):
+def _write_aci_staging(topology_m2, mod_type=None):
assert mod_type is not None
ACI_TARGET = "(targetattr=
\"cn\")(target=\"ldap:///cn=*,%s\")" % STAGING_DN
- ACI_ALLOW = "(version 3.0; acl \"write staging entries\"; allow
(write)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
+ ACI_ALLOW = "(version 3.0; acl \"write staging entries\"; allow
(write)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
mod = [(mod_type, 'aci', ACI_BODY)]
- topology.master1.modify_s(SUFFIX, mod)
+ topology_m2.ms["master1"].modify_s(SUFFIX, mod)
-def _write_aci_production(topology, mod_type=None):
+def _write_aci_production(topology_m2, mod_type=None):
assert mod_type is not None
ACI_TARGET = "(targetattr=
\"cn\")(target=\"ldap:///cn=*,%s\")" % PRODUCTION_DN
- ACI_ALLOW = "(version 3.0; acl \"write production entries\";
allow (write)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
+ ACI_ALLOW = "(version 3.0; acl \"write production entries\"; allow
(write)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
mod = [(mod_type, 'aci', ACI_BODY)]
- topology.master1.modify_s(SUFFIX, mod)
+ topology_m2.ms["master1"].modify_s(SUFFIX, mod)
-def _moddn_aci_staging_to_production(topology, mod_type=None,
+def _moddn_aci_staging_to_production(topology_m2, mod_type=None,
target_from=STAGING_DN, target_to=PRODUCTION_DN):
assert mod_type is not None
-
ACI_TARGET_FROM = ""
- ACI_TARGET_TO = ""
+ ACI_TARGET_TO = ""
if target_from:
ACI_TARGET_FROM = "(target_from = \"ldap:///%s\")" %
(target_from)
if target_to:
- ACI_TARGET_TO = "(target_to = \"ldap:///%s\")" %
(target_to)
+ ACI_TARGET_TO = "(target_to = \"ldap:///%s\")" %
(target_to)
- ACI_ALLOW = "(version 3.0; acl \"MODDN from staging to
production\"; allow (moddn)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_TARGET_FROM + ACI_TARGET_TO + ACI_ALLOW + ACI_SUBJECT
+ ACI_ALLOW = "(version 3.0; acl \"MODDN from staging to production\";
allow (moddn)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_TARGET_FROM + ACI_TARGET_TO + ACI_ALLOW + ACI_SUBJECT
mod = [(mod_type, 'aci', ACI_BODY)]
- topology.master1.modify_s(SUFFIX, mod)
+ topology_m2.ms["master1"].modify_s(SUFFIX, mod)
- _write_aci_staging(topology, mod_type=mod_type)
+ _write_aci_staging(topology_m2, mod_type=mod_type)
-def _moddn_aci_from_production_to_staging(topology, mod_type=None):
+def _moddn_aci_from_production_to_staging(topology_m2, mod_type=None):
assert mod_type is not None
- ACI_TARGET = "(target_from = \"ldap:///%s\") (target_to =
\"ldap:///%s\")" % (
- PRODUCTION_DN, STAGING_DN)
- ACI_ALLOW = "(version 3.0; acl \"MODDN from production to
staging\"; allow (moddn)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
+ ACI_TARGET = "(target_from = \"ldap:///%s\") (target_to =
\"ldap:///%s\")" % (
+ PRODUCTION_DN, STAGING_DN)
+ ACI_ALLOW = "(version 3.0; acl \"MODDN from production to staging\";
allow (moddn)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
mod = [(mod_type, 'aci', ACI_BODY)]
- topology.master1.modify_s(SUFFIX, mod)
+ topology_m2.ms["master1"].modify_s(SUFFIX, mod)
- _write_aci_production(topology, mod_type=mod_type)
+ _write_aci_production(topology_m2, mod_type=mod_type)
@pytest.fixture(scope="module")
-def moddn_setup(topology):
+def moddn_setup(topology_m2):
"""Creates
- a staging DIT
- a production DIT
@@ -365,94 +240,94 @@ def moddn_setup(topology):
- enable ACL logging (commented for performance reason)
"""
- topology.master1.log.info("\n\n######## INITIALIZATION ########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## INITIALIZATION
########\n")
# entry used to bind with
- topology.master1.log.info("Add %s" % BIND_DN)
- topology.master1.add_s(Entry((BIND_DN, {
- 'objectclass': "top
person".split(),
- 'sn': BIND_CN,
- 'cn': BIND_CN,
- 'userpassword': BIND_PW})))
+ topology_m2.ms["master1"].log.info("Add %s" % BIND_DN)
+ topology_m2.ms["master1"].add_s(Entry((BIND_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': BIND_CN,
+ 'cn': BIND_CN,
+ 'userpassword': BIND_PW})))
# DIT for staging
- topology.master1.log.info("Add %s" % STAGING_DN)
- topology.master1.add_s(Entry((STAGING_DN, {
- 'objectclass': "top
organizationalRole".split(),
- 'cn': STAGING_CN,
- 'description': "staging
DIT"})))
+ topology_m2.ms["master1"].log.info("Add %s" % STAGING_DN)
+ topology_m2.ms["master1"].add_s(Entry((STAGING_DN, {
+ 'objectclass': "top organizationalRole".split(),
+ 'cn': STAGING_CN,
+ 'description': "staging DIT"})))
# DIT for production
- topology.master1.log.info("Add %s" % PRODUCTION_DN)
- topology.master1.add_s(Entry((PRODUCTION_DN, {
- 'objectclass': "top
organizationalRole".split(),
- 'cn': PRODUCTION_CN,
- 'description': "production
DIT"})))
+ topology_m2.ms["master1"].log.info("Add %s" % PRODUCTION_DN)
+ topology_m2.ms["master1"].add_s(Entry((PRODUCTION_DN, {
+ 'objectclass': "top organizationalRole".split(),
+ 'cn': PRODUCTION_CN,
+ 'description': "production DIT"})))
# DIT for production/except
- topology.master1.log.info("Add %s" % PROD_EXCEPT_DN)
- topology.master1.add_s(Entry((PROD_EXCEPT_DN, {
- 'objectclass': "top
organizationalRole".split(),
- 'cn': EXCEPT_CN,
- 'description': "production
except DIT"})))
+ topology_m2.ms["master1"].log.info("Add %s" % PROD_EXCEPT_DN)
+ topology_m2.ms["master1"].add_s(Entry((PROD_EXCEPT_DN, {
+ 'objectclass': "top organizationalRole".split(),
+ 'cn': EXCEPT_CN,
+ 'description': "production except DIT"})))
# enable acl error logging
- #mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '128')]
- #topology.master1.modify_s(DN_CONFIG, mod)
- #topology.master2.modify_s(DN_CONFIG, mod)
+ # mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '128')]
+ # topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)
+ # topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)
# add dummy entries in the staging DIT
for cpt in range(MAX_ACCOUNTS):
name = "%s%d" % (NEW_ACCOUNT, cpt)
- topology.master1.add_s(Entry(("cn=%s,%s" % (name, STAGING_DN), {
- 'objectclass': "top
person".split(),
- 'sn': name,
- 'cn': name})))
+ topology_m2.ms["master1"].add_s(Entry(("cn=%s,%s" % (name,
STAGING_DN), {
+ 'objectclass': "top person".split(),
+ 'sn': name,
+ 'cn': name})))
-def test_mode_default_add_deny(topology, moddn_setup):
+def test_mode_default_add_deny(topology_m2, moddn_setup):
"""This test case checks
that the ADD operation fails (no ADD aci on production)
"""
- topology.master1.log.info("\n\n######## mode moddn_aci : ADD (should fail)
########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## mode moddn_aci : ADD
(should fail) ########\n")
- _bind_normal(topology)
+ _bind_normal(topology_m2)
#
# First try to add an entry in production => INSUFFICIENT_ACCESS
#
try:
- topology.master1.log.info("Try to add %s" % PRODUCTION_DN)
+ topology_m2.ms["master1"].log.info("Try to add %s" %
PRODUCTION_DN)
name = "%s%d" % (NEW_ACCOUNT, 0)
- topology.master1.add_s(Entry(("cn=%s,%s" % (name, PRODUCTION_DN), {
- 'objectclass': "top
person".split(),
- 'sn': name,
- 'cn': name})))
+ topology_m2.ms["master1"].add_s(Entry(("cn=%s,%s" % (name,
PRODUCTION_DN), {
+ 'objectclass': "top person".split(),
+ 'sn': name,
+ 'cn': name})))
assert 0 # this is an error, we should not be allowed to add an entry in
production
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
-def test_mode_default_delete_deny(topology, moddn_setup):
+def test_mode_default_delete_deny(topology_m2, moddn_setup):
"""This test case checks
that the DEL operation fails (no 'delete' aci on production)
"""
- topology.master1.log.info("\n\n######## DELETE (should fail) ########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## DELETE (should fail)
########\n")
- _bind_normal(topology)
+ _bind_normal(topology_m2)
#
# Second try to delete an entry in staging => INSUFFICIENT_ACCESS
#
try:
- topology.master1.log.info("Try to delete %s" % STAGING_DN)
+ topology_m2.ms["master1"].log.info("Try to delete %s" %
STAGING_DN)
name = "%s%d" % (NEW_ACCOUNT, 0)
- topology.master1.delete_s("cn=%s,%s" % (name, STAGING_DN))
+ topology_m2.ms["master1"].delete_s("cn=%s,%s" % (name,
STAGING_DN))
assert 0 # this is an error, we should not be allowed to add an entry in
production
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
@@ -466,17 +341,17 @@ def test_mode_default_delete_deny(topology, moddn_setup):
(6, None, PRODUCTION_PATTERN, False),
(7, STAGING_PATTERN, None, False),
(8, None, None, False)])
-def test_moddn_staging_prod(topology, moddn_setup,
+def test_moddn_staging_prod(topology_m2, moddn_setup,
index, tfrom, tto, failure):
"""This test case MOVE entry NEW_ACCOUNT0 from staging to prod
target_to/target_from: equality filter
"""
- topology.master1.log.info("\n\n######## MOVE staging -> Prod (%s)
########\n" % index)
- _bind_normal(topology)
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE staging ->
Prod (%s) ########\n" % index)
+ _bind_normal(topology_m2)
old_rdn = "cn=%s%s" % (NEW_ACCOUNT, index)
- old_dn = "%s,%s" % (old_rdn, STAGING_DN)
+ old_dn = "%s,%s" % (old_rdn, STAGING_DN)
new_rdn = old_rdn
new_superior = PRODUCTION_DN
@@ -484,39 +359,39 @@ def test_moddn_staging_prod(topology, moddn_setup,
# Try to rename without the apropriate ACI => INSUFFICIENT_ACCESS
#
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
-
# successfull MOD with the ACI
- topology.master1.log.info("\n\n######## MOVE to and from equality filter
########\n")
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_ADD,
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE to and from
equality filter ########\n")
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_ADD,
target_from=tfrom, target_to=tto)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
if failure:
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
# successfull MOD with the both ACI
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_DELETE,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_DELETE,
target_from=tfrom, target_to=tto)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
-def test_moddn_staging_prod_9(topology, moddn_setup):
+def test_moddn_staging_prod_9(topology_m2, moddn_setup):
"""This test case disable the 'moddn' right so a MODDN
requires a 'add' right
to be successfull.
It fails to MOVE entry NEW_ACCOUNT9 from staging to prod.
@@ -529,11 +404,11 @@ def test_moddn_staging_prod_9(topology, moddn_setup):
Then it succeeds to MOVE NEW_ACCOUNT10 from staging to prod.
"""
- topology.master1.log.info("\n\n######## MOVE staging -> Prod (9)
########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE staging ->
Prod (9) ########\n")
- _bind_normal(topology)
+ _bind_normal(topology_m2)
old_rdn = "cn=%s9" % NEW_ACCOUNT
- old_dn = "%s,%s" % (old_rdn, STAGING_DN)
+ old_dn = "%s,%s" % (old_rdn, STAGING_DN)
new_rdn = old_rdn
new_superior = PRODUCTION_DN
@@ -541,83 +416,85 @@ def test_moddn_staging_prod_9(topology, moddn_setup):
# Try to rename without the apropriate ACI => INSUFFICIENT_ACCESS
#
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
#############
# Now do tests with no support of moddn aci
#############
- topology.master1.log.info("Disable the moddn right")
- _bind_manager(topology)
+ topology_m2.ms["master1"].log.info("Disable the moddn right")
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_REPLACE, CONFIG_MODDN_ACI_ATTR, 'off')]
- topology.master1.modify_s(DN_CONFIG, mod)
+ topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)
# Add the moddn aci that will not be evaluated because of the config flag
- topology.master1.log.info("\n\n######## MOVE to and from equality filter
########\n")
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_ADD,
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE to and from
equality filter ########\n")
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_ADD,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
# It will fail because it will test the ADD right
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
# remove the moddn aci
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_DELETE,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_DELETE,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
#
# add the 'add' right to the production DN
# Then do a successfull moddn
#
- ACI_ALLOW = "(version 3.0; acl \"ADD rights to allow moddn\";
allow (add)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_ALLOW + ACI_SUBJECT
+ ACI_ALLOW = "(version 3.0; acl \"ADD rights to allow moddn\"; allow
(add)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_ALLOW + ACI_SUBJECT
- _bind_manager(topology)
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
- topology.master1.modify_s(PRODUCTION_DN, mod)
- _write_aci_staging(topology, mod_type=ldap.MOD_ADD)
- _bind_normal(topology)
+ topology_m2.ms["master1"].modify_s(PRODUCTION_DN, mod)
+ _write_aci_staging(topology_m2, mod_type=ldap.MOD_ADD)
+ _bind_normal(topology_m2)
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn, new_rdn,
new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s -> %s,%s"
% (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
- _bind_manager(topology)
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_DELETE, 'aci', ACI_BODY)]
- topology.master1.modify_s(PRODUCTION_DN, mod)
- _write_aci_staging(topology, mod_type=ldap.MOD_DELETE)
- _bind_normal(topology)
+ topology_m2.ms["master1"].modify_s(PRODUCTION_DN, mod)
+ _write_aci_staging(topology_m2, mod_type=ldap.MOD_DELETE)
+ _bind_normal(topology_m2)
#############
# Now do tests with support of moddn aci
#############
- topology.master1.log.info("Enable the moddn right")
- _bind_manager(topology)
+ topology_m2.ms["master1"].log.info("Enable the moddn right")
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_REPLACE, CONFIG_MODDN_ACI_ATTR, 'on')]
- topology.master1.modify_s(DN_CONFIG, mod)
+ topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)
- topology.master1.log.info("\n\n######## MOVE staging -> Prod (10)
########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE staging ->
Prod (10) ########\n")
- _bind_normal(topology)
+ _bind_normal(topology_m2)
old_rdn = "cn=%s10" % NEW_ACCOUNT
- old_dn = "%s,%s" % (old_rdn, STAGING_DN)
+ old_dn = "%s,%s" % (old_rdn, STAGING_DN)
new_rdn = old_rdn
new_superior = PRODUCTION_DN
@@ -625,73 +502,75 @@ def test_moddn_staging_prod_9(topology, moddn_setup):
# Try to rename without the apropriate ACI => INSUFFICIENT_ACCESS
#
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
#
# add the 'add' right to the production DN
# Then do a failing moddn
#
- ACI_ALLOW = "(version 3.0; acl \"ADD rights to allow moddn\";
allow (add)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_ALLOW + ACI_SUBJECT
+ ACI_ALLOW = "(version 3.0; acl \"ADD rights to allow moddn\"; allow
(add)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_ALLOW + ACI_SUBJECT
- _bind_manager(topology)
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
- topology.master1.modify_s(PRODUCTION_DN, mod)
- _write_aci_staging(topology, mod_type=ldap.MOD_ADD)
- _bind_normal(topology)
+ topology_m2.ms["master1"].modify_s(PRODUCTION_DN, mod)
+ _write_aci_staging(topology_m2, mod_type=ldap.MOD_ADD)
+ _bind_normal(topology_m2)
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
- _bind_manager(topology)
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_DELETE, 'aci', ACI_BODY)]
- topology.master1.modify_s(PRODUCTION_DN, mod)
- _write_aci_staging(topology, mod_type=ldap.MOD_DELETE)
- _bind_normal(topology)
+ topology_m2.ms["master1"].modify_s(PRODUCTION_DN, mod)
+ _write_aci_staging(topology_m2, mod_type=ldap.MOD_DELETE)
+ _bind_normal(topology_m2)
# Add the moddn aci that will be evaluated because of the config flag
- topology.master1.log.info("\n\n######## MOVE to and from equality filter
########\n")
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_ADD,
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE to and from
equality filter ########\n")
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_ADD,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn, new_rdn,
new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s -> %s,%s"
% (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
# remove the moddn aci
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_DELETE,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_DELETE,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
-def test_moddn_prod_staging(topology, moddn_setup):
+def test_moddn_prod_staging(topology_m2, moddn_setup):
"""This test checks that we can move ACCOUNT11 from staging to prod
but not move back ACCOUNT11 from prod to staging
"""
- topology.master1.log.info("\n\n######## MOVE staging -> Prod (11)
########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE staging ->
Prod (11) ########\n")
- _bind_normal(topology)
+ _bind_normal(topology_m2)
old_rdn = "cn=%s11" % NEW_ACCOUNT
- old_dn = "%s,%s" % (old_rdn, STAGING_DN)
+ old_dn = "%s,%s" % (old_rdn, STAGING_DN)
new_rdn = old_rdn
new_superior = PRODUCTION_DN
@@ -699,71 +578,73 @@ def test_moddn_prod_staging(topology, moddn_setup):
# Try to rename without the apropriate ACI => INSUFFICIENT_ACCESS
#
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
# successfull MOD with the ACI
- topology.master1.log.info("\n\n######## MOVE to and from equality filter
########\n")
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_ADD,
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE to and from
equality filter ########\n")
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_ADD,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn, new_rdn,
new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s -> %s,%s"
% (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
# Now check we can not move back the entry to staging
old_rdn = "cn=%s11" % NEW_ACCOUNT
- old_dn = "%s,%s" % (old_rdn, PRODUCTION_DN)
+ old_dn = "%s,%s" % (old_rdn, PRODUCTION_DN)
new_rdn = old_rdn
new_superior = STAGING_DN
# add the write right because we want to check the moddn
- _bind_manager(topology)
- _write_aci_production(topology, mod_type=ldap.MOD_ADD)
- _bind_normal(topology)
+ _bind_manager(topology_m2)
+ _write_aci_production(topology_m2, mod_type=ldap.MOD_ADD)
+ _bind_normal(topology_m2)
try:
- topology.master1.log.info("Try to move back MODDN %s -> %s,%s" %
(old_dn, new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to move back MODDN %s
-> %s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
- _bind_manager(topology)
- _write_aci_production(topology, mod_type=ldap.MOD_DELETE)
- _bind_normal(topology)
+ _bind_manager(topology_m2)
+ _write_aci_production(topology_m2, mod_type=ldap.MOD_DELETE)
+ _bind_normal(topology_m2)
# successfull MOD with the both ACI
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_DELETE,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_DELETE,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
-def test_check_repl_M2_to_M1(topology, moddn_setup):
+def test_check_repl_M2_to_M1(topology_m2, moddn_setup):
"""Checks that replication is still working M2->M1, using
ACCOUNT12"""
- topology.master1.log.info("Bind as %s (M2)" % DN_DM)
- topology.master2.simple_bind_s(DN_DM, PASSWORD)
+ topology_m2.ms["master1"].log.info("Bind as %s (M2)" % DN_DM)
+ topology_m2.ms["master2"].simple_bind_s(DN_DM, PASSWORD)
rdn = "cn=%s12" % NEW_ACCOUNT
- dn = "%s,%s" % (rdn, STAGING_DN)
+ dn = "%s,%s" % (rdn, STAGING_DN)
# First wait for the ACCOUNT19 entry being replicated on M2
loop = 0
while loop <= 10:
try:
- ent = topology.master2.getEntry(dn, ldap.SCOPE_BASE,
"(objectclass=*)")
+ ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE,
"(objectclass=*)")
break
except ldap.NO_SUCH_OBJECT:
time.sleep(1)
@@ -773,12 +654,12 @@ def test_check_repl_M2_to_M1(topology, moddn_setup):
attribute = 'description'
tested_value = 'Hello world'
mod = [(ldap.MOD_ADD, attribute, tested_value)]
- topology.master1.log.info("Update (M2) %s (%s)" % (dn, attribute))
- topology.master2.modify_s(dn, mod)
+ topology_m2.ms["master1"].log.info("Update (M2) %s (%s)" % (dn,
attribute))
+ topology_m2.ms["master2"].modify_s(dn, mod)
loop = 0
while loop <= 10:
- ent = topology.master1.getEntry(dn, ldap.SCOPE_BASE,
"(objectclass=*)")
+ ent = topology_m2.ms["master1"].getEntry(dn, ldap.SCOPE_BASE,
"(objectclass=*)")
assert ent is not None
if ent.hasAttr(attribute) and (ent.getValue(attribute) == tested_value):
break
@@ -786,19 +667,19 @@ def test_check_repl_M2_to_M1(topology, moddn_setup):
time.sleep(1)
loop += 1
assert loop < 10
- topology.master1.log.info("Update %s (%s) replicated on M1" % (dn,
attribute))
+ topology_m2.ms["master1"].log.info("Update %s (%s) replicated on
M1" % (dn, attribute))
-def test_moddn_staging_prod_except(topology, moddn_setup):
+def test_moddn_staging_prod_except(topology_m2, moddn_setup):
"""This test case MOVE entry NEW_ACCOUNT13 from staging to prod
but fails to move entry NEW_ACCOUNT14 from staging to prod_except
"""
- topology.master1.log.info("\n\n######## MOVE staging -> Prod (13)
########\n")
- _bind_normal(topology)
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE staging ->
Prod (13) ########\n")
+ _bind_normal(topology_m2)
old_rdn = "cn=%s13" % NEW_ACCOUNT
- old_dn = "%s,%s" % (old_rdn, STAGING_DN)
+ old_dn = "%s,%s" % (old_rdn, STAGING_DN)
new_rdn = old_rdn
new_superior = PRODUCTION_DN
@@ -806,250 +687,252 @@ def test_moddn_staging_prod_except(topology, moddn_setup):
# Try to rename without the apropriate ACI => INSUFFICIENT_ACCESS
#
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
# successfull MOD with the ACI
- topology.master1.log.info("\n\n######## MOVE to and from equality filter
########\n")
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_ADD,
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE to and from
equality filter ########\n")
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_ADD,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _moddn_aci_deny_tree(topology, mod_type=ldap.MOD_ADD)
- _bind_normal(topology)
+ _moddn_aci_deny_tree(topology_m2, mod_type=ldap.MOD_ADD)
+ _bind_normal(topology_m2)
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn, new_rdn,
new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s -> %s,%s"
% (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
#
# Now try to move an entry under except
#
- topology.master1.log.info("\n\n######## MOVE staging -> Prod/Except (14)
########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## MOVE staging ->
Prod/Except (14) ########\n")
old_rdn = "cn=%s14" % NEW_ACCOUNT
- old_dn = "%s,%s" % (old_rdn, STAGING_DN)
+ old_dn = "%s,%s" % (old_rdn, STAGING_DN)
new_rdn = old_rdn
new_superior = PROD_EXCEPT_DN
try:
- topology.master1.log.info("Try to MODDN %s -> %s,%s" % (old_dn,
new_rdn, new_superior))
- topology.master1.rename_s(old_dn, new_rdn, newsuperior=new_superior)
+ topology_m2.ms["master1"].log.info("Try to MODDN %s ->
%s,%s" % (old_dn, new_rdn, new_superior))
+ topology_m2.ms["master1"].rename_s(old_dn, new_rdn,
newsuperior=new_superior)
assert 0
except AssertionError:
- topology.master1.log.info("Exception (not really expected exception but that
is fine as it fails to rename)")
+ topology_m2.ms["master1"].log.info(
+ "Exception (not really expected exception but that is fine as it fails
to rename)")
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
assert isinstance(e, ldap.INSUFFICIENT_ACCESS)
# successfull MOD with the both ACI
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_DELETE,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_DELETE,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _moddn_aci_deny_tree(topology, mod_type=ldap.MOD_DELETE)
- _bind_normal(topology)
+ _moddn_aci_deny_tree(topology_m2, mod_type=ldap.MOD_DELETE)
+ _bind_normal(topology_m2)
-def test_mode_default_ger_no_moddn(topology, moddn_setup):
- topology.master1.log.info("\n\n######## mode moddn_aci : GER no moddn
########\n")
+def test_mode_default_ger_no_moddn(topology_m2, moddn_setup):
+ topology_m2.ms["master1"].log.info("\n\n######## mode moddn_aci : GER
no moddn ########\n")
request_ctrl = GetEffectiveRightsControl(criticality=True, authzId="dn: " +
BIND_DN)
- msg_id = topology.master1.search_ext(PRODUCTION_DN,
- ldap.SCOPE_SUBTREE,
- "objectclass=*",
- serverctrls=[request_ctrl])
- rtype, rdata, rmsgid, response_ctrl = topology.master1.result3(msg_id)
- #ger={}
+ msg_id = topology_m2.ms["master1"].search_ext(PRODUCTION_DN,
+ ldap.SCOPE_SUBTREE,
+ "objectclass=*",
+ serverctrls=[request_ctrl])
+ rtype, rdata, rmsgid, response_ctrl =
topology_m2.ms["master1"].result3(msg_id)
+ # ger={}
value = ''
for dn, attrs in rdata:
- topology.master1.log.info("dn: %s" % dn)
+ topology_m2.ms["master1"].log.info("dn: %s" % dn)
value = attrs['entryLevelRights'][0]
- topology.master1.log.info("######## entryLevelRights: %r" % value)
+ topology_m2.ms["master1"].log.info("######## entryLevelRights:
%r" % value)
assert 'n' not in value
-def test_mode_default_ger_with_moddn(topology, moddn_setup):
+def test_mode_default_ger_with_moddn(topology_m2, moddn_setup):
"""This test case adds the moddn aci and check ger contains
'n'"""
- topology.master1.log.info("\n\n######## mode moddn_aci: GER with moddn
########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## mode moddn_aci: GER
with moddn ########\n")
# successfull MOD with the ACI
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_ADD,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_ADD,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
request_ctrl = GetEffectiveRightsControl(criticality=True, authzId="dn: " +
BIND_DN)
- msg_id = topology.master1.search_ext(PRODUCTION_DN,
- ldap.SCOPE_SUBTREE,
- "objectclass=*",
- serverctrls=[request_ctrl])
- rtype, rdata, rmsgid, response_ctrl = topology.master1.result3(msg_id)
- #ger={}
+ msg_id = topology_m2.ms["master1"].search_ext(PRODUCTION_DN,
+ ldap.SCOPE_SUBTREE,
+ "objectclass=*",
+ serverctrls=[request_ctrl])
+ rtype, rdata, rmsgid, response_ctrl =
topology_m2.ms["master1"].result3(msg_id)
+ # ger={}
value = ''
for dn, attrs in rdata:
- topology.master1.log.info("dn: %s" % dn)
+ topology_m2.ms["master1"].log.info("dn: %s" % dn)
value = attrs['entryLevelRights'][0]
- topology.master1.log.info("######## entryLevelRights: %r" % value)
+ topology_m2.ms["master1"].log.info("######## entryLevelRights:
%r" % value)
assert 'n' in value
# successfull MOD with the both ACI
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_DELETE,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_DELETE,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
-def test_mode_switch_default_to_legacy(topology, moddn_setup):
+def test_mode_switch_default_to_legacy(topology_m2, moddn_setup):
"""This test switch the server from default mode to
legacy"""
- topology.master1.log.info("\n\n######## Disable the moddn aci mod
########\n")
- _bind_manager(topology)
+ topology_m2.ms["master1"].log.info("\n\n######## Disable the moddn aci
mod ########\n")
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_REPLACE, CONFIG_MODDN_ACI_ATTR, 'off')]
- topology.master1.modify_s(DN_CONFIG, mod)
+ topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)
-def test_mode_legacy_ger_no_moddn1(topology, moddn_setup):
- topology.master1.log.info("\n\n######## mode legacy 1: GER no moddn
########\n")
+def test_mode_legacy_ger_no_moddn1(topology_m2, moddn_setup):
+ topology_m2.ms["master1"].log.info("\n\n######## mode legacy 1: GER no
moddn ########\n")
request_ctrl = GetEffectiveRightsControl(criticality=True, authzId="dn: " +
BIND_DN)
- msg_id = topology.master1.search_ext(PRODUCTION_DN,
- ldap.SCOPE_SUBTREE,
- "objectclass=*",
- serverctrls=[request_ctrl])
- rtype, rdata, rmsgid, response_ctrl = topology.master1.result3(msg_id)
- #ger={}
+ msg_id = topology_m2.ms["master1"].search_ext(PRODUCTION_DN,
+ ldap.SCOPE_SUBTREE,
+ "objectclass=*",
+ serverctrls=[request_ctrl])
+ rtype, rdata, rmsgid, response_ctrl =
topology_m2.ms["master1"].result3(msg_id)
+ # ger={}
value = ''
for dn, attrs in rdata:
- topology.master1.log.info("dn: %s" % dn)
+ topology_m2.ms["master1"].log.info("dn: %s" % dn)
value = attrs['entryLevelRights'][0]
- topology.master1.log.info("######## entryLevelRights: %r" % value)
+ topology_m2.ms["master1"].log.info("######## entryLevelRights:
%r" % value)
assert 'n' not in value
-def test_mode_legacy_ger_no_moddn2(topology, moddn_setup):
- topology.master1.log.info("\n\n######## mode legacy 2: GER no moddn
########\n")
+def test_mode_legacy_ger_no_moddn2(topology_m2, moddn_setup):
+ topology_m2.ms["master1"].log.info("\n\n######## mode legacy 2: GER no
moddn ########\n")
# successfull MOD with the ACI
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_ADD,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_ADD,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
request_ctrl = GetEffectiveRightsControl(criticality=True, authzId="dn: " +
BIND_DN)
- msg_id = topology.master1.search_ext(PRODUCTION_DN,
- ldap.SCOPE_SUBTREE,
- "objectclass=*",
- serverctrls=[request_ctrl])
- rtype, rdata, rmsgid, response_ctrl = topology.master1.result3(msg_id)
- #ger={}
+ msg_id = topology_m2.ms["master1"].search_ext(PRODUCTION_DN,
+ ldap.SCOPE_SUBTREE,
+ "objectclass=*",
+ serverctrls=[request_ctrl])
+ rtype, rdata, rmsgid, response_ctrl =
topology_m2.ms["master1"].result3(msg_id)
+ # ger={}
value = ''
for dn, attrs in rdata:
- topology.master1.log.info("dn: %s" % dn)
+ topology_m2.ms["master1"].log.info("dn: %s" % dn)
value = attrs['entryLevelRights'][0]
- topology.master1.log.info("######## entryLevelRights: %r" % value)
+ topology_m2.ms["master1"].log.info("######## entryLevelRights:
%r" % value)
assert 'n' not in value
# successfull MOD with the both ACI
- _bind_manager(topology)
- _moddn_aci_staging_to_production(topology, mod_type=ldap.MOD_DELETE,
+ _bind_manager(topology_m2)
+ _moddn_aci_staging_to_production(topology_m2, mod_type=ldap.MOD_DELETE,
target_from=STAGING_DN, target_to=PRODUCTION_DN)
- _bind_normal(topology)
+ _bind_normal(topology_m2)
-def test_mode_legacy_ger_with_moddn(topology, moddn_setup):
- topology.master1.log.info("\n\n######## mode legacy : GER with moddn
########\n")
+def test_mode_legacy_ger_with_moddn(topology_m2, moddn_setup):
+ topology_m2.ms["master1"].log.info("\n\n######## mode legacy : GER
with moddn ########\n")
# being allowed to read/write the RDN attribute use to allow the RDN
ACI_TARGET = "(target =
\"ldap:///%s\")(targetattr=\"cn\")" % (PRODUCTION_DN)
- ACI_ALLOW = "(version 3.0; acl \"MODDN production changing the RDN
attribute\"; allow (read,search,write)"
- ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
- ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
+ ACI_ALLOW = "(version 3.0; acl \"MODDN production changing the RDN
attribute\"; allow (read,search,write)"
+ ACI_SUBJECT = " userdn = \"ldap:///%s\";)" % BIND_DN
+ ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
# successfull MOD with the ACI
- _bind_manager(topology)
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
- topology.master1.modify_s(SUFFIX, mod)
- _bind_normal(topology)
+ topology_m2.ms["master1"].modify_s(SUFFIX, mod)
+ _bind_normal(topology_m2)
request_ctrl = GetEffectiveRightsControl(criticality=True, authzId="dn: " +
BIND_DN)
- msg_id = topology.master1.search_ext(PRODUCTION_DN,
- ldap.SCOPE_SUBTREE,
- "objectclass=*",
- serverctrls=[request_ctrl])
- rtype, rdata, rmsgid, response_ctrl = topology.master1.result3(msg_id)
- #ger={}
+ msg_id = topology_m2.ms["master1"].search_ext(PRODUCTION_DN,
+ ldap.SCOPE_SUBTREE,
+ "objectclass=*",
+ serverctrls=[request_ctrl])
+ rtype, rdata, rmsgid, response_ctrl =
topology_m2.ms["master1"].result3(msg_id)
+ # ger={}
value = ''
for dn, attrs in rdata:
- topology.master1.log.info("dn: %s" % dn)
+ topology_m2.ms["master1"].log.info("dn: %s" % dn)
value = attrs['entryLevelRights'][0]
- topology.master1.log.info("######## entryLevelRights: %r" % value)
+ topology_m2.ms["master1"].log.info("######## entryLevelRights:
%r" % value)
assert 'n' in value
# successfull MOD with the both ACI
- _bind_manager(topology)
+ _bind_manager(topology_m2)
mod = [(ldap.MOD_DELETE, 'aci', ACI_BODY)]
- topology.master1.modify_s(SUFFIX, mod)
- #_bind_normal(topology)
+ topology_m2.ms["master1"].modify_s(SUFFIX, mod)
+ # _bind_normal(topology_m2)
@pytest.fixture(scope="module")
-def rdn_write_setup(topology):
- topology.master1.log.info("\n\n######## Add entry tuser ########\n")
- topology.master1.add_s(Entry((SRC_ENTRY_DN, {
- 'objectclass': "top
person".split(),
- 'sn': SRC_ENTRY_CN,
- 'cn': SRC_ENTRY_CN})))
+def rdn_write_setup(topology_m2):
+ topology_m2.ms["master1"].log.info("\n\n######## Add entry tuser
########\n")
+ topology_m2.ms["master1"].add_s(Entry((SRC_ENTRY_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': SRC_ENTRY_CN,
+ 'cn': SRC_ENTRY_CN})))
-def test_rdn_write_get_ger(topology, rdn_write_setup):
+def test_rdn_write_get_ger(topology_m2, rdn_write_setup):
ANONYMOUS_DN = ""
- topology.master1.log.info("\n\n######## GER rights for anonymous
########\n")
+ topology_m2.ms["master1"].log.info("\n\n######## GER rights for
anonymous ########\n")
request_ctrl = GetEffectiveRightsControl(criticality=True,
authzId="dn:" + ANONYMOUS_DN)
- msg_id = topology.master1.search_ext(SUFFIX,
- ldap.SCOPE_SUBTREE,
- "objectclass=*",
- serverctrls=[request_ctrl])
- rtype, rdata, rmsgid, response_ctrl = topology.master1.result3(msg_id)
+ msg_id = topology_m2.ms["master1"].search_ext(SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ "objectclass=*",
+ serverctrls=[request_ctrl])
+ rtype, rdata, rmsgid, response_ctrl =
topology_m2.ms["master1"].result3(msg_id)
value = ''
for dn, attrs in rdata:
- topology.master1.log.info("dn: %s" % dn)
+ topology_m2.ms["master1"].log.info("dn: %s" % dn)
for value in attrs['entryLevelRights']:
- topology.master1.log.info("######## entryLevelRights: %r" %
value)
+ topology_m2.ms["master1"].log.info("########
entryLevelRights: %r" % value)
assert 'n' not in value
-def test_rdn_write_modrdn_anonymous(topology, rdn_write_setup):
+def test_rdn_write_modrdn_anonymous(topology_m2, rdn_write_setup):
ANONYMOUS_DN = ""
- topology.master1.close()
- topology.master1.binddn = ANONYMOUS_DN
- topology.master1.open()
- msg_id = topology.master1.search_ext("", ldap.SCOPE_BASE,
"objectclass=*")
- rtype, rdata, rmsgid, response_ctrl = topology.master1.result3(msg_id)
+ topology_m2.ms["master1"].close()
+ topology_m2.ms["master1"].binddn = ANONYMOUS_DN
+ topology_m2.ms["master1"].open()
+ msg_id = topology_m2.ms["master1"].search_ext("",
ldap.SCOPE_BASE, "objectclass=*")
+ rtype, rdata, rmsgid, response_ctrl =
topology_m2.ms["master1"].result3(msg_id)
for dn, attrs in rdata:
- topology.master1.log.info("dn: %s" % dn)
+ topology_m2.ms["master1"].log.info("dn: %s" % dn)
for attr in attrs:
- topology.master1.log.info("######## %r: %r" % (attr,
attrs[attr]))
+ topology_m2.ms["master1"].log.info("######## %r: %r" %
(attr, attrs[attr]))
try:
- topology.master1.rename_s(SRC_ENTRY_DN, "cn=%s" % DST_ENTRY_CN,
delold=True)
+ topology_m2.ms["master1"].rename_s(SRC_ENTRY_DN, "cn=%s" %
DST_ENTRY_CN, delold=True)
except Exception as e:
- topology.master1.log.info("Exception (expected): %s" %
type(e).__name__)
+ topology_m2.ms["master1"].log.info("Exception (expected): %s"
% type(e).__name__)
isinstance(e, ldap.INSUFFICIENT_ACCESS)
try:
- topology.master1.getEntry(DST_ENTRY_DN, ldap.SCOPE_BASE,
"objectclass=*")
+ topology_m2.ms["master1"].getEntry(DST_ENTRY_DN, ldap.SCOPE_BASE,
"objectclass=*")
assert False
except Exception as e:
- topology.master1.log.info("The entry was not renamed (expected)")
+ topology_m2.ms["master1"].log.info("The entry was not renamed
(expected)")
isinstance(e, ldap.NO_SUCH_OBJECT)
- _bind_manager(topology)
+ _bind_manager(topology_m2)
if __name__ == '__main__':
diff --git a/dirsrvtests/tests/suites/attr_encryption/attr_encrypt_test.py
b/dirsrvtests/tests/suites/attr_encryption/attr_encrypt_test.py
deleted file mode 100644
index 6116aed..0000000
--- a/dirsrvtests/tests/suites/attr_encryption/attr_encrypt_test.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_attr_encrypt_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_attr_encrypt_(topology):
- '''
- Write a single test here...
- '''
- log.info('attr_encrypt test suite PASSED')
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
b/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
index 6550f43..5da6fe3 100644
--- a/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
+++ b/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
@@ -15,72 +15,37 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
USER1_DN = 'uid=user1,' + DEFAULT_SUFFIX
USER2_DN = 'uid=user2,' + DEFAULT_SUFFIX
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
-def test_attr_uniqueness_init(topology):
+def test_attr_uniqueness_init(topology_st):
'''
Enable dynamic plugins - makes things easier
'''
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
ldap.fatal('Failed to enable dynamic plugin!' +
e.message['desc'])
assert False
- topology.standalone.plugins.enable(name=PLUGIN_ATTR_UNIQUENESS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_ATTR_UNIQUENESS)
-def test_attr_uniqueness(topology):
+def test_attr_uniqueness(topology_st):
log.info('Running test_attr_uniqueness...')
#
# Configure plugin
#
try:
- topology.standalone.modify_s('cn=' + PLUGIN_ATTR_UNIQUENESS +
',cn=plugins,cn=config',
- [(ldap.MOD_REPLACE, 'uniqueness-attribute-name',
'uid')])
+ topology_st.standalone.modify_s('cn=' + PLUGIN_ATTR_UNIQUENESS +
',cn=plugins,cn=config',
+ [(ldap.MOD_REPLACE,
'uniqueness-attribute-name', 'uid')])
except ldap.LDAPError as e:
log.fatal('test_attr_uniqueness: Failed to configure plugin for
"uid": error ' + e.message['desc'])
@@ -88,25 +53,25 @@ def test_attr_uniqueness(topology):
# Add an entry
try:
- topology.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '1',
- 'cn': 'user 1',
- 'uid': 'user1',
- 'mail': 'user1(a)example.com',
- 'mailAlternateAddress':
'user1(a)alt.example.com',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '1',
+ 'cn': 'user 1',
+ 'uid': 'user1',
+ 'mail':
'user1(a)example.com',
+ 'mailAlternateAddress':
'user1(a)alt.example.com',
+ 'userpassword':
'password'})))
except ldap.LDAPError as e:
log.fatal('test_attr_uniqueness: Failed to add test user' + USER1_DN +
': error ' + e.message['desc'])
assert False
# Add an entry with a duplicate "uid"
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user 2',
- 'uid': 'user2',
- 'uid': 'user1',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'uid': 'user1',
+ 'userpassword':
'password'})))
except ldap.CONSTRAINT_VIOLATION:
pass
else:
@@ -117,8 +82,8 @@ def test_attr_uniqueness(topology):
# Change config to use "mail" instead of "uid"
#
try:
- topology.standalone.modify_s('cn=' + PLUGIN_ATTR_UNIQUENESS +
',cn=plugins,cn=config',
- [(ldap.MOD_REPLACE, 'uniqueness-attribute-name',
'mail')])
+ topology_st.standalone.modify_s('cn=' + PLUGIN_ATTR_UNIQUENESS +
',cn=plugins,cn=config',
+ [(ldap.MOD_REPLACE,
'uniqueness-attribute-name', 'mail')])
except ldap.LDAPError as e:
log.fatal('test_attr_uniqueness: Failed to configure plugin for
"mail": error ' + e.message['desc'])
@@ -128,12 +93,12 @@ def test_attr_uniqueness(topology):
# Test plugin - Add an entry, that has a duplicate "mail" value
#
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user 2',
- 'uid': 'user2',
- 'mail': 'user1(a)example.com',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'mail':
'user1(a)example.com',
+ 'userpassword':
'password'})))
except ldap.CONSTRAINT_VIOLATION:
pass
else:
@@ -144,10 +109,10 @@ def test_attr_uniqueness(topology):
# Reconfigure plugin for mail and mailAlternateAddress
#
try:
- topology.standalone.modify_s('cn=' + PLUGIN_ATTR_UNIQUENESS +
',cn=plugins,cn=config',
- [(ldap.MOD_REPLACE, 'uniqueness-attribute-name',
'mail'),
- (ldap.MOD_ADD, 'uniqueness-attribute-name',
- 'mailAlternateAddress')])
+ topology_st.standalone.modify_s('cn=' + PLUGIN_ATTR_UNIQUENESS +
',cn=plugins,cn=config',
+ [(ldap.MOD_REPLACE,
'uniqueness-attribute-name', 'mail'),
+ (ldap.MOD_ADD,
'uniqueness-attribute-name',
+ 'mailAlternateAddress')])
except ldap.LDAPError as e:
log.error('test_attr_uniqueness: Failed to reconfigure plugin for "mail
mailAlternateAddress": error ' +
e.message['desc'])
@@ -157,12 +122,12 @@ def test_attr_uniqueness(topology):
# Test plugin - Add an entry, that has a duplicate "mail" value
#
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user 2',
- 'uid': 'user2',
- 'mail': 'user1(a)example.com',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'mail':
'user1(a)example.com',
+ 'userpassword':
'password'})))
except ldap.CONSTRAINT_VIOLATION:
pass
else:
@@ -173,12 +138,12 @@ def test_attr_uniqueness(topology):
# Test plugin - Add an entry, that has a duplicate "mailAlternateAddress"
value
#
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user 2',
- 'uid': 'user2',
- 'mailAlternateAddress':
'user1(a)alt.example.com',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'mailAlternateAddress':
'user1(a)alt.example.com',
+ 'userpassword':
'password'})))
except ldap.CONSTRAINT_VIOLATION:
pass
else:
@@ -189,12 +154,12 @@ def test_attr_uniqueness(topology):
# Test plugin - Add an entry, that has a duplicate "mail" value conflicting
mailAlternateAddress
#
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user 2',
- 'uid': 'user2',
- 'mail': 'user1(a)alt.example.com',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'mail':
'user1(a)alt.example.com',
+ 'userpassword':
'password'})))
except ldap.CONSTRAINT_VIOLATION:
pass
else:
@@ -205,12 +170,12 @@ def test_attr_uniqueness(topology):
# Test plugin - Add an entry, that has a duplicate "mailAlternateAddress"
conflicting mail
#
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user 2',
- 'uid': 'user2',
- 'mailAlternateAddress':
'user1(a)example.com',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'mailAlternateAddress':
'user1(a)example.com',
+ 'userpassword':
'password'})))
except ldap.CONSTRAINT_VIOLATION:
pass
else:
@@ -221,7 +186,7 @@ def test_attr_uniqueness(topology):
# Cleanup
#
try:
- topology.standalone.delete_s(USER1_DN)
+ topology_st.standalone.delete_s(USER1_DN)
except ldap.LDAPError as e:
log.fatal('test_attr_uniqueness: Failed to delete test entry: ' +
e.message['desc'])
assert False
diff --git a/dirsrvtests/tests/suites/automember_plugin/automember_test.py
b/dirsrvtests/tests/suites/automember_plugin/automember_test.py
deleted file mode 100644
index f3a1113..0000000
--- a/dirsrvtests/tests/suites/automember_plugin/automember_test.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_automember_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_automember_(topology):
- '''
- Write a single test here...
- '''
- log.info('automember test suite PASSED')
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/basic/basic_test.py
b/dirsrvtests/tests/suites/basic/basic_test.py
index 209bab9..82cd8e5 100644
--- a/dirsrvtests/tests/suites/basic/basic_test.py
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -21,6 +21,7 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
log = logging.getLogger(__name__)
@@ -37,72 +38,32 @@ ROOTDSE_DEF_ATTR_LIST = ('namingContexts',
'vendorName',
'vendorVersion')
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
@pytest.fixture(scope="module")
-def topology(request):
- """This fixture is used to standalone topology for the
'module'."""
-
- standalone = DirSrv(verbose=False)
-
- # Args for the standalone instance
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
-
- # Get the status of the instance and restart it if it exists
- instance_standalone = standalone.exists()
-
- # Remove the instance
- if instance_standalone:
- standalone.delete()
-
- # Create the instance
- standalone.create()
-
- # Used to retrieve configuration information (dbdir, confdir...)
- standalone.open()
-
- # Delete each instance in the end
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- # Here we have standalone instance up and running
- return TopologyStandalone(standalone)
-
-
-(a)pytest.fixture(scope="module")
-def import_example_ldif(topology):
+def import_example_ldif(topology_st):
"""Import the Example LDIF for the tests in this
suite"""
log.info('Initializing the "basic" test suite')
- ldif = '%s/Example.ldif' % get_data_dir(topology.standalone.prefix)
- import_ldif = topology.standalone.get_ldif_dir() + "/Example.ldif"
+ ldif = '%s/Example.ldif' % get_data_dir(topology_st.standalone.prefix)
+ import_ldif = topology_st.standalone.get_ldif_dir() + "/Example.ldif"
shutil.copyfile(ldif, import_ldif)
try:
- topology.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
- input_file=import_ldif,
- args={TASK_WAIT: True})
+ topology_st.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
+ input_file=import_ldif,
+ args={TASK_WAIT: True})
except ValueError:
log.error('Online import failed')
assert False
@pytest.fixture(params=ROOTDSE_DEF_ATTR_LIST)
-def rootdse_attr(topology, request):
+def rootdse_attr(topology_st, request):
"""Adds an attr from the list
as the default attr to the rootDSE
"""
# Ensure the server is started and connected
- topology.standalone.start()
+ topology_st.standalone.start()
RETURN_DEFAULT_OPATTR = "nsslapd-return-default-opattr"
rootdse_attr_name = request.param
@@ -111,7 +72,7 @@ def rootdse_attr(topology, request):
rootdse_attr_name))
mod = [(ldap.MOD_ADD, RETURN_DEFAULT_OPATTR, rootdse_attr_name)]
try:
- topology.standalone.modify_s("", mod)
+ topology_st.standalone.modify_s("", mod)
except ldap.LDAPError as e:
log.fatal('Failed to add attr: error (%s)' %
(e.message['desc']))
assert False
@@ -121,16 +82,17 @@ def rootdse_attr(topology, request):
rootdse_attr_name))
mod = [(ldap.MOD_DELETE, RETURN_DEFAULT_OPATTR, rootdse_attr_name)]
try:
- topology.standalone.modify_s("", mod)
+ topology_st.standalone.modify_s("", mod)
except ldap.LDAPError as e:
log.fatal('Failed to delete attr: error (%s)' %
(e.message['desc']))
assert False
+
request.addfinalizer(fin)
return rootdse_attr_name
-def test_basic_ops(topology, import_example_ldif):
+def test_basic_ops(topology_st, import_example_ldif):
"""Test doing adds, mods, modrdns, and deletes"""
log.info('Running test_basic_ops...')
@@ -147,34 +109,34 @@ def test_basic_ops(topology, import_example_ldif):
# Adds
#
try:
- topology.standalone.add_s(Entry((USER1_DN,
- {'objectclass': "top
extensibleObject".split(),
- 'sn': '1',
- 'cn': 'user1',
- 'uid': 'user1',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER1_DN,
+ {'objectclass': "top
extensibleObject".split(),
+ 'sn': '1',
+ 'cn': 'user1',
+ 'uid': 'user1',
+ 'userpassword':
'password'})))
except ldap.LDAPError as e:
log.error('Failed to add test user' + USER1_DN + ': error ' +
e.message['desc'])
assert False
try:
- topology.standalone.add_s(Entry((USER2_DN,
- {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user2',
- 'uid': 'user2',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER2_DN,
+ {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user2',
+ 'uid': 'user2',
+ 'userpassword':
'password'})))
except ldap.LDAPError as e:
log.error('Failed to add test user' + USER2_DN + ': error ' +
e.message['desc'])
assert False
try:
- topology.standalone.add_s(Entry((USER3_DN,
- {'objectclass': "top
extensibleObject".split(),
- 'sn': '3',
- 'cn': 'user3',
- 'uid': 'user3',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER3_DN,
+ {'objectclass': "top
extensibleObject".split(),
+ 'sn': '3',
+ 'cn': 'user3',
+ 'uid': 'user3',
+ 'userpassword':
'password'})))
except ldap.LDAPError as e:
log.error('Failed to add test user' + USER3_DN + ': error ' +
e.message['desc'])
assert False
@@ -183,22 +145,22 @@ def test_basic_ops(topology, import_example_ldif):
# Mods
#
try:
- topology.standalone.modify_s(USER1_DN, [(ldap.MOD_ADD, 'description',
- 'New description')])
+ topology_st.standalone.modify_s(USER1_DN, [(ldap.MOD_ADD, 'description',
+ 'New description')])
except ldap.LDAPError as e:
log.error('Failed to add description: error ' +
e.message['desc'])
assert False
try:
- topology.standalone.modify_s(USER1_DN, [(ldap.MOD_REPLACE,
'description',
- 'Modified description')])
+ topology_st.standalone.modify_s(USER1_DN, [(ldap.MOD_REPLACE,
'description',
+ 'Modified description')])
except ldap.LDAPError as e:
log.error('Failed to modify description: error ' +
e.message['desc'])
assert False
try:
- topology.standalone.modify_s(USER1_DN, [(ldap.MOD_DELETE, 'description',
- None)])
+ topology_st.standalone.modify_s(USER1_DN, [(ldap.MOD_DELETE,
'description',
+ None)])
except ldap.LDAPError as e:
log.error('Failed to delete description: error ' +
e.message['desc'])
assert False
@@ -207,21 +169,21 @@ def test_basic_ops(topology, import_example_ldif):
# Modrdns
#
try:
- topology.standalone.rename_s(USER1_DN, USER1_NEWDN, delold=1)
+ topology_st.standalone.rename_s(USER1_DN, USER1_NEWDN, delold=1)
except ldap.LDAPError as e:
log.error('Failed to modrdn user1: error ' + e.message['desc'])
assert False
try:
- topology.standalone.rename_s(USER2_DN, USER2_NEWDN, delold=0)
+ topology_st.standalone.rename_s(USER2_DN, USER2_NEWDN, delold=0)
except ldap.LDAPError as e:
log.error('Failed to modrdn user2: error ' + e.message['desc'])
assert False
# Modrdn - New superior
try:
- topology.standalone.rename_s(USER3_DN, USER3_NEWDN,
- newsuperior=NEW_SUPERIOR, delold=1)
+ topology_st.standalone.rename_s(USER3_DN, USER3_NEWDN,
+ newsuperior=NEW_SUPERIOR, delold=1)
except ldap.LDAPError as e:
log.error('Failed to modrdn(new superior) user3: error ' +
e.message['desc'])
assert False
@@ -230,19 +192,19 @@ def test_basic_ops(topology, import_example_ldif):
# Deletes
#
try:
- topology.standalone.delete_s(USER1_RDN_DN)
+ topology_st.standalone.delete_s(USER1_RDN_DN)
except ldap.LDAPError as e:
log.error('Failed to delete test entry1: ' + e.message['desc'])
assert False
try:
- topology.standalone.delete_s(USER2_RDN_DN)
+ topology_st.standalone.delete_s(USER2_RDN_DN)
except ldap.LDAPError as e:
log.error('Failed to delete test entry2: ' + e.message['desc'])
assert False
try:
- topology.standalone.delete_s(USER3_RDN_DN)
+ topology_st.standalone.delete_s(USER3_RDN_DN)
except ldap.LDAPError as e:
log.error('Failed to delete test entry3: ' + e.message['desc'])
assert False
@@ -250,7 +212,7 @@ def test_basic_ops(topology, import_example_ldif):
log.info('test_basic_ops: PASSED')
-def test_basic_import_export(topology, import_example_ldif):
+def test_basic_import_export(topology_st, import_example_ldif):
"""Test online and offline LDIF imports &
exports"""
log.info('Running test_basic_import_export...')
@@ -262,10 +224,10 @@ def test_basic_import_export(topology, import_example_ldif):
#
# Generate a test ldif (50k entries)
- ldif_dir = topology.standalone.get_ldif_dir()
+ ldif_dir = topology_st.standalone.get_ldif_dir()
import_ldif = ldif_dir + '/basic_import.ldif'
try:
- topology.standalone.buildLDIF(50000, import_ldif)
+ topology_st.standalone.buildLDIF(50000, import_ldif)
except OSError as e:
log.fatal('test_basic_import_export: failed to create test ldif,\
error: %s - %s' % (e.errno, e.strerror))
@@ -273,15 +235,15 @@ def test_basic_import_export(topology, import_example_ldif):
# Online
try:
- topology.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
- input_file=import_ldif,
- args={TASK_WAIT: True})
+ topology_st.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
+ input_file=import_ldif,
+ args={TASK_WAIT: True})
except ValueError:
log.fatal('test_basic_import_export: Online import failed')
assert False
# Offline
- if not topology.standalone.ldif2db(DEFAULT_BENAME, None, None, None, import_ldif):
+ if not topology_st.standalone.ldif2db(DEFAULT_BENAME, None, None, None,
import_ldif):
log.fatal('test_basic_import_export: Offline import failed')
assert False
@@ -291,7 +253,7 @@ def test_basic_import_export(topology, import_example_ldif):
# Online export
export_ldif = ldif_dir + '/export.ldif'
- exportTask = Tasks(topology.standalone)
+ exportTask = Tasks(topology_st.standalone)
try:
args = {TASK_WAIT: True}
exportTask.exportLDIF(DEFAULT_SUFFIX, None, export_ldif, args)
@@ -300,21 +262,21 @@ def test_basic_import_export(topology, import_example_ldif):
assert False
# Offline export
- if not topology.standalone.db2ldif(DEFAULT_BENAME, (DEFAULT_SUFFIX,),
- None, None, None, export_ldif):
+ if not topology_st.standalone.db2ldif(DEFAULT_BENAME, (DEFAULT_SUFFIX,),
+ None, None, None, export_ldif):
log.fatal('test_basic_import_export: Failed to run offline db2ldif')
assert False
#
# Cleanup - Import the Example LDIF for the other tests in this suite
#
- ldif = '%s/Example.ldif' % get_data_dir(topology.standalone.prefix)
- import_ldif = topology.standalone.get_ldif_dir() + "/Example.ldif"
+ ldif = '%s/Example.ldif' % get_data_dir(topology_st.standalone.prefix)
+ import_ldif = topology_st.standalone.get_ldif_dir() + "/Example.ldif"
shutil.copyfile(ldif, import_ldif)
try:
- topology.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
- input_file=import_ldif,
- args={TASK_WAIT: True})
+ topology_st.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
+ input_file=import_ldif,
+ args={TASK_WAIT: True})
except ValueError:
log.fatal('test_basic_import_export: Online import failed')
assert False
@@ -322,43 +284,43 @@ def test_basic_import_export(topology, import_example_ldif):
log.info('test_basic_import_export: PASSED')
-def test_basic_backup(topology, import_example_ldif):
+def test_basic_backup(topology_st, import_example_ldif):
"""Test online and offline back and restore"""
log.info('Running test_basic_backup...')
- backup_dir = topology.standalone.get_bak_dir() + '/backup_test'
+ backup_dir = topology_st.standalone.get_bak_dir() + '/backup_test'
# Test online backup
try:
- topology.standalone.tasks.db2bak(backup_dir=backup_dir,
- args={TASK_WAIT: True})
+ topology_st.standalone.tasks.db2bak(backup_dir=backup_dir,
+ args={TASK_WAIT: True})
except ValueError:
log.fatal('test_basic_backup: Online backup failed')
assert False
# Test online restore
try:
- topology.standalone.tasks.bak2db(backup_dir=backup_dir,
- args={TASK_WAIT: True})
+ topology_st.standalone.tasks.bak2db(backup_dir=backup_dir,
+ args={TASK_WAIT: True})
except ValueError:
log.fatal('test_basic_backup: Online restore failed')
assert False
# Test offline backup
- if not topology.standalone.db2bak(backup_dir):
+ if not topology_st.standalone.db2bak(backup_dir):
log.fatal('test_basic_backup: Offline backup failed')
assert False
# Test offline restore
- if not topology.standalone.bak2db(backup_dir):
+ if not topology_st.standalone.bak2db(backup_dir):
log.fatal('test_basic_backup: Offline backup failed')
assert False
log.info('test_basic_backup: PASSED')
-def test_basic_acl(topology, import_example_ldif):
+def test_basic_acl(topology_st, import_example_ldif):
"""Run some basic access control(ACL) tests"""
log.info('Running test_basic_acl...')
@@ -370,24 +332,24 @@ def test_basic_acl(topology, import_example_ldif):
# Add two users
#
try:
- topology.standalone.add_s(Entry((USER1_DN,
- {'objectclass': "top
extensibleObject".split(),
- 'sn': '1',
- 'cn': 'user 1',
- 'uid': 'user1',
- 'userpassword': PASSWORD})))
+ topology_st.standalone.add_s(Entry((USER1_DN,
+ {'objectclass': "top
extensibleObject".split(),
+ 'sn': '1',
+ 'cn': 'user 1',
+ 'uid': 'user1',
+ 'userpassword': PASSWORD})))
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to add test user ' + USER1_DN
+ ': error ' + e.message['desc'])
assert False
try:
- topology.standalone.add_s(Entry((USER2_DN,
- {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'user 2',
- 'uid': 'user2',
- 'userpassword': PASSWORD})))
+ topology_st.standalone.add_s(Entry((USER2_DN,
+ {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'userpassword': PASSWORD})))
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to add test user ' + USER1_DN
+ ': error ' + e.message['desc'])
@@ -398,7 +360,7 @@ def test_basic_acl(topology, import_example_ldif):
# and also set the default anonymous access
#
try:
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci',
DENY_ACI)])
+ topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci',
DENY_ACI)])
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to add DENY ACI: error ' +
e.message['desc'])
assert False
@@ -407,15 +369,15 @@ def test_basic_acl(topology, import_example_ldif):
# Make sure USER1_DN can not search anything, but USER2_dn can...
#
try:
- topology.standalone.simple_bind_s(USER1_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER1_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to bind as user1, error: ' +
e.message['desc'])
assert False
try:
- entries = topology.standalone.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- '(uid=*)')
+ entries = topology_st.standalone.search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ '(uid=*)')
if entries:
log.fatal('test_basic_acl: User1 was incorrectly able to search the
suffix!')
assert False
@@ -425,15 +387,15 @@ def test_basic_acl(topology, import_example_ldif):
# Now try user2... Also check that userpassword is stripped out
try:
- topology.standalone.simple_bind_s(USER2_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER2_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to bind as user2, error: ' +
e.message['desc'])
assert False
try:
- entries = topology.standalone.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- '(uid=user1)')
+ entries = topology_st.standalone.search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ '(uid=user1)')
if not entries:
log.fatal('test_basic_acl: User1 incorrectly not able to search the
suffix')
assert False
@@ -448,15 +410,15 @@ def test_basic_acl(topology, import_example_ldif):
# Make sure Root DN can also search (this also resets the bind dn to the
# Root DN for future operations)
try:
- topology.standalone.simple_bind_s(DN_DM, PW_DM)
+ topology_st.standalone.simple_bind_s(DN_DM, PW_DM)
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to bind as ROotDN, error: ' +
e.message['desc'])
assert False
try:
- entries = topology.standalone.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- '(uid=*)')
+ entries = topology_st.standalone.search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ '(uid=*)')
if not entries:
log.fatal('test_basic_acl: Root DN incorrectly not able to search the
suffix')
assert False
@@ -468,19 +430,19 @@ def test_basic_acl(topology, import_example_ldif):
# Cleanup
#
try:
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_DELETE, 'aci',
DENY_ACI)])
+ topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_DELETE, 'aci',
DENY_ACI)])
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to delete DENY ACI: error ' +
e.message['desc'])
assert False
try:
- topology.standalone.delete_s(USER1_DN)
+ topology_st.standalone.delete_s(USER1_DN)
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to delete test entry1: ' +
e.message['desc'])
assert False
try:
- topology.standalone.delete_s(USER2_DN)
+ topology_st.standalone.delete_s(USER2_DN)
except ldap.LDAPError as e:
log.fatal('test_basic_acl: Failed to delete test entry2: ' +
e.message['desc'])
assert False
@@ -488,7 +450,7 @@ def test_basic_acl(topology, import_example_ldif):
log.info('test_basic_acl: PASSED')
-def test_basic_searches(topology, import_example_ldif):
+def test_basic_searches(topology_st, import_example_ldif):
"""The search results are gathered from testing with
Example.ldif"""
log.info('Running test_basic_searches...')
@@ -512,9 +474,9 @@ def test_basic_searches(topology, import_example_ldif):
for (search_filter, search_result) in filters:
try:
- entries = topology.standalone.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_filter)
+ entries = topology_st.standalone.search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_filter)
if len(entries) != search_result:
log.fatal('test_basic_searches: An incorrect number of entries\
was returned from filter (%s): (%d) expected (%d)' %
@@ -527,7 +489,7 @@ def test_basic_searches(topology, import_example_ldif):
log.info('test_basic_searches: PASSED')
-def test_basic_referrals(topology, import_example_ldif):
+def test_basic_referrals(topology_st, import_example_ldif):
"""Set the server to referral mode,
and make sure we recive the referal error(10)
"""
@@ -540,17 +502,17 @@ def test_basic_referrals(topology, import_example_ldif):
# Set the referral, adn the backend state
#
try:
- topology.standalone.modify_s(SUFFIX_CONFIG,
- [(ldap.MOD_REPLACE,
- 'nsslapd-referral',
-
'ldap://localhost.localdomain:389/o%3dnetscaperoot')])
+ topology_st.standalone.modify_s(SUFFIX_CONFIG,
+ [(ldap.MOD_REPLACE,
+ 'nsslapd-referral',
+
'ldap://localhost.localdomain:389/o%3dnetscaperoot')])
except ldap.LDAPError as e:
log.fatal('test_basic_referrals: Failed to set referral: error ' +
e.message['desc'])
assert False
try:
- topology.standalone.modify_s(SUFFIX_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-state',
'Referral')])
+ topology_st.standalone.modify_s(SUFFIX_CONFIG, [(ldap.MOD_REPLACE,
+ 'nsslapd-state',
'Referral')])
except ldap.LDAPError as e:
log.fatal('test_basic_referrals: Failed to set backend state: error '
+ e.message['desc'])
@@ -559,9 +521,9 @@ def test_basic_referrals(topology, import_example_ldif):
#
# Test that a referral error is returned
#
- topology.standalone.set_option(ldap.OPT_REFERRALS, 0) # Do not follow referral
+ topology_st.standalone.set_option(ldap.OPT_REFERRALS, 0) # Do not follow referral
try:
- topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
'objectclass=top')
+ topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
'objectclass=top')
except ldap.REFERRAL:
pass
except ldap.LDAPError as e:
@@ -571,52 +533,52 @@ def test_basic_referrals(topology, import_example_ldif):
#
# Make sure server can restart in referral mode
#
- topology.standalone.restart(timeout=10)
+ topology_st.standalone.restart(timeout=10)
#
# Cleanup
#
try:
- topology.standalone.modify_s(SUFFIX_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-state',
'Backend')])
+ topology_st.standalone.modify_s(SUFFIX_CONFIG, [(ldap.MOD_REPLACE,
+ 'nsslapd-state',
'Backend')])
except ldap.LDAPError as e:
log.fatal('test_basic_referrals: Failed to set backend state: error '
+ e.message['desc'])
assert False
try:
- topology.standalone.modify_s(SUFFIX_CONFIG, [(ldap.MOD_DELETE,
- 'nsslapd-referral',
None)])
+ topology_st.standalone.modify_s(SUFFIX_CONFIG, [(ldap.MOD_DELETE,
+ 'nsslapd-referral',
None)])
except ldap.LDAPError as e:
log.fatal('test_basic_referrals: Failed to delete referral: error '
+ e.message['desc'])
assert False
- topology.standalone.set_option(ldap.OPT_REFERRALS, 1)
+ topology_st.standalone.set_option(ldap.OPT_REFERRALS, 1)
log.info('test_basic_referrals: PASSED')
-def test_basic_systemctl(topology, import_example_ldif):
+def test_basic_systemctl(topology_st, import_example_ldif):
"""Test systemctl/lib389 can stop and start the server. Also test
that start reports an
error when the instance does not start. Only for RPM builds
"""
log.info('Running test_basic_systemctl...')
- config_dir = topology.standalone.get_config_dir()
+ config_dir = topology_st.standalone.get_config_dir()
#
# Stop the server
#
log.info('Stopping the server...')
- topology.standalone.stop()
+ topology_st.standalone.stop()
log.info('Stopped the server.')
#
# Start the server
#
log.info('Starting the server...')
- topology.standalone.start()
+ topology_st.standalone.start()
log.info('Started the server.')
#
@@ -624,21 +586,21 @@ def test_basic_systemctl(topology, import_example_ldif):
# and verify that systemctl detects the failed start
#
log.info('Stopping the server...')
- topology.standalone.stop()
+ topology_st.standalone.stop()
log.info('Stopped the server before breaking the dse.ldif.')
- shutil.copy(config_dir + '/dse.ldif', config_dir +
'/dse.ldif.correct' )
+ shutil.copy(config_dir + '/dse.ldif', config_dir +
'/dse.ldif.correct')
open(config_dir + '/dse.ldif', 'w').close()
# We need to kill the .bak file too, DS is just too smart!
open(config_dir + '/dse.ldif.bak', 'w').close()
log.info('Attempting to start the server with broken dse.ldif...')
try:
- topology.standalone.start()
+ topology_st.standalone.start()
except:
log.info('Server failed to start as expected')
log.info('Check the status...')
- assert(not topology.standalone.status())
+ assert (not topology_st.standalone.status())
log.info('Server failed to start as expected')
time.sleep(5)
@@ -646,29 +608,29 @@ def test_basic_systemctl(topology, import_example_ldif):
# Fix the dse.ldif, and make sure the server starts up,
# and systemctl correctly identifies the successful start
#
- shutil.copy(config_dir + '/dse.ldif.correct', config_dir +
'/dse.ldif' )
+ shutil.copy(config_dir + '/dse.ldif.correct', config_dir +
'/dse.ldif')
log.info('Starting the server with good dse.ldif...')
- topology.standalone.start()
+ topology_st.standalone.start()
log.info('Check the status...')
- assert(topology.standalone.status())
+ assert (topology_st.standalone.status())
log.info('Server started after fixing dse.ldif.')
log.info('test_basic_systemctl: PASSED')
-def test_basic_ldapagent(topology, import_example_ldif):
+def test_basic_ldapagent(topology_st, import_example_ldif):
"""Test that the ldap agent starts"""
log.info('Running test_basic_ldapagent...')
- var_dir = topology.standalone.get_local_state_dir()
- config_file = os.path.join(topology.standalone.get_sysconf_dir(),
'dirsrv/config/agent.conf')
- cmd = 'sudo %s %s' % (os.path.join(topology.standalone.get_sbin_dir(),
'ldap-agent'), config_file)
+ var_dir = topology_st.standalone.get_local_state_dir()
+ config_file = os.path.join(topology_st.standalone.get_sysconf_dir(),
'dirsrv/config/agent.conf')
+ cmd = 'sudo %s %s' % (os.path.join(topology_st.standalone.get_sbin_dir(),
'ldap-agent'), config_file)
agent_config_file = open(config_file, 'w')
agent_config_file.write('agentx-master ' + var_dir +
'/agentx/master\n')
agent_config_file.write('agent-logdir ' + var_dir + '/log/dirsrv\n')
- agent_config_file.write('server slapd-' + topology.standalone.serverid +
'\n')
+ agent_config_file.write('server slapd-' + topology_st.standalone.serverid +
'\n')
agent_config_file.close()
rc = os.system(cmd)
@@ -688,37 +650,37 @@ def test_basic_ldapagent(topology, import_example_ldif):
log.info('test_basic_ldapagent: PASSED')
-def test_basic_dse(topology, import_example_ldif):
+def test_basic_dse(topology_st, import_example_ldif):
"""Test that the dse.ldif is not wipped out
after the process is killed (bug 910581)
"""
log.info('Running test_basic_dse...')
- dse_file = topology.standalone.confdir + '/dse.ldif'
+ dse_file = topology_st.standalone.confdir + '/dse.ldif'
pid = check_output(['pidof', '-s', 'ns-slapd'])
os.system('sudo kill -9 ' + pid)
if os.path.getsize(dse_file) == 0:
log.fatal('test_basic_dse: dse.ldif\'s content was incorrectly
removed!')
assert False
- topology.standalone.start(timeout=60)
+ topology_st.standalone.start(timeout=60)
log.info('dse.ldif was not corrupted, and the server was restarted')
log.info('test_basic_dse: PASSED')
@pytest.mark.parametrize("rootdse_attr_name", ROOTDSE_DEF_ATTR_LIST)
-def test_def_rootdse_attr(topology, import_example_ldif, rootdse_attr_name):
+def test_def_rootdse_attr(topology_st, import_example_ldif, rootdse_attr_name):
"""Tests that operational attributes
are not returned by default in rootDSE searches
"""
- topology.standalone.start()
+ topology_st.standalone.start()
log.info(" Assert rootdse search hasn't %s attr" %
rootdse_attr_name)
try:
- entries = topology.standalone.search_s("", ldap.SCOPE_BASE)
+ entries = topology_st.standalone.search_s("", ldap.SCOPE_BASE)
entry = str(entries[0])
assert rootdse_attr_name not in entry
@@ -727,14 +689,14 @@ def test_def_rootdse_attr(topology, import_example_ldif,
rootdse_attr_name):
assert False
-def test_mod_def_rootdse_attr(topology, import_example_ldif, rootdse_attr):
+def test_mod_def_rootdse_attr(topology_st, import_example_ldif, rootdse_attr):
"""Tests that operational attributes are returned
by default in rootDSE searches after config modification
"""
log.info(" Assert rootdse search has %s attr" % rootdse_attr)
try:
- entries = topology.standalone.search_s("", ldap.SCOPE_BASE)
+ entries = topology_st.standalone.search_s("", ldap.SCOPE_BASE)
entry = str(entries[0])
assert rootdse_attr in entry
diff --git a/dirsrvtests/tests/suites/betxns/betxn_test.py
b/dirsrvtests/tests/suites/betxns/betxn_test.py
index aa688de..40021e5 100644
--- a/dirsrvtests/tests/suites/betxns/betxn_test.py
+++ b/dirsrvtests/tests/suites/betxns/betxn_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -19,55 +19,22 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-def test_betxn_init(topology):
+def test_betxn_init(topology_st):
# First enable dynamic plugins - makes plugin testing much easier
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
ldap.error('Failed to enable dynamic plugin!' +
e.message['desc'])
assert False
-def test_betxt_7bit(topology):
+def test_betxt_7bit(topology_st):
'''
Test that the 7-bit plugin correctly rejects an invlaid update
'''
@@ -79,22 +46,22 @@ def test_betxt_7bit(topology):
BAD_RDN = eight_bit_rdn.encode('utf-8')
# This plugin should on by default, but just in case...
- topology.standalone.plugins.enable(name=PLUGIN_7_BIT_CHECK)
+ topology_st.standalone.plugins.enable(name=PLUGIN_7_BIT_CHECK)
# Add our test user
try:
- topology.standalone.add_s(Entry((USER_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '1',
- 'cn': 'test 1',
- 'uid': 'test_entry',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '1',
+ 'cn': 'test 1',
+ 'uid':
'test_entry',
+ 'userpassword':
'password'})))
except ldap.LDAPError as e:
log.error('Failed to add test user' + USER_DN + ': error ' +
e.message['desc'])
assert False
# Attempt a modrdn, this should fail
try:
- topology.standalone.rename_s(USER_DN, BAD_RDN, delold=0)
+ topology_st.standalone.rename_s(USER_DN, BAD_RDN, delold=0)
log.fatal('test_betxt_7bit: Modrdn operation incorrectly succeeded')
assert False
except ldap.LDAPError as e:
@@ -102,7 +69,7 @@ def test_betxt_7bit(topology):
# Make sure the operation did not succeed, attempt to search for the new RDN
try:
- entries = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
BAD_RDN)
+ entries = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
BAD_RDN)
if entries:
log.fatal('test_betxt_7bit: Incorrectly found the entry using the invalid
RDN')
assert False
@@ -114,7 +81,7 @@ def test_betxt_7bit(topology):
# Cleanup - remove the user
#
try:
- topology.standalone.delete_s(USER_DN)
+ topology_st.standalone.delete_s(USER_DN)
except ldap.LDAPError as e:
log.fatal('Failed to delete test entry: ' + e.message['desc'])
assert False
@@ -122,7 +89,7 @@ def test_betxt_7bit(topology):
log.info('test_betxt_7bit: PASSED')
-def test_betxn_attr_uniqueness(topology):
+def test_betxn_attr_uniqueness(topology_st):
'''
Test that we can not add two entries that have the same attr value that is
defined by the plugin.
@@ -133,15 +100,15 @@ def test_betxn_attr_uniqueness(topology):
USER1_DN = 'uid=test_entry1,' + DEFAULT_SUFFIX
USER2_DN = 'uid=test_entry2,' + DEFAULT_SUFFIX
- topology.standalone.plugins.enable(name=PLUGIN_ATTR_UNIQUENESS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_ATTR_UNIQUENESS)
# Add the first entry
try:
- topology.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '1',
- 'cn': 'test 1',
- 'uid': 'test_entry1',
- 'userpassword': 'password1'})))
+ topology_st.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '1',
+ 'cn': 'test 1',
+ 'uid':
'test_entry1',
+ 'userpassword':
'password1'})))
except ldap.LDAPError as e:
log.fatal('test_betxn_attr_uniqueness: Failed to add test user: ' +
USER1_DN + ', error ' + e.message['desc'])
@@ -149,12 +116,12 @@ def test_betxn_attr_uniqueness(topology):
# Add the second entry with a dupliate uid
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '2',
- 'cn': 'test 2',
- 'uid': 'test_entry2',
- 'uid': 'test_entry1', # Duplicate
value
- 'userpassword': 'password2'})))
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '2',
+ 'cn': 'test 2',
+ 'uid':
'test_entry2',
+ 'uid':
'test_entry1', # Duplicate value
+ 'userpassword':
'password2'})))
log.fatal('test_betxn_attr_uniqueness: The second entry was incorrectly
added.')
assert False
except ldap.LDAPError as e:
@@ -164,10 +131,10 @@ def test_betxn_attr_uniqueness(topology):
#
# Cleanup - disable plugin, remove test entry
#
- topology.standalone.plugins.disable(name=PLUGIN_ATTR_UNIQUENESS)
+ topology_st.standalone.plugins.disable(name=PLUGIN_ATTR_UNIQUENESS)
try:
- topology.standalone.delete_s(USER1_DN)
+ topology_st.standalone.delete_s(USER1_DN)
except ldap.LDAPError as e:
log.fatal('test_betxn_attr_uniqueness: Failed to delete test entry1: ' +
e.message['desc'])
@@ -176,31 +143,31 @@ def test_betxn_attr_uniqueness(topology):
log.info('test_betxn_attr_uniqueness: PASSED')
-def test_betxn_memberof(topology):
+def test_betxn_memberof(topology_st):
ENTRY1_DN = 'cn=group1,' + DEFAULT_SUFFIX
ENTRY2_DN = 'cn=group2,' + DEFAULT_SUFFIX
PLUGIN_DN = 'cn=' + PLUGIN_MEMBER_OF + ',cn=plugins,cn=config'
# Enable and configure memberOf plugin
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'memberofgroupattr', 'member')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'memberofgroupattr', 'member')])
except ldap.LDAPError as e:
log.fatal('test_betxn_memberof: Failed to update config(member): error '
+ e.message['desc'])
assert False
# Add our test entries
try:
- topology.standalone.add_s(Entry((ENTRY1_DN, {'objectclass': "top
groupofnames".split(),
- 'cn': 'group1'})))
+ topology_st.standalone.add_s(Entry((ENTRY1_DN, {'objectclass': "top
groupofnames".split(),
+ 'cn':
'group1'})))
except ldap.LDAPError as e:
log.error('test_betxn_memberof: Failed to add group1:' +
ENTRY1_DN + ', error ' + e.message['desc'])
assert False
try:
- topology.standalone.add_s(Entry((ENTRY2_DN, {'objectclass': "top
groupofnames".split(),
- 'cn': 'group1'})))
+ topology_st.standalone.add_s(Entry((ENTRY2_DN, {'objectclass': "top
groupofnames".split(),
+ 'cn':
'group1'})))
except ldap.LDAPError as e:
log.error('test_betxn_memberof: Failed to add group2:' +
ENTRY2_DN + ', error ' + e.message['desc'])
@@ -212,7 +179,7 @@ def test_betxn_memberof(topology):
# Add group2 to group1 - it should fail with objectclass violation
try:
- topology.standalone.modify_s(ENTRY1_DN, [(ldap.MOD_REPLACE, 'member',
ENTRY2_DN)])
+ topology_st.standalone.modify_s(ENTRY1_DN, [(ldap.MOD_REPLACE, 'member',
ENTRY2_DN)])
log.fatal('test_betxn_memberof: Group2 was incorrectly allowed to be added to
group1')
assert False
except ldap.LDAPError as e:
@@ -224,7 +191,7 @@ def test_betxn_memberof(topology):
# Add group2 to group1 - it should fail with objectclass violation
try:
- topology.standalone.modify_s(ENTRY1_DN, [(ldap.MOD_ADD, 'member',
ENTRY2_DN)])
+ topology_st.standalone.modify_s(ENTRY1_DN, [(ldap.MOD_ADD, 'member',
ENTRY2_DN)])
log.fatal('test_betxn_memberof: Group2 was incorrectly allowed to be added to
group1')
assert False
except ldap.LDAPError as e:
diff --git a/dirsrvtests/tests/suites/chaining_plugin/chaining_test.py
b/dirsrvtests/tests/suites/chaining_plugin/chaining_test.py
deleted file mode 100644
index dc7807b..0000000
--- a/dirsrvtests/tests/suites/chaining_plugin/chaining_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_chaining_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_chaining_(topology):
- '''
- Write a single test here...
- '''
- log.info('chaining test suite PASSED')
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/clu/clu_test.py
b/dirsrvtests/tests/suites/clu/clu_test.py
index e8bccb6..abf477c 100644
--- a/dirsrvtests/tests/suites/clu/clu_test.py
+++ b/dirsrvtests/tests/suites/clu/clu_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -18,55 +18,18 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_clu_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_clu_pwdhash(topology):
- '''
- Test the pwdhash script
- '''
+def test_clu_pwdhash(topology_st):
+ """Test the pwdhash script"""
log.info('Running test_clu_pwdhash...')
- cmd = '%s -s ssha testpassword' %
os.path.join(topology.standalone.get_bin_dir(), 'pwdhash')
+ cmd = '%s -s ssha testpassword' %
os.path.join(topology_st.standalone.get_bin_dir(), 'pwdhash')
p = os.popen(cmd)
result = p.readline()
diff --git a/dirsrvtests/tests/suites/clu/db2ldif_test.py
b/dirsrvtests/tests/suites/clu/db2ldif_test.py
deleted file mode 100644
index be4405a..0000000
--- a/dirsrvtests/tests/suites/clu/db2ldif_test.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_db2ldif_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/collation_plugin/collatation_test.py
b/dirsrvtests/tests/suites/collation_plugin/collatation_test.py
deleted file mode 100644
index d915165..0000000
--- a/dirsrvtests/tests/suites/collation_plugin/collatation_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_collatation_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_collatation_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/config/config_test.py
b/dirsrvtests/tests/suites/config/config_test.py
index 4670bb1..0323427 100644
--- a/dirsrvtests/tests/suites/config/config_test.py
+++ b/dirsrvtests/tests/suites/config/config_test.py
@@ -17,130 +17,14 @@ from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
+from lib389.topologies import topology_m2
-DEBUGGING = False
USER_DN = 'uid=test_user,%s' % DEFAULT_SUFFIX
-if DEBUGGING:
- logging.getLogger(__name__).setLevel(logging.DEBUG)
-else:
- logging.getLogger(__name__).setLevel(logging.INFO)
-
+logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
-class TopologyReplication(object):
- """The Replication Topology Class"""
- def __init__(self, master1, master2):
- """Init"""
- master1.open()
- self.master1 = master1
- master2.open()
- self.master2 = master2
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- """Create Replication Deployment"""
-
- # Creating master 1...
- if DEBUGGING:
- master1 = DirSrv(verbose=True)
- else:
- master1 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_1
- args_instance[SER_PORT] = PORT_MASTER_1
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master1.allocate(args_master)
- instance_master1 = master1.exists()
- if instance_master1:
- master1.delete()
- master1.create()
- master1.open()
- master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_1)
-
- # Creating master 2...
- if DEBUGGING:
- master2 = DirSrv(verbose=True)
- else:
- master2 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_2
- args_instance[SER_PORT] = PORT_MASTER_2
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master2.allocate(args_master)
- instance_master2 = master2.exists()
- if instance_master2:
- master2.delete()
- master2.create()
- master2.open()
- master2.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_2)
-
- #
- # Create all the agreements
- #
- # Creating agreement from master 1 to master 2
- properties = {RA_NAME: 'meTo_' + master2.host + ':' +
str(master2.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m1_m2_agmt = master1.agreement.create(suffix=SUFFIX, host=master2.host,
port=master2.port, properties=properties)
- if not m1_m2_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m1_m2_agmt)
-
- # Creating agreement from master 2 to master 1
- properties = {RA_NAME: 'meTo_' + master1.host + ':' +
str(master1.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m2_m1_agmt = master2.agreement.create(suffix=SUFFIX, host=master1.host,
port=master1.port, properties=properties)
- if not m2_m1_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m2_m1_agmt)
-
- # Allow the replicas to get situated with the new agreements...
- time.sleep(5)
-
- #
- # Initialize all the agreements
- #
- master1.agreement.init(SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
- master1.waitForReplInit(m1_m2_agmt)
-
- # Check replication is working...
- if master1.testReplication(DEFAULT_SUFFIX, master2):
- log.info('Replication is working.')
- else:
- log.fatal('Replication is not working.')
- raise
-
- def fin():
- """If we are debugging just stop the instances, otherwise remove
- them
- """
- if DEBUGGING:
- master1.stop()
- master2.stop()
- else:
- master1.delete()
- master2.delete()
-
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- master1.clearTmpDir(__file__)
-
- return TopologyReplication(master1, master2)
-
-
@pytest.fixture(scope="module")
def big_file():
TEMP_BIG_FILE = ''
@@ -154,18 +38,18 @@ def big_file():
@pytest.fixture
-def test_user(topology):
+def test_user(topology_m2):
"""Add and remove test user"""
try:
- topology.master1.add_s(Entry((USER_DN, {
- 'uid': 'test_user',
- 'givenName': 'test_user',
- 'objectclass': ['top',
'person',
- 'organizationalPerson',
- 'inetorgperson'],
- 'cn': 'test_user',
- 'sn': 'test_user'})))
+ topology_m2.ms["master1"].add_s(Entry((USER_DN, {
+ 'uid': 'test_user',
+ 'givenName': 'test_user',
+ 'objectclass': ['top', 'person',
+ 'organizationalPerson',
+ 'inetorgperson'],
+ 'cn': 'test_user',
+ 'sn': 'test_user'})))
time.sleep(1)
except ldap.LDAPError as e:
log.fatal('Failed to add user (%s): error (%s)' % (USER_DN,
@@ -174,16 +58,16 @@ def test_user(topology):
def fin():
try:
- topology.master1.delete_s(USER_DN)
+ topology_m2.ms["master1"].delete_s(USER_DN)
time.sleep(1)
except ldap.LDAPError as e:
log.fatal('Failed to delete user (%s): error (%s)' % (
- USER_DN,
- e.message['desc']))
+ USER_DN,
+ e.message['desc']))
raise
-def test_maxbersize_repl(topology, test_user, big_file):
+def test_maxbersize_repl(topology_m2, test_user, big_file):
"""maxbersize is ignored in the replicated operations.
:Feature: Config
@@ -201,27 +85,27 @@ def test_maxbersize_repl(topology, test_user, big_file):
"""
log.info("Set nsslapd-maxbersize: 20K to master2")
try:
- topology.master2.modify_s("cn=config", [(ldap.MOD_REPLACE,
- 'nsslapd-maxbersize',
'20480')])
+ topology_m2.ms["master2"].modify_s("cn=config",
[(ldap.MOD_REPLACE,
+ 'nsslapd-maxbersize',
'20480')])
except ldap.LDAPError as e:
log.error('Failed to set nsslapd-maxbersize == 20480: error ' +
- e.message['desc'])
+ e.message['desc'])
raise
- topology.master2.restart(20)
+ topology_m2.ms["master2"].restart(20)
log.info('Try to add attribute with a big value to master2 - expect to
FAIL')
with pytest.raises(ldap.SERVER_DOWN):
- topology.master2.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'jpegphoto', big_file)])
+ topology_m2.ms["master2"].modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'jpegphoto', big_file)])
- topology.master2.restart(20)
- topology.master1.restart(20)
+ topology_m2.ms["master2"].restart(20)
+ topology_m2.ms["master1"].restart(20)
log.info('Try to add attribute with a big value to master1 - expect to
PASS')
try:
- topology.master1.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'jpegphoto', big_file)])
+ topology_m2.ms["master1"].modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'jpegphoto', big_file)])
except ldap.SERVER_DOWN as e:
log.fatal('Failed to add a big attribute, error: ' +
e.message['desc'])
raise
@@ -230,43 +114,43 @@ def test_maxbersize_repl(topology, test_user, big_file):
log.info('Check if a big value was successfully added to master1')
try:
- entries = topology.master1.search_s(USER_DN, ldap.SCOPE_BASE,
- '(cn=*)',
- ['jpegphoto'])
+ entries = topology_m2.ms["master1"].search_s(USER_DN, ldap.SCOPE_BASE,
+ '(cn=*)',
+ ['jpegphoto'])
assert entries[0].data['jpegphoto']
except ldap.LDAPError as e:
- log.fatal('Search failed, error: ' + e.message['desc'])
- raise
+ log.fatal('Search failed, error: ' + e.message['desc'])
+ raise
log.info('Check if a big value was successfully replicated to master2')
try:
- entries = topology.master2.search_s(USER_DN, ldap.SCOPE_BASE,
- '(cn=*)',
- ['jpegphoto'])
+ entries = topology_m2.ms["master2"].search_s(USER_DN, ldap.SCOPE_BASE,
+ '(cn=*)',
+ ['jpegphoto'])
assert entries[0].data['jpegphoto']
except ldap.LDAPError as e:
- log.fatal('Search failed, error: ' + e.message['desc'])
- raise
+ log.fatal('Search failed, error: ' + e.message['desc'])
+ raise
log.info("Set nsslapd-maxbersize: 2097152 (default) to master2")
try:
- topology.master2.modify_s("cn=config", [(ldap.MOD_REPLACE,
- 'nsslapd-maxbersize',
'2097152')])
+ topology_m2.ms["master2"].modify_s("cn=config",
[(ldap.MOD_REPLACE,
+ 'nsslapd-maxbersize',
'2097152')])
except ldap.LDAPError as e:
log.error('Failed to set nsslapd-maxbersize == 2097152 error ' +
- e.message['desc'])
+ e.message['desc'])
raise
-def test_config_listen_backport_size(topology):
+def test_config_listen_backport_size(topology_m2):
"""We need to check that we can search on
nsslapd-listen-backlog-size,
and change its value: to a psoitive number and a negative number.
Verify invalid value is rejected.
"""
try:
- entry = topology.master1.search_s(DN_CONFIG, ldap.SCOPE_BASE,
'objectclass=top',
- ['nsslapd-listen-backlog-size'])
+ entry = topology_m2.ms["master1"].search_s(DN_CONFIG, ldap.SCOPE_BASE,
'objectclass=top',
+
['nsslapd-listen-backlog-size'])
default_val = entry[0].data['nsslapd-listen-backlog-size'][0]
assert default_val, 'Failed to get nsslapd-listen-backlog-size from
config'
except ldap.LDAPError as e:
@@ -274,39 +158,39 @@ def test_config_listen_backport_size(topology):
raise
try:
- topology.master1.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-listen-backlog-size',
- '256')])
+ topology_m2.ms["master1"].modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
+
'nsslapd-listen-backlog-size',
+ '256')])
except ldap.LDAPError as e:
log.fatal('Failed to modify config, error: ' +
e.message('desc'))
raise
try:
- topology.master1.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-listen-backlog-size',
- '-1')])
+ topology_m2.ms["master1"].modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
+
'nsslapd-listen-backlog-size',
+ '-1')])
except ldap.LDAPError as e:
log.fatal('Failed to modify config(negative value), error: ' +
e.message('desc'))
raise
with pytest.raises(ldap.LDAPError):
- topology.master1.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-listen-backlog-size',
- 'ZZ')])
+ topology_m2.ms["master1"].modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
+
'nsslapd-listen-backlog-size',
+ 'ZZ')])
log.fatal('Invalid value was successfully added')
# Cleanup - undo what we've done
try:
- topology.master1.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-listen-backlog-size',
- default_val)])
+ topology_m2.ms["master1"].modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
+
'nsslapd-listen-backlog-size',
+ default_val)])
except ldap.LDAPError as e:
log.fatal('Failed to reset config, error: ' + e.message('desc'))
raise
-def test_config_deadlock_policy(topology):
+def test_config_deadlock_policy(topology_m2):
"""We need to check that nsslapd-db-deadlock-policy exists, that we
can
change the value, and invalid values are rejected
"""
@@ -315,8 +199,8 @@ def test_config_deadlock_policy(topology):
default_val = '9'
try:
- entry = topology.master1.search_s(LDBM_DN, ldap.SCOPE_BASE,
'objectclass=top',
- ['nsslapd-db-deadlock-policy'])
+ entry = topology_m2.ms["master1"].search_s(LDBM_DN, ldap.SCOPE_BASE,
'objectclass=top',
+
['nsslapd-db-deadlock-policy'])
val = entry[0].data['nsslapd-db-deadlock-policy'][0]
assert val, 'Failed to get nsslapd-db-deadlock-policy from config'
assert val == default_val, 'The wrong derfualt value was present'
@@ -327,9 +211,9 @@ def test_config_deadlock_policy(topology):
# Try a range of valid values
for val in ('0', '5', '9'):
try:
- topology.master1.modify_s(LDBM_DN, [(ldap.MOD_REPLACE,
- 'nsslapd-db-deadlock-policy',
- val)])
+ topology_m2.ms["master1"].modify_s(LDBM_DN, [(ldap.MOD_REPLACE,
+
'nsslapd-db-deadlock-policy',
+ val)])
except ldap.LDAPError as e:
log.fatal('Failed to modify config: nsslapd-db-deadlock-policy to (%s),
error: %s' %
(val, e.message('desc')))
@@ -338,16 +222,16 @@ def test_config_deadlock_policy(topology):
# Try a range of invalid values
for val in ('-1', '10'):
with pytest.raises(ldap.LDAPError):
- topology.master1.modify_s(LDBM_DN, [(ldap.MOD_REPLACE,
- 'nsslapd-db-deadlock-policy',
- val)])
+ topology_m2.ms["master1"].modify_s(LDBM_DN, [(ldap.MOD_REPLACE,
+
'nsslapd-db-deadlock-policy',
+ val)])
log.fatal('Able to add invalid value to
nsslapd-db-deadlock-policy(%s)' % (val))
# Cleanup - undo what we've done
try:
- topology.master1.modify_s(LDBM_DN, [(ldap.MOD_REPLACE,
- 'nsslapd-db-deadlock-policy',
- default_val)])
+ topology_m2.ms["master1"].modify_s(LDBM_DN, [(ldap.MOD_REPLACE,
+
'nsslapd-db-deadlock-policy',
+ default_val)])
except ldap.LDAPError as e:
log.fatal('Failed to reset nsslapd-db-deadlock-policy to the default
value(%s), error: %s' %
(default_val, e.message('desc')))
diff --git a/dirsrvtests/tests/suites/cos_plugin/cos_test.py
b/dirsrvtests/tests/suites/cos_plugin/cos_test.py
deleted file mode 100644
index f06b9d4..0000000
--- a/dirsrvtests/tests/suites/cos_plugin/cos_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_cos_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_cos_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/deref_plugin/deref_test.py
b/dirsrvtests/tests/suites/deref_plugin/deref_test.py
deleted file mode 100644
index 0153932..0000000
--- a/dirsrvtests/tests/suites/deref_plugin/deref_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_deref_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_deref_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/disk_monitoring/disk_monitor_test.py
b/dirsrvtests/tests/suites/disk_monitoring/disk_monitor_test.py
deleted file mode 100644
index 8930ebd..0000000
--- a/dirsrvtests/tests/suites/disk_monitoring/disk_monitor_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_disk_monitor_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_disk_monitor_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/distrib_plugin/distrib_test.py
b/dirsrvtests/tests/suites/distrib_plugin/distrib_test.py
deleted file mode 100644
index 101d65c..0000000
--- a/dirsrvtests/tests/suites/distrib_plugin/distrib_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_distrib_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_distrib_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/dna_plugin/dna_test.py
b/dirsrvtests/tests/suites/dna_plugin/dna_test.py
index 8830d5e..84a000e 100644
--- a/dirsrvtests/tests/suites/dna_plugin/dna_test.py
+++ b/dirsrvtests/tests/suites/dna_plugin/dna_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -18,6 +18,7 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
@@ -35,60 +36,13 @@ PEOPLE_OU = 'ou=people,' + DEFAULT_SUFFIX
GROUP_DN = 'cn=group,' + DEFAULT_SUFFIX
CONFIG_AREA = 'nsslapd-pluginConfigArea'
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Delete each instance in the end
- def fin():
- # This is useful for analysing the test env.
- standalone.db2ldif(bename=DEFAULT_BENAME, suffixes=[DEFAULT_SUFFIX],
excludeSuffixes=[], encrypt=False,
- repl_data=True,
outputfile='{}/{}.ldif'.format(standalone.ldifdir, SERVERID_STANDALONE))
- standalone.clearBackupFS()
- standalone.backupFS()
- standalone.delete()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
-
-def test_dna_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_dna_(topology):
- '''
- Write a single test here...
- '''
-
- # stop the plugin, and start it
- topology.standalone.plugins.disable(name=PLUGIN_DNA)
- topology.standalone.plugins.enable(name=PLUGIN_DNA)
+
+def test_basic(topology_st):
+ """Test basic functionality"""
+
+ # Stop the plugin, and start it
+ topology_st.standalone.plugins.disable(name=PLUGIN_DNA)
+ topology_st.standalone.plugins.enable(name=PLUGIN_DNA)
CONFIG_DN = 'cn=config,cn=' + PLUGIN_DNA + ',cn=plugins,cn=config'
@@ -99,20 +53,20 @@ def test_dna_(topology):
############################################################################
try:
- topology.standalone.add_s(Entry((CONFIG_DN, {
- 'objectclass': 'top dnaPluginConfig'.split(),
- 'cn': 'config',
- 'dnatype': 'uidNumber',
- 'dnafilter': '(objectclass=top)',
- 'dnascope': DEFAULT_SUFFIX,
- 'dnaMagicRegen': '-1',
- 'dnaMaxValue': '50000',
- 'dnaNextValue': '1'
- })))
+ topology_st.standalone.add_s(Entry((CONFIG_DN, {
+ 'objectclass': 'top dnaPluginConfig'.split(),
+ 'cn': 'config',
+ 'dnatype': 'uidNumber',
+ 'dnafilter': '(objectclass=top)',
+ 'dnascope': DEFAULT_SUFFIX,
+ 'dnaMagicRegen': '-1',
+ 'dnaMaxValue': '50000',
+ 'dnaNextValue': '1'
+ })))
except ldap.ALREADY_EXISTS:
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'dnaNextValue', '1'),
- (ldap.MOD_REPLACE, 'dnaMagicRegen',
'-1')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'dnaNextValue', '1'),
+ (ldap.MOD_REPLACE,
'dnaMagicRegen', '-1')])
except ldap.LDAPError as e:
log.fatal('test_dna: Failed to set the DNA plugin: error ' +
e.message['desc'])
assert False
@@ -122,24 +76,24 @@ def test_dna_(topology):
# Do we need to restart for the plugin?
- topology.standalone.restart()
+ topology_st.standalone.restart()
############################################################################
# Test plugin
############################################################################
try:
- topology.standalone.add_s(Entry((USER1_DN, {
- 'objectclass': 'top extensibleObject'.split(),
- 'uid': 'user1'
- })))
+ topology_st.standalone.add_s(Entry((USER1_DN, {
+ 'objectclass': 'top extensibleObject'.split(),
+ 'uid': 'user1'
+ })))
except ldap.LDAPError as e:
log.fatal('test_dna: Failed to user1: error ' +
e.message['desc'])
assert False
# See if the entry now has the new uidNumber assignment - uidNumber=1
try:
- entries = topology.standalone.search_s(USER1_DN, ldap.SCOPE_BASE,
'(uidNumber=1)')
+ entries = topology_st.standalone.search_s(USER1_DN, ldap.SCOPE_BASE,
'(uidNumber=1)')
if not entries:
log.fatal('test_dna: user1 was not updated - (looking for uidNumber:
1)')
assert False
@@ -149,14 +103,14 @@ def test_dna_(topology):
# Test the magic regen value
try:
- topology.standalone.modify_s(USER1_DN, [(ldap.MOD_REPLACE, 'uidNumber',
'-1')])
+ topology_st.standalone.modify_s(USER1_DN, [(ldap.MOD_REPLACE,
'uidNumber', '-1')])
except ldap.LDAPError as e:
log.fatal('test_dna: Failed to set the magic reg value: error ' +
e.message['desc'])
assert False
# See if the entry now has the new uidNumber assignment - uidNumber=2
try:
- entries = topology.standalone.search_s(USER1_DN, ldap.SCOPE_BASE,
'(uidNumber=2)')
+ entries = topology_st.standalone.search_s(USER1_DN, ldap.SCOPE_BASE,
'(uidNumber=2)')
if not entries:
log.fatal('test_dna: user1 was not updated (looking for uidNumber:
2)')
assert False
@@ -169,7 +123,7 @@ def test_dna_(topology):
################################################################################
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'dnaMagicRegen', '-2')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'dnaMagicRegen', '-2')])
except ldap.LDAPError as e:
log.fatal('test_dna: Failed to set the magic reg value to -2: error ' +
e.message['desc'])
assert False
@@ -180,14 +134,14 @@ def test_dna_(topology):
# Test the magic regen value
try:
- topology.standalone.modify_s(USER1_DN, [(ldap.MOD_REPLACE, 'uidNumber',
'-2')])
+ topology_st.standalone.modify_s(USER1_DN, [(ldap.MOD_REPLACE,
'uidNumber', '-2')])
except ldap.LDAPError as e:
log.fatal('test_dna: Failed to set the magic reg value: error ' +
e.message['desc'])
assert False
# See if the entry now has the new uidNumber assignment - uidNumber=3
try:
- entries = topology.standalone.search_s(USER1_DN, ldap.SCOPE_BASE,
'(uidNumber=3)')
+ entries = topology_st.standalone.search_s(USER1_DN, ldap.SCOPE_BASE,
'(uidNumber=3)')
if not entries:
log.fatal('test_dna: user1 was not updated (looking for uidNumber:
3)')
assert False
@@ -199,27 +153,19 @@ def test_dna_(topology):
# Test plugin dependency
############################################################################
- #test_dependency(inst, PLUGIN_AUTOMEMBER)
+ # test_dependency(inst, PLUGIN_AUTOMEMBER)
############################################################################
# Cleanup
############################################################################
try:
- topology.standalone.delete_s(USER1_DN)
+ topology_st.standalone.delete_s(USER1_DN)
except ldap.LDAPError as e:
log.fatal('test_dna: Failed to delete test entry1: ' +
e.message['desc'])
assert False
- topology.standalone.plugins.disable(name=PLUGIN_DNA)
-
- ############################################################################
- # Test passed
- ############################################################################
-
- log.info('test_dna: PASS\n')
-
- return
+ topology_st.standalone.plugins.disable(name=PLUGIN_DNA)
if __name__ == '__main__':
diff --git a/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
b/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
deleted file mode 100644
index 1f6862d..0000000
--- a/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_ds_logs_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_ds_logs_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/dynamic-plugins/plugin_tests.py
b/dirsrvtests/tests/suites/dynamic-plugins/plugin_tests.py
index 30dfa88..b8bf477 100644
--- a/dirsrvtests/tests/suites/dynamic-plugins/plugin_tests.py
+++ b/dirsrvtests/tests/suites/dynamic-plugins/plugin_tests.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/suites/dynamic-plugins/stress_tests.py
b/dirsrvtests/tests/suites/dynamic-plugins/stress_tests.py
index 920d3f6..f98812c 100644
--- a/dirsrvtests/tests/suites/dynamic-plugins/stress_tests.py
+++ b/dirsrvtests/tests/suites/dynamic-plugins/stress_tests.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
b/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
index 2a038a9..2411424 100644
--- a/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
+++ b/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -25,57 +25,19 @@ from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
+from lib389.topologies import topology_st
log = logging.getLogger(__name__)
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
def repl_fail(replica):
- # remove replica instance, and assert failure
+ """Remove replica instance, and assert failure"""
+
replica.delete()
assert False
-(a)pytest.fixture(scope="module")
-def topology(request):
- '''
- This fixture is used to standalone topology for the 'module'.
- '''
- standalone = DirSrv(verbose=False)
-
- # Args for the standalone instance
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
-
- # Get the status of the instance and restart it if it exists
- instance_standalone = standalone.exists()
-
- # Remove the instance
- if instance_standalone:
- standalone.delete()
-
- # Create the instance
- standalone.create()
-
- # Used to retrieve configuration information (dbdir, confdir...)
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- # Here we have standalone instance up and running
- return TopologyStandalone(standalone)
-
-
-def test_dynamic_plugins(topology):
+def test_dynamic_plugins(topology_st):
"""
Test Dynamic Plugins - exercise each plugin and its main features, while
changing the configuration without restarting the server.
@@ -97,7 +59,6 @@ def test_dynamic_plugins(topology):
Stress - Put the server under load that will trigger multiple plugins(MO, RI,
DNA, etc)
Restart various plugins while these operations are going on. Perform
this test
5 times(stress_max_run).
-
"""
REPLICA_PORT = 33334
@@ -110,14 +71,14 @@ def test_dynamic_plugins(topology):
# First enable dynamic plugins
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
ldap.fatal('Failed to enable dynamic plugin!' +
e.message['desc'])
assert False
# Test that critical plugins can be updated even though the change might not be
applied
try:
- topology.standalone.modify_s(DN_LDBM, [(ldap.MOD_REPLACE, 'description',
'test')])
+ topology_st.standalone.modify_s(DN_LDBM, [(ldap.MOD_REPLACE,
'description', 'test')])
except ldap.LDAPError as e:
ldap.fatal('Failed to apply change to critical plugin' +
e.message['desc'])
assert False
@@ -135,7 +96,7 @@ def test_dynamic_plugins(topology):
log.info('Testing Dynamic Plugins Functionality' + msg + '...')
log.info('####################################################################\n')
- plugin_tests.test_all_plugins(topology.standalone)
+ plugin_tests.test_all_plugins(topology_st.standalone)
log.info('####################################################################')
log.info('Successfully Tested Dynamic Plugins Functionality' + msg +
'.')
@@ -155,20 +116,20 @@ def test_dynamic_plugins(topology):
#
# Restart the plugin several times (and prev plugins) - work that linked
list
#
- plugin_test(topology.standalone, "restart")
+ plugin_test(topology_st.standalone, "restart")
if prev_prev_plugin_test:
- prev_prev_plugin_test(topology.standalone, "restart")
+ prev_prev_plugin_test(topology_st.standalone, "restart")
- plugin_test(topology.standalone, "restart")
+ plugin_test(topology_st.standalone, "restart")
if prev_plugin_test:
- prev_plugin_test(topology.standalone, "restart")
+ prev_plugin_test(topology_st.standalone, "restart")
- plugin_test(topology.standalone, "restart")
+ plugin_test(topology_st.standalone, "restart")
# Now run the functional test
- plugin_test(topology.standalone)
+ plugin_test(topology_st.standalone)
# Set the previous tests
if prev_plugin_test:
@@ -188,8 +149,8 @@ def test_dynamic_plugins(topology):
log.info('Stressing Dynamic Plugins' + msg + '...')
log.info('####################################################################\n')
- stress_tests.configureMO(topology.standalone)
- stress_tests.configureRI(topology.standalone)
+ stress_tests.configureMO(topology_st.standalone)
+ stress_tests.configureRI(topology_st.standalone)
stress_count = 0
while stress_count < stress_max_runs:
@@ -199,37 +160,37 @@ def test_dynamic_plugins(topology):
try:
# Launch three new threads to add a bunch of users
- add_users = stress_tests.AddUsers(topology.standalone,
'employee', True)
+ add_users = stress_tests.AddUsers(topology_st.standalone,
'employee', True)
add_users.start()
- add_users2 = stress_tests.AddUsers(topology.standalone, 'entry',
True)
+ add_users2 = stress_tests.AddUsers(topology_st.standalone,
'entry', True)
add_users2.start()
- add_users3 = stress_tests.AddUsers(topology.standalone, 'person',
True)
+ add_users3 = stress_tests.AddUsers(topology_st.standalone,
'person', True)
add_users3.start()
time.sleep(1)
# While we are adding users restart the MO plugin and an idle plugin
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
- topology.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
time.sleep(1)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
time.sleep(2)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
- topology.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
# Wait for the 'adding' threads to complete
add_users.join()
@@ -237,43 +198,43 @@ def test_dynamic_plugins(topology):
add_users3.join()
# Now launch three threads to delete the users
- del_users = stress_tests.DelUsers(topology.standalone,
'employee')
+ del_users = stress_tests.DelUsers(topology_st.standalone,
'employee')
del_users.start()
- del_users2 = stress_tests.DelUsers(topology.standalone, 'entry')
+ del_users2 = stress_tests.DelUsers(topology_st.standalone,
'entry')
del_users2.start()
- del_users3 = stress_tests.DelUsers(topology.standalone,
'person')
+ del_users3 = stress_tests.DelUsers(topology_st.standalone,
'person')
del_users3.start()
time.sleep(1)
# Restart both the MO, RI plugins during these deletes, and an idle
plugin
- topology.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
time.sleep(1)
- topology.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
time.sleep(1)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
- topology.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
- topology.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
- topology.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
- topology.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
time.sleep(2)
- topology.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.disable(name=PLUGIN_REFER_INTEGRITY)
time.sleep(1)
- topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
time.sleep(1)
- topology.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
- topology.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
- topology.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
+ topology_st.standalone.plugins.disable(name=PLUGIN_LINKED_ATTRS)
+ topology_st.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
# Wait for the 'deleting' threads to complete
del_users.join()
@@ -281,11 +242,11 @@ def test_dynamic_plugins(topology):
del_users3.join()
# Now make sure both the MO and RI plugins still work correctly
- plugin_tests.func_tests[8](topology.standalone) # RI plugin
- plugin_tests.func_tests[5](topology.standalone) # MO plugin
+ plugin_tests.func_tests[8](topology_st.standalone) # RI plugin
+ plugin_tests.func_tests[5](topology_st.standalone) # MO plugin
# Cleanup the stress tests
- stress_tests.cleanup(topology.standalone)
+ stress_tests.cleanup(topology_st.standalone)
except:
log.info('Stress test failed!')
@@ -319,29 +280,29 @@ def test_dynamic_plugins(topology):
replica_inst.open()
try:
- topology.standalone.replica.enableReplication(suffix=DEFAULT_SUFFIX,
- role=REPLICAROLE_MASTER,
- replicaId=1)
+ topology_st.standalone.replica.enableReplication(suffix=DEFAULT_SUFFIX,
+
role=REPLICAROLE_MASTER,
+ replicaId=1)
replica_inst.replica.enableReplication(suffix=DEFAULT_SUFFIX,
- role=REPLICAROLE_CONSUMER,
- replicaId=65535)
+ role=REPLICAROLE_CONSUMER,
+ replicaId=65535)
properties = {RA_NAME: r'to_replica',
RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
RA_TRANSPORT_PROT:
defaultProperties[REPLICATION_TRANSPORT]}
- repl_agreement =
topology.standalone.agreement.create(suffix=DEFAULT_SUFFIX,
- host=LOCALHOST,
- port=REPLICA_PORT,
-
properties=properties)
+ repl_agreement =
topology_st.standalone.agreement.create(suffix=DEFAULT_SUFFIX,
+ host=LOCALHOST,
+
port=REPLICA_PORT,
+
properties=properties)
if not repl_agreement:
log.fatal("Fail to create a replica agreement")
repl_fail(replica_inst)
- topology.standalone.agreement.init(DEFAULT_SUFFIX, LOCALHOST,
REPLICA_PORT)
- topology.standalone.waitForReplInit(repl_agreement)
+ topology_st.standalone.agreement.init(DEFAULT_SUFFIX, LOCALHOST,
REPLICA_PORT)
+ topology_st.standalone.waitForReplInit(repl_agreement)
except:
log.info('Failed to setup replication!')
repl_fail(replica_inst)
@@ -358,7 +319,7 @@ def test_dynamic_plugins(topology):
try:
# Grab master's max CSN
- entry = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
RUV_FILTER)
+ entry = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
RUV_FILTER)
if not entry:
log.error('Failed to find db tombstone entry from master')
repl_fail(replica_inst)
@@ -423,9 +384,9 @@ def test_dynamic_plugins(topology):
# Check the master
try:
- entries = topology.standalone.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
-
"(|(uid=person*)(uid=entry*)(uid=employee*))")
+ entries = topology_st.standalone.search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+
"(|(uid=person*)(uid=entry*)(uid=employee*))")
if len(entries) > 0:
log.error('Master database has incorrect data set!\n')
repl_fail(replica_inst)
diff --git a/dirsrvtests/tests/suites/filter/filter_test.py
b/dirsrvtests/tests/suites/filter/filter_test.py
index 1601c23..81a3ee7 100644
--- a/dirsrvtests/tests/suites/filter/filter_test.py
+++ b/dirsrvtests/tests/suites/filter/filter_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -17,54 +17,13 @@ from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_filter_init(topology):
- '''
- Write your testcase here...
- '''
- return
-
-
-def test_filter_escaped(topology):
+def test_filter_escaped(topology_st):
'''
Test we can search for an '*' in a attribute value.
'''
@@ -75,7 +34,7 @@ def test_filter_escaped(topology):
USER2_DN = 'uid=test_entry2,' + DEFAULT_SUFFIX
try:
- topology.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
+ topology_st.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
'sn': '1',
'cn': 'test * me',
'uid': 'test_entry',
@@ -86,7 +45,7 @@ def test_filter_escaped(topology):
assert False
try:
- topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
+ topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top
extensibleObject".split(),
'sn': '2',
'cn': 'test me',
'uid': 'test_entry2',
@@ -96,7 +55,7 @@ def test_filter_escaped(topology):
assert False
try:
- entry = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
'cn=*\**')
+ entry = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
'cn=*\**')
if not entry or len(entry) > 1:
log.fatal('test_filter_escaped: Entry was not found using
"cn=*\**"')
assert False
@@ -108,7 +67,7 @@ def test_filter_escaped(topology):
log.info('test_filter_escaped: PASSED')
-def test_filter_search_original_attrs(topology):
+def test_filter_search_original_attrs(topology_st):
'''
Search and request attributes with extra characters. The returned entry
should not have these extra characters: "objectclass EXTRA"
@@ -117,7 +76,7 @@ def test_filter_search_original_attrs(topology):
log.info('Running test_filter_search_original_attrs...')
try:
- entry = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_BASE,
+ entry = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_BASE,
'objectclass=top',
['objectclass-EXTRA'])
if entry[0].hasAttr('objectclass-EXTRA'):
log.fatal('test_filter_search_original_attrs: Entry does not have the
original attribute')
diff --git a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
index 0fc207e..9812fae 100644
--- a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
+++ b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
@@ -16,9 +16,7 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
+from lib389.topologies import topology_st
DN_PEOPLE = 'ou=people,%s' % DEFAULT_SUFFIX
DN_ROOT = ''
@@ -28,91 +26,58 @@ TEST_USER_PWD = 'all_attrs_test'
# Suffix for search, Regular user boolean, List of expected attrs
TEST_PARAMS = [(DN_ROOT, False, [
- 'aci', 'createTimestamp', 'creatorsName',
- 'modifiersName', 'modifyTimestamp',
'namingContexts',
- 'nsBackendSuffix', 'nsUniqueId',
'subschemaSubentry',
- 'supportedControl', 'supportedExtension',
- 'supportedFeatures', 'supportedLDAPVersion',
- 'supportedSASLMechanisms', 'vendorName',
'vendorVersion'
- ]),
+ 'aci', 'createTimestamp', 'creatorsName',
+ 'modifiersName', 'modifyTimestamp', 'namingContexts',
+ 'nsBackendSuffix', 'nsUniqueId', 'subschemaSubentry',
+ 'supportedControl', 'supportedExtension',
+ 'supportedFeatures', 'supportedLDAPVersion',
+ 'supportedSASLMechanisms', 'vendorName', 'vendorVersion'
+]),
(DN_ROOT, True, [
- 'createTimestamp', 'creatorsName',
- 'modifiersName', 'modifyTimestamp',
'namingContexts',
- 'nsBackendSuffix', 'nsUniqueId',
'subschemaSubentry',
- 'supportedControl', 'supportedExtension',
- 'supportedFeatures', 'supportedLDAPVersion',
- 'supportedSASLMechanisms', 'vendorName',
'vendorVersion'
- ]),
+ 'createTimestamp', 'creatorsName',
+ 'modifiersName', 'modifyTimestamp',
'namingContexts',
+ 'nsBackendSuffix', 'nsUniqueId',
'subschemaSubentry',
+ 'supportedControl', 'supportedExtension',
+ 'supportedFeatures', 'supportedLDAPVersion',
+ 'supportedSASLMechanisms', 'vendorName',
'vendorVersion'
+ ]),
(DN_PEOPLE, False, [
'aci', 'createTimestamp', 'creatorsName',
'entrydn',
'entryid', 'modifiersName',
'modifyTimestamp',
'nsUniqueId', 'numSubordinates', 'parentid'
- ]),
+ ]),
(DN_PEOPLE, True, [
'createTimestamp', 'creatorsName', 'entrydn',
'entryid', 'modifyTimestamp', 'nsUniqueId',
'numSubordinates', 'parentid'
- ]),
+ ]),
(TEST_USER_DN, False, [
'createTimestamp', 'creatorsName', 'entrydn',
'entryid', 'modifiersName',
'modifyTimestamp',
'nsUniqueId', 'parentid'
- ]),
+ ]),
(TEST_USER_DN, True, [
'createTimestamp', 'creatorsName', 'entrydn',
'entryid', 'modifyTimestamp', 'nsUniqueId',
'parentid'
- ]),
+ ]),
(DN_CONFIG, False, ['numSubordinates',
'passwordHistory'])]
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Delete each instance in the end
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
-
@pytest.fixture(scope="module")
-def test_user(topology):
+def test_user(topology_st):
"""User for binding operation"""
try:
- topology.standalone.add_s(Entry((TEST_USER_DN, {
- 'objectclass': 'top
person'.split(),
- 'objectclass':
'organizationalPerson',
- 'objectclass': 'inetorgperson',
- 'cn': TEST_USER_NAME,
- 'sn': TEST_USER_NAME,
- 'userpassword': TEST_USER_PWD,
- 'mail': '%s(a)redhat.com' %
TEST_USER_NAME,
- 'uid': TEST_USER_NAME
- })))
+ topology_st.standalone.add_s(Entry((TEST_USER_DN, {
+ 'objectclass': 'top person'.split(),
+ 'objectclass': 'organizationalPerson',
+ 'objectclass': 'inetorgperson',
+ 'cn': TEST_USER_NAME,
+ 'sn': TEST_USER_NAME,
+ 'userpassword': TEST_USER_PWD,
+ 'mail': '%s(a)redhat.com' % TEST_USER_NAME,
+ 'uid': TEST_USER_NAME
+ })))
except ldap.LDAPError as e:
log.error('Failed to add user (%s): error (%s)' % (TEST_USER_DN,
e.message['desc']))
@@ -120,7 +85,7 @@ def test_user(topology):
@pytest.fixture(scope="module")
-def user_aci(topology):
+def user_aci(topology_st):
"""Deny modifiersName attribute for the test user
under whole suffix
"""
@@ -129,12 +94,12 @@ def user_aci(topology):
ACI_ALLOW = '(version 3.0; acl "Deny modifiersName for user"; deny
(read)'
ACI_SUBJECT = ' userdn = "ldap:///%s";)' % TEST_USER_DN
ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD,
- 'aci',
- ACI_BODY)])
+ topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD,
+ 'aci',
+ ACI_BODY)])
-def test_supported_features(topology):
+def test_supported_features(topology_st):
"""Verify that OID 1.3.6.1.4.1.4203.1.5.1 is published
in the supportedFeatures [RFC3674] attribute in the rootDSE.
@@ -147,9 +112,9 @@ def test_supported_features(topology):
:Assert: Value 1.3.6.1.4.1.4203.1.5.1 is presented
"""
- entries = topology.standalone.search_s('', ldap.SCOPE_BASE,
- '(objectClass=*)',
- ['supportedFeatures'])
+ entries = topology_st.standalone.search_s('', ldap.SCOPE_BASE,
+ '(objectClass=*)',
+ ['supportedFeatures'])
supported_value = entries[0].data['supportedfeatures']
assert supported_value == ['1.3.6.1.4.1.4203.1.5.1']
@@ -158,7 +123,7 @@ def test_supported_features(topology):
@pytest.mark.parametrize('add_attr', ['', '*',
'objectClass'])
@pytest.mark.parametrize('search_suffix,regular_user,oper_attr_list',
TEST_PARAMS)
-def test_search_basic(topology, test_user, user_aci, add_attr,
+def test_search_basic(topology_st, test_user, user_aci, add_attr,
search_suffix, regular_user, oper_attr_list):
"""Verify that you can get all expected operational attributes
by a Search Request [RFC2251] with '+' (ASCII 43) filter.
@@ -177,9 +142,9 @@ def test_search_basic(topology, test_user, user_aci, add_attr,
"""
if regular_user:
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
else:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
search_filter = ['+']
if add_attr:
@@ -188,9 +153,9 @@ def test_search_basic(topology, test_user, user_aci, add_attr,
else:
expected_attrs = sorted(oper_attr_list)
- entries = topology.standalone.search_s(search_suffix, ldap.SCOPE_BASE,
- '(objectclass=*)',
- search_filter)
+ entries = topology_st.standalone.search_s(search_suffix, ldap.SCOPE_BASE,
+ '(objectclass=*)',
+ search_filter)
found_attrs = sorted(entries[0].data.keys())
if add_attr == '*':
diff --git a/dirsrvtests/tests/suites/get_effective_rights/ger_test.py
b/dirsrvtests/tests/suites/get_effective_rights/ger_test.py
deleted file mode 100644
index 57c97c3..0000000
--- a/dirsrvtests/tests/suites/get_effective_rights/ger_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_ger_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_ger_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
b/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
index 805dd89..2bae81d 100644
--- a/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
+++ b/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
@@ -1,3 +1,11 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
import os
import sys
import time
@@ -11,7 +19,7 @@ from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
from lib389.mit_krb5 import MitKrb5
-
+from lib389.topologies import topology_m2
#########################################
#
@@ -34,94 +42,33 @@ REALM = "EXAMPLE.COM"
HOST_MASTER_1 = 'ldapkdc1.example.com'
HOST_MASTER_2 = 'ldapkdc2.example.com'
-class TopologyReplication(object):
- def __init__(self, master1, master2):
- master1.open()
- self.master1 = master1
- master2.open()
- self.master2 = master2
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- return
- # Create the realm first
- krb = MitKrb5(realm=REALM)
- if krb.check_realm():
- krb.destroy_realm()
- krb.create_realm()
- DEBUG = False
-
- # Creating master 1...
- master1 = DirSrv(verbose=DEBUG)
- args_instance[SER_HOST] = HOST_MASTER_1
- args_instance[SER_PORT] = PORT_MASTER_1
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_instance[SER_REALM] = REALM
- args_instance[SER_STRICT_HOSTNAME_CHECKING] = False
- args_master = args_instance.copy()
- master1.allocate(args_master)
- instance_master1 = master1.exists()
- if instance_master1:
- master1.delete()
- master1.create() # There is some magic in .create that finds the realm, and adds the
keytab for us.
- master1.open()
- master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_1)
-
- # Creating master 2...
- master2 = DirSrv(verbose=DEBUG)
- args_instance[SER_HOST] = HOST_MASTER_2
- args_instance[SER_PORT] = PORT_MASTER_2
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_instance[SER_REALM] = REALM
- args_instance[SER_STRICT_HOSTNAME_CHECKING] = False
- args_master = args_instance.copy()
- master2.allocate(args_master)
- instance_master2 = master2.exists()
- if instance_master2:
- master2.delete()
- master2.create()
- master2.open()
- master2.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_2)
-
- # Delete each instance in the end
- def fin():
- master1.delete()
- master2.delete()
- if krb.check_realm():
- krb.destroy_realm()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- master1.clearTmpDir(__file__)
-
- return TopologyReplication(master1, master2)
def _create_machine_ou(inst):
- inst.add_s( Entry(( "ou=Machines,%s" % DEFAULT_SUFFIX, {
- 'objectClass' : 'top organizationalUnit'.split(),
- 'ou' : 'Machines'
- }
- ))
- )
+ inst.add_s(Entry(("ou=Machines,%s" % DEFAULT_SUFFIX, {
+ 'objectClass': 'top organizationalUnit'.split(),
+ 'ou': 'Machines'
+ }
+ ))
+ )
+
def _create_machine_account(inst, name):
# Create the simple security objects for the servers to replicate to
- inst.add_s( Entry(( "uid=%s,ou=Machines,%s" % (name, DEFAULT_SUFFIX),
- {
- 'objectClass' : 'top account'.split(),
- 'uid' : name
- }
- )))
+ inst.add_s(Entry(("uid=%s,ou=Machines,%s" % (name, DEFAULT_SUFFIX),
+ {
+ 'objectClass': 'top account'.split(),
+ 'uid': name
+ }
+ )))
+
def _check_machine_account(inst, name):
- r = inst.search_s( 'ou=Machines,%s' % DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
'(uid=%s)' % name)
+ r = inst.search_s('ou=Machines,%s' % DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
'(uid=%s)' % name)
if len(r) > 0:
return True
return False
+
def _allow_machine_account(inst, name):
# First we need to get the mapping tree dn
mt = inst.mappingtree.list(suffix=DEFAULT_SUFFIX)[0]
@@ -129,15 +76,15 @@ def _allow_machine_account(inst, name):
(ldap.MOD_REPLACE, 'nsDS5ReplicaBindDN',
"uid=%s,ou=Machines,%s" % (name, DEFAULT_SUFFIX))
])
-def test_gssapi_repl(topology):
- """
- Create a kdc, then using that, provision two masters which have a gssapi
+
+def test_gssapi_repl(topology_m2):
+ """Create a kdc, then using that, provision two masters which have a
gssapi
authenticated replication agreement.
"""
- return
- master1 = topology.master1
- master2 = topology.master2
+ return
+ master1 = topology_m2.ms["master1"]
+ master2 = topology_m2.ms["master2"]
# Create the locations on each master for the other to bind to.
_create_machine_ou(master1)
@@ -158,8 +105,8 @@ def test_gssapi_repl(topology):
# Creating agreement from master 1 to master 2
# Set the replica bind method to sasl gssapi
- properties = {RA_NAME: r'meTo_$host:$port',
- RA_METHOD: 'SASL/GSSAPI',
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_METHOD: 'SASL/GSSAPI',
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
m1_m2_agmt = master1.agreement.create(suffix=SUFFIX, host=master2.host,
port=master2.port, properties=properties)
if not m1_m2_agmt:
@@ -170,8 +117,8 @@ def test_gssapi_repl(topology):
# Creating agreement from master 2 to master 1
# Set the replica bind method to sasl gssapi
- properties = {RA_NAME: r'meTo_$host:$port',
- RA_METHOD: 'SASL/GSSAPI',
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_METHOD: 'SASL/GSSAPI',
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
m2_m1_agmt = master2.agreement.create(suffix=SUFFIX, host=master1.host,
port=master1.port, properties=properties)
if not m2_m1_agmt:
@@ -199,15 +146,12 @@ def test_gssapi_repl(topology):
_create_machine_account(master1, 'http/one.example.com')
# Check it's on 2
time.sleep(5)
- assert(_check_machine_account(master2, 'http/one.example.com'))
+ assert (_check_machine_account(master2, 'http/one.example.com'))
# Add a user to master 2
_create_machine_account(master2, 'http/two.example.com')
# Check it's on 1
time.sleep(5)
- assert(_check_machine_account(master2, 'http/two.example.com'))
-
-
- log.info('Test complete')
+ assert (_check_machine_account(master2, 'http/two.example.com'))
if __name__ == '__main__':
diff --git a/dirsrvtests/tests/suites/ldapi/ldapi_test.py
b/dirsrvtests/tests/suites/ldapi/ldapi_test.py
deleted file mode 100644
index 2c30fc0..0000000
--- a/dirsrvtests/tests/suites/ldapi/ldapi_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_ldapi_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_ldapi_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/linkedattrs_plugin/linked_attrs_test.py
b/dirsrvtests/tests/suites/linkedattrs_plugin/linked_attrs_test.py
deleted file mode 100644
index 461da3f..0000000
--- a/dirsrvtests/tests/suites/linkedattrs_plugin/linked_attrs_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_linked_attrs_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_linked_attrs_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/mapping_tree/mapping_tree_test.py
b/dirsrvtests/tests/suites/mapping_tree/mapping_tree_test.py
deleted file mode 100644
index d7a436b..0000000
--- a/dirsrvtests/tests/suites/mapping_tree/mapping_tree_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_mapping_tree_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_mapping_tree_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/memberof_plugin/memberof_test.py
b/dirsrvtests/tests/suites/memberof_plugin/memberof_test.py
index 2123a7c..7ded0f4 100644
--- a/dirsrvtests/tests/suites/memberof_plugin/memberof_test.py
+++ b/dirsrvtests/tests/suites/memberof_plugin/memberof_test.py
@@ -1,12 +1,11 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
#
-
import os
import sys
import time
@@ -19,10 +18,10 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
MEMBEROF_PLUGIN_DN = ('cn=' + PLUGIN_MEMBER_OF +
',cn=plugins,cn=config')
USER1_DN = 'uid=user1,' + DEFAULT_SUFFIX
@@ -30,69 +29,31 @@ USER2_DN = 'uid=user2,' + DEFAULT_SUFFIX
GROUP_DN = 'cn=group,' + DEFAULT_SUFFIX
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Delete each instance in the end
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
-
-def test_memberof_auto_add_oc(topology):
- """
- Test the auto add objectclass feature. The plugin should add a predefined
+def test_memberof_auto_add_oc(topology_st):
+ """Test the auto add objectclass feature. The plugin should add a
predefined
objectclass that will allow memberOf to be added to an entry.
"""
# enable dynamic plugins
try:
- topology.standalone.modify_s(DN_CONFIG,
- [(ldap.MOD_REPLACE,
- 'nsslapd-dynamic-plugins',
- 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG,
+ [(ldap.MOD_REPLACE,
+ 'nsslapd-dynamic-plugins',
+ 'on')])
except ldap.LDAPError as e:
ldap.error('Failed to enable dynamic plugins! ' +
e.message['desc'])
assert False
# Enable the plugin
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
# First test invalid value (config validation)
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
try:
- topology.standalone.modify_s(MEMBEROF_PLUGIN_DN,
- [(ldap.MOD_REPLACE,
- 'memberofAutoAddOC',
- 'invalid123')])
+ topology_st.standalone.modify_s(MEMBEROF_PLUGIN_DN,
+ [(ldap.MOD_REPLACE,
+ 'memberofAutoAddOC',
+ 'invalid123')])
log.fatal('Incorrectly added invalid objectclass!')
assert False
except ldap.UNWILLING_TO_PERFORM:
@@ -102,65 +63,65 @@ def test_memberof_auto_add_oc(topology):
assert False
# Add valid objectclass
- topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
try:
- topology.standalone.modify_s(MEMBEROF_PLUGIN_DN,
- [(ldap.MOD_REPLACE,
- 'memberofAutoAddOC',
- 'inetuser')])
+ topology_st.standalone.modify_s(MEMBEROF_PLUGIN_DN,
+ [(ldap.MOD_REPLACE,
+ 'memberofAutoAddOC',
+ 'inetuser')])
except ldap.LDAPError as e:
log.fatal('Failed to configure memberOf plugin: error ' +
e.message['desc'])
assert False
# Add two users
try:
- topology.standalone.add_s(Entry((USER1_DN,
- {'objectclass': 'top',
- 'objectclass': 'person',
- 'objectclass':
'organizationalPerson',
- 'objectclass':
'inetorgperson',
- 'sn': 'last',
- 'cn': 'full',
- 'givenname': 'user1',
- 'uid': 'user1'
- })))
+ topology_st.standalone.add_s(Entry((USER1_DN,
+ {'objectclass': 'top',
+ 'objectclass': 'person',
+ 'objectclass':
'organizationalPerson',
+ 'objectclass':
'inetorgperson',
+ 'sn': 'last',
+ 'cn': 'full',
+ 'givenname': 'user1',
+ 'uid': 'user1'
+ })))
except ldap.LDAPError as e:
log.fatal('Failed to add user1 entry, error: ' +
e.message['desc'])
assert False
try:
- topology.standalone.add_s(Entry((USER2_DN,
- {'objectclass': 'top',
- 'objectclass': 'person',
- 'objectclass':
'organizationalPerson',
- 'objectclass':
'inetorgperson',
- 'sn': 'last',
- 'cn': 'full',
- 'givenname': 'user2',
- 'uid': 'user2'
- })))
+ topology_st.standalone.add_s(Entry((USER2_DN,
+ {'objectclass': 'top',
+ 'objectclass': 'person',
+ 'objectclass':
'organizationalPerson',
+ 'objectclass':
'inetorgperson',
+ 'sn': 'last',
+ 'cn': 'full',
+ 'givenname': 'user2',
+ 'uid': 'user2'
+ })))
except ldap.LDAPError as e:
log.fatal('Failed to add user2 entry, error: ' +
e.message['desc'])
assert False
# Add a group(that already includes one user
try:
- topology.standalone.add_s(Entry((GROUP_DN,
- {'objectclass': 'top',
- 'objectclass': 'groupOfNames',
- 'cn': 'group',
- 'member': USER1_DN
- })))
+ topology_st.standalone.add_s(Entry((GROUP_DN,
+ {'objectclass': 'top',
+ 'objectclass':
'groupOfNames',
+ 'cn': 'group',
+ 'member': USER1_DN
+ })))
except ldap.LDAPError as e:
log.fatal('Failed to add group entry, error: ' +
e.message['desc'])
assert False
# Add a user to the group
try:
- topology.standalone.modify_s(GROUP_DN,
- [(ldap.MOD_ADD,
- 'member',
- USER2_DN)])
+ topology_st.standalone.modify_s(GROUP_DN,
+ [(ldap.MOD_ADD,
+ 'member',
+ USER2_DN)])
except ldap.LDAPError as e:
log.fatal('Failed to add user2 to group: error ' +
e.message['desc'])
assert False
@@ -172,4 +133,4 @@ if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
\ No newline at end of file
+ pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/memory_leaks/range_search_test.py
b/dirsrvtests/tests/suites/memory_leaks/range_search_test.py
index d8d591f..0c8e100 100644
--- a/dirsrvtests/tests/suites/memory_leaks/range_search_test.py
+++ b/dirsrvtests/tests/suites/memory_leaks/range_search_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -18,82 +18,51 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
@pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- def fin():
- standalone.delete()
- if not standalone.has_asan():
- sbin_dir = standalone.get_sbin_dir()
- valgrind_disable(sbin_dir)
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_range_search_init(topology):
- '''
- Enable retro cl, and valgrind. Since valgrind tests move the ns-slapd binary
+def setup(topology_st, request):
+ """Enable retro cl, and valgrind. Since valgrind tests move the
ns-slapd binary
around it's important to always "valgrind_disable" before "assert
False"ing,
otherwise we leave the wrong ns-slapd in place if there is a failure
- '''
+ """
log.info('Initializing test_range_search...')
- topology.standalone.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
+ topology_st.standalone.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
# First stop the instance
- topology.standalone.stop(timeout=30)
+ topology_st.standalone.stop(timeout=30)
# Get the sbin directory so we know where to replace 'ns-slapd'
- sbin_dir = get_sbin_dir(prefix=topology.standalone.prefix)
+ sbin_dir = get_sbin_dir(prefix=topology_st.standalone.prefix)
# Enable valgrind
- if not topology.standalone.has_asan():
+ if not topology_st.standalone.has_asan():
valgrind_enable(sbin_dir)
+ def fin():
+ if not topology_st.standalone.has_asan():
+ topology_st.standalone.stop(timeout=30)
+ sbin_dir = topology_st.standalone.get_sbin_dir()
+ valgrind_disable(sbin_dir)
+ topology_st.standalone.start()
+
+ request.addfinalizer(fin)
+
# Now start the server with a longer timeout
- topology.standalone.start()
+ topology_st.standalone.start()
-def test_range_search(topology):
- '''
- Add a 100 entries, and run a range search. When we encounter an error we
- still need to disable valgrind before exiting
- '''
+def test_range_search(topology_st, setup):
+ """Add a 100 entries, and run a range search.
+ When we encounter an error we still need to
+ disable valgrind before exiting
+ """
log.info('Running test_range_search...')
@@ -104,37 +73,34 @@ def test_range_search(topology):
idx = str(idx)
USER_DN = 'uid=user' + idx + ',' + DEFAULT_SUFFIX
try:
- topology.standalone.add_s(Entry((USER_DN, {'objectclass': "top
extensibleObject".split(),
- 'uid': 'user' + idx})))
+ topology_st.standalone.add_s(Entry((USER_DN, {'objectclass':
"top extensibleObject".split(),
+ 'uid': 'user' +
idx})))
except ldap.LDAPError as e:
log.fatal('test_range_search: Failed to add test user ' + USER_DN +
': error ' + e.message['desc'])
success = False
time.sleep(1)
+ # Issue range search
if success:
- # Issue range search
try:
- topology.standalone.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE,
-
'(&(changenumber>=74)(changenumber<=84))')
+ topology_st.standalone.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE,
+
'(&(changenumber>=74)(changenumber<=84))')
except ldap.LDAPError as e:
log.fatal('test_range_search: Failed to search retro changelog(%s),
error: %s' %
(RETROCL_SUFFIX, e.message('desc')))
success = False
- if success and not topology.standalone.has_asan():
+ if success and not topology_st.standalone.has_asan():
# Get the results file, stop the server, and check for the leak
- results_file = valgrind_get_results_file(topology.standalone)
- topology.standalone.stop(timeout=30)
+ results_file = valgrind_get_results_file(topology_st.standalone)
+ topology_st.standalone.stop(timeout=30)
if valgrind_check_file(results_file, VALGRIND_LEAK_STR,
'range_candidates'):
log.fatal('test_range_search: Memory leak is still present!')
assert False
- log.info('test_range_search: PASSED')
-
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s %s" % CURRENT_FILE)
-
diff --git a/dirsrvtests/tests/suites/monitor/monitor_test.py
b/dirsrvtests/tests/suites/monitor/monitor_test.py
deleted file mode 100644
index c1fc303..0000000
--- a/dirsrvtests/tests/suites/monitor/monitor_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_monitor_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_monitor_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/paged_results/paged_results_test.py
b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
index 273d2eb..774b255 100644
--- a/dirsrvtests/tests/suites/paged_results/paged_results_test.py
+++ b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
@@ -17,6 +17,7 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
from sss_control import SSSRequestControl
DEBUGGING = False
@@ -39,55 +40,22 @@ NEW_BACKEND_1 = 'parent_base'
NEW_BACKEND_2 = 'child_base'
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Delete each instance in the end
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
-
@pytest.fixture(scope="module")
-def test_user(topology, request):
+def test_user(topology_st, request):
"""User for binding operation"""
log.info('Adding user {}'.format(TEST_USER_DN))
try:
- topology.standalone.add_s(Entry((TEST_USER_DN, {
- 'objectclass': 'top
person'.split(),
- 'objectclass':
'organizationalPerson',
- 'objectclass': 'inetorgperson',
- 'cn': TEST_USER_NAME,
- 'sn': TEST_USER_NAME,
- 'userpassword': TEST_USER_PWD,
- 'mail': '%s(a)redhat.com' %
TEST_USER_NAME,
- 'uid': TEST_USER_NAME
- })))
+ topology_st.standalone.add_s(Entry((TEST_USER_DN, {
+ 'objectclass': 'top person'.split(),
+ 'objectclass': 'organizationalPerson',
+ 'objectclass': 'inetorgperson',
+ 'cn': TEST_USER_NAME,
+ 'sn': TEST_USER_NAME,
+ 'userpassword': TEST_USER_PWD,
+ 'mail': '%s(a)redhat.com' % TEST_USER_NAME,
+ 'uid': TEST_USER_NAME
+ })))
except ldap.LDAPError as e:
log.error('Failed to add user (%s): error (%s)' % (TEST_USER_DN,
e.message['desc']))
@@ -95,45 +63,46 @@ def test_user(topology, request):
def fin():
log.info('Deleting user {}'.format(TEST_USER_DN))
- topology.standalone.delete_s(TEST_USER_DN)
+ topology_st.standalone.delete_s(TEST_USER_DN)
+
request.addfinalizer(fin)
@pytest.fixture(scope="module")
-def new_suffixes(topology):
+def new_suffixes(topology_st):
"""Add two suffixes with backends, one is a parent
of the another
"""
log.info('Adding suffix:{} and backend: {}'.format(NEW_SUFFIX_1,
NEW_BACKEND_1))
- topology.standalone.backend.create(NEW_SUFFIX_1,
- {BACKEND_NAME: NEW_BACKEND_1})
- topology.standalone.mappingtree.create(NEW_SUFFIX_1,
- bename=NEW_BACKEND_1)
+ topology_st.standalone.backend.create(NEW_SUFFIX_1,
+ {BACKEND_NAME: NEW_BACKEND_1})
+ topology_st.standalone.mappingtree.create(NEW_SUFFIX_1,
+ bename=NEW_BACKEND_1)
try:
- topology.standalone.add_s(Entry((NEW_SUFFIX_1, {
- 'objectclass': 'top',
- 'objectclass': 'organization',
- 'o': NEW_SUFFIX_1_NAME
- })))
+ topology_st.standalone.add_s(Entry((NEW_SUFFIX_1, {
+ 'objectclass': 'top',
+ 'objectclass': 'organization',
+ 'o': NEW_SUFFIX_1_NAME
+ })))
except ldap.LDAPError as e:
log.error('Failed to add suffix ({}): error ({})'.format(NEW_SUFFIX_1,
e.message['desc']))
raise
log.info('Adding suffix:{} and backend: {}'.format(NEW_SUFFIX_2,
NEW_BACKEND_2))
- topology.standalone.backend.create(NEW_SUFFIX_2,
- {BACKEND_NAME: NEW_BACKEND_2})
- topology.standalone.mappingtree.create(NEW_SUFFIX_2,
- bename=NEW_BACKEND_2,
- parent=NEW_SUFFIX_1)
+ topology_st.standalone.backend.create(NEW_SUFFIX_2,
+ {BACKEND_NAME: NEW_BACKEND_2})
+ topology_st.standalone.mappingtree.create(NEW_SUFFIX_2,
+ bename=NEW_BACKEND_2,
+ parent=NEW_SUFFIX_1)
try:
- topology.standalone.add_s(Entry((NEW_SUFFIX_2, {
- 'objectclass': 'top',
- 'objectclass':
'organizationalunit',
- 'ou': NEW_SUFFIX_2_NAME
- })))
+ topology_st.standalone.add_s(Entry((NEW_SUFFIX_2, {
+ 'objectclass': 'top',
+ 'objectclass': 'organizationalunit',
+ 'ou': NEW_SUFFIX_2_NAME
+ })))
except ldap.LDAPError as e:
log.error('Failed to add suffix ({}): error ({})'.format(NEW_SUFFIX_2,
e.message['desc']))
@@ -146,10 +115,10 @@ def new_suffixes(topology):
ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
- topology.standalone.modify_s(NEW_SUFFIX_1, mod)
+ topology_st.standalone.modify_s(NEW_SUFFIX_1, mod)
-def add_users(topology, users_num, suffix):
+def add_users(topology_st, users_num, suffix):
"""Add users to the default suffix
Return the list of added user DNs.
@@ -163,15 +132,15 @@ def add_users(topology, users_num, suffix):
USER_DN = 'uid=%s,%s' % (USER_NAME, suffix)
users_list.append(USER_DN)
try:
- topology.standalone.add_s(Entry((USER_DN, {
- 'objectclass': 'top
person'.split(),
- 'objectclass':
'organizationalPerson',
- 'objectclass':
'inetorgperson',
- 'cn': USER_NAME,
- 'sn': USER_NAME,
- 'userpassword': 'pass%s' %
num_ran,
- 'mail': '%s(a)redhat.com' %
USER_NAME,
- 'uid': USER_NAME})))
+ topology_st.standalone.add_s(Entry((USER_DN, {
+ 'objectclass': 'top person'.split(),
+ 'objectclass': 'organizationalPerson',
+ 'objectclass': 'inetorgperson',
+ 'cn': USER_NAME,
+ 'sn': USER_NAME,
+ 'userpassword': 'pass%s' % num_ran,
+ 'mail': '%s(a)redhat.com' % USER_NAME,
+ 'uid': USER_NAME})))
except ldap.LDAPError as e:
log.error('Failed to add user (%s): error (%s)' % (USER_DN,
e.message['desc']))
@@ -179,40 +148,40 @@ def add_users(topology, users_num, suffix):
return users_list
-def del_users(topology, users_list):
+def del_users(topology_st, users_list):
"""Delete users with DNs from given list"""
log.info('Deleting %d users' % len(users_list))
for user_dn in users_list:
try:
- topology.standalone.delete_s(user_dn)
+ topology_st.standalone.delete_s(user_dn)
except ldap.LDAPError as e:
log.error('Failed to delete user (%s): error (%s)' % (user_dn,
e.message['desc']))
raise e
-def change_conf_attr(topology, suffix, attr_name, attr_value):
+def change_conf_attr(topology_st, suffix, attr_name, attr_value):
"""Change configurational attribute in the given suffix.
Returns previous attribute value.
"""
try:
- entries = topology.standalone.search_s(suffix, ldap.SCOPE_BASE,
- 'objectclass=top',
- [attr_name])
+ entries = topology_st.standalone.search_s(suffix, ldap.SCOPE_BASE,
+ 'objectclass=top',
+ [attr_name])
attr_value_bck = entries[0].data.get(attr_name)
log.info('Set %s to %s. Previous value - %s. Modified suffix - %s.' % (
- attr_name, attr_value, attr_value_bck, suffix))
+ attr_name, attr_value, attr_value_bck, suffix))
if attr_value is None:
- topology.standalone.modify_s(suffix, [(ldap.MOD_DELETE,
- attr_name,
- attr_value)])
+ topology_st.standalone.modify_s(suffix, [(ldap.MOD_DELETE,
+ attr_name,
+ attr_value)])
else:
- topology.standalone.modify_s(suffix, [(ldap.MOD_REPLACE,
- attr_name,
- attr_value)])
+ topology_st.standalone.modify_s(suffix, [(ldap.MOD_REPLACE,
+ attr_name,
+ attr_value)])
except ldap.LDAPError as e:
log.error('Failed to change attr value (%s): error (%s)' % (attr_name,
e.message['desc']))
@@ -221,7 +190,7 @@ def change_conf_attr(topology, suffix, attr_name, attr_value):
return attr_value_bck
-def paged_search(topology, suffix, controls, search_flt, searchreq_attrlist):
+def paged_search(topology_st, suffix, controls, search_flt, searchreq_attrlist):
"""Search at the DEFAULT_SUFFIX with ldap.SCOPE_SUBTREE
using Simple Paged Control(should the first item in the
list controls.
@@ -240,14 +209,14 @@ def paged_search(topology, suffix, controls, search_flt,
searchreq_attrlist):
searchreq_attrlist,
req_pr_ctrl.size,
str(controls)))
- msgid = topology.standalone.search_ext(suffix,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
+ msgid = topology_st.standalone.search_ext(suffix,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
while True:
log.info('Getting page %d' % (pages,))
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
log.debug('Data: {}'.format(rdata))
all_results.extend(rdata)
pages += 1
@@ -255,18 +224,18 @@ def paged_search(topology, suffix, controls, search_flt,
searchreq_attrlist):
c
for c in rctrls
if c.controlType == SimplePagedResultsControl.controlType
- ]
+ ]
if pctrls:
if pctrls[0].cookie:
# Copy cookie from response control to request control
log.debug('Cookie: {}'.format(pctrls[0].cookie))
req_pr_ctrl.cookie = pctrls[0].cookie
- msgid = topology.standalone.search_ext(suffix,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
+ msgid = topology_st.standalone.search_ext(suffix,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
else:
break # No more pages available
else:
@@ -278,7 +247,7 @@ def paged_search(topology, suffix, controls, search_flt,
searchreq_attrlist):
@pytest.mark.parametrize("page_size,users_num",
[(6, 5), (5, 5), (5, 25)])
-def test_search_success(topology, test_user, page_size, users_num):
+def test_search_success(topology_st, test_user, page_size, users_num):
"""Verify that search with a simple paged results control
returns all entries it should without errors.
@@ -293,40 +262,39 @@ def test_search_success(topology, test_user, page_size, users_num):
:Assert: All users should be found
"""
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
- all_results = paged_search(topology, DEFAULT_SUFFIX, [req_ctrl],
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, [req_ctrl],
search_flt, searchreq_attrlist)
log.info('%d results' % len(all_results))
assert len(all_results) == len(users_list)
finally:
log.info('Set Directory Manager bind back (test_search_success)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
-
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
@pytest.mark.parametrize("page_size,users_num,suffix,attr_name,attr_value,expected_err",
[
- (50, 200, 'cn=config,%s' % DN_LDBM,
'nsslapd-idlistscanlimit', '100',
- ldap.UNWILLING_TO_PERFORM),
- (5, 15, DN_CONFIG, 'nsslapd-timelimit', '20',
- ldap.UNAVAILABLE_CRITICAL_EXTENSION),
- (21, 50, DN_CONFIG, 'nsslapd-sizelimit', '20',
- ldap.SIZELIMIT_EXCEEDED),
- (21, 50, DN_CONFIG, 'nsslapd-pagedsizelimit',
'5',
- ldap.SIZELIMIT_EXCEEDED),
- (5, 50, 'cn=config,%s' % DN_LDBM,
'nsslapd-lookthroughlimit', '20',
- ldap.ADMINLIMIT_EXCEEDED)])
-def test_search_limits_fail(topology, test_user, page_size, users_num,
+ (50, 200, 'cn=config,%s' % DN_LDBM, 'nsslapd-idlistscanlimit',
'100',
+ ldap.UNWILLING_TO_PERFORM),
+ (5, 15, DN_CONFIG, 'nsslapd-timelimit', '20',
+ ldap.UNAVAILABLE_CRITICAL_EXTENSION),
+ (21, 50, DN_CONFIG, 'nsslapd-sizelimit', '20',
+ ldap.SIZELIMIT_EXCEEDED),
+ (21, 50, DN_CONFIG, 'nsslapd-pagedsizelimit', '5',
+ ldap.SIZELIMIT_EXCEEDED),
+ (5, 50, 'cn=config,%s' % DN_LDBM, 'nsslapd-lookthroughlimit',
'20',
+ ldap.ADMINLIMIT_EXCEEDED)])
+def test_search_limits_fail(topology_st, test_user, page_size, users_num,
suffix, attr_name, attr_value, expected_err):
"""Verify that search with a simple paged results control
throws expected exceptoins when corresponding limits are
@@ -345,8 +313,8 @@ def test_search_limits_fail(topology, test_user, page_size,
users_num,
:Assert: Should fail with appropriate exception
"""
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
- attr_value_bck = change_conf_attr(topology, suffix, attr_name, attr_value)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
+ attr_value_bck = change_conf_attr(topology_st, suffix, attr_name, attr_value)
conf_param_dict = {attr_name: attr_value}
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
@@ -354,7 +322,7 @@ def test_search_limits_fail(topology, test_user, page_size,
users_num,
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
@@ -363,11 +331,11 @@ def test_search_limits_fail(topology, test_user, page_size,
users_num,
sort_ctrl = SSSRequestControl(True, ['sn'])
controls.append(sort_ctrl)
log.info('Initiate ldapsearch with created control instance')
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
time_val = conf_param_dict.get('nsslapd-timelimit')
if time_val:
@@ -380,42 +348,42 @@ def test_search_limits_fail(topology, test_user, page_size,
users_num,
log.info('Getting page %d' % (pages,))
if pages == 0 and (time_val or attr_name in
('nsslapd-lookthroughlimit',
'nsslapd-pagesizelimit')):
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
else:
with pytest.raises(expected_err):
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
all_results.extend(rdata)
pages += 1
pctrls = [
c
for c in rctrls
if c.controlType == SimplePagedResultsControl.controlType
- ]
+ ]
if pctrls:
if pctrls[0].cookie:
# Copy cookie from response control to request control
req_ctrl.cookie = pctrls[0].cookie
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
else:
break # No more pages available
else:
break
finally:
if expected_err == ldap.UNAVAILABLE_CRITICAL_EXTENSION:
- topology.standalone.open()
+ topology_st.standalone.open()
log.info('Set Directory Manager bind back (test_search_limits_fail)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
- change_conf_attr(topology, suffix, attr_name, attr_value_bck)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
+ change_conf_attr(topology_st, suffix, attr_name, attr_value_bck)
-def test_search_sort_success(topology, test_user):
+def test_search_sort_success(topology_st, test_user):
"""Verify that search with a simple paged results control
and a server side sort control returns all entries
it should without errors.
@@ -434,13 +402,13 @@ def test_search_sort_success(topology, test_user):
users_num = 50
page_size = 5
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
sort_ctrl = SSSRequestControl(True, ['sn'])
@@ -448,21 +416,21 @@ def test_search_sort_success(topology, test_user):
log.info('Initiate ldapsearch with created control instance')
log.info('Collect data with sorting')
controls = [req_ctrl, sort_ctrl]
- results_sorted = paged_search(topology, DEFAULT_SUFFIX, controls,
+ results_sorted = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
log.info('Substring numbers from user DNs')
r_nums = map(lambda x: int(x[0][8:13]), results_sorted)
log.info('Assert that list is sorted')
- assert all(r_nums[i] <= r_nums[i+1] for i in range(len(r_nums)-1))
+ assert all(r_nums[i] <= r_nums[i + 1] for i in range(len(r_nums) - 1))
finally:
log.info('Set Directory Manager bind back (test_search_sort_success)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
-def test_search_abandon(topology, test_user):
+def test_search_abandon(topology_st, test_user):
"""Verify that search with simple paged results control
can be abandon
@@ -481,37 +449,37 @@ def test_search_abandon(topology, test_user):
users_num = 10
page_size = 2
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
controls = [req_ctrl]
log.info('Initiate a search with a paged results control')
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
log.info('Abandon the search')
- topology.standalone.abandon(msgid)
+ topology_st.standalone.abandon(msgid)
log.info('Expect an ldap.TIMEOUT exception, while trying to get the search
results')
with pytest.raises(ldap.TIMEOUT):
- topology.standalone.result3(msgid, timeout=5)
+ topology_st.standalone.result3(msgid, timeout=5)
finally:
log.info('Set Directory Manager bind back (test_search_abandon)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
-def test_search_with_timelimit(topology, test_user):
+def test_search_with_timelimit(topology_st, test_user):
"""Verify that after performing multiple simple paged searches
to completion, each with a timelimit, it wouldn't fail, if we sleep
for a time more than the timelimit.
@@ -533,13 +501,13 @@ def test_search_with_timelimit(topology, test_user):
users_num = 100
page_size = 50
timelimit = 5
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
@@ -547,52 +515,52 @@ def test_search_with_timelimit(topology, test_user):
for ii in range(3):
log.info('Iteration %d' % ii)
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls,
- timeout=timelimit)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls,
+ timeout=timelimit)
pages = 0
pctrls = []
while True:
log.info('Getting page %d' % (pages,))
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
pages += 1
pctrls = [
c
for c in rctrls
if c.controlType == SimplePagedResultsControl.controlType
- ]
+ ]
if pctrls:
if pctrls[0].cookie:
# Copy cookie from response control to request control
req_ctrl.cookie = pctrls[0].cookie
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls,
- timeout=timelimit)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls,
+ timeout=timelimit)
else:
log.info('Done with this search - sleeping %d seconds' %
(
- timelimit * 2))
+ timelimit * 2))
time.sleep(timelimit * 2)
break # No more pages available
else:
break
finally:
log.info('Set Directory Manager bind back (test_search_with_timelimit)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
@pytest.mark.parametrize('aci_subject',
('dns = "localhost.localdomain"',
'ip = "::1" or ip = "127.0.0.1"'))
-def test_search_dns_ip_aci(topology, test_user, aci_subject):
+def test_search_dns_ip_aci(topology_st, test_user, aci_subject):
"""Verify that after performing multiple simple paged searches
to completion on the suffix with DNS or IP based ACI
@@ -615,13 +583,13 @@ def test_search_dns_ip_aci(topology, test_user, aci_subject):
users_num = 100
page_size = 5
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Back up current suffix ACI')
- acis_bck = topology.standalone.aci.list(DEFAULT_SUFFIX, ldap.SCOPE_BASE)
+ acis_bck = topology_st.standalone.aci.list(DEFAULT_SUFFIX, ldap.SCOPE_BASE)
log.info('Add test ACI')
ACI_TARGET = '(targetattr != "userPassword")'
@@ -629,15 +597,15 @@ def test_search_dns_ip_aci(topology, test_user, aci_subject):
ACI_SUBJECT = '(userdn = "ldap:///anyone") and (%s);)' %
aci_subject
ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
try:
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_REPLACE,
- 'aci',
- ACI_BODY)])
+ topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_REPLACE,
+ 'aci',
+ ACI_BODY)])
except ldap.LDAPError as e:
log.fatal('Failed to add ACI: error (%s)' %
(e.message['desc']))
raise e
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
@@ -646,7 +614,7 @@ def test_search_dns_ip_aci(topology, test_user, aci_subject):
log.info('Initiate three searches with a paged results control')
for ii in range(3):
log.info('%d search' % (ii + 1))
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
log.info('%d results' % len(all_results))
assert len(all_results) == len(users_list)
@@ -654,19 +622,19 @@ def test_search_dns_ip_aci(topology, test_user, aci_subject):
finally:
log.info('Set Directory Manager bind back (test_search_dns_ip_aci)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
log.info('Restore ACI')
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_DELETE,
- 'aci',
- None)])
+ topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_DELETE,
+ 'aci',
+ None)])
for aci in acis_bck:
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD,
- 'aci',
- aci.getRawAci())])
- del_users(topology, users_list)
+ topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD,
+ 'aci',
+ aci.getRawAci())])
+ del_users(topology_st, users_list)
-def test_search_multiple_paging(topology, test_user):
+def test_search_multiple_paging(topology_st, test_user):
"""Verify that after performing multiple simple paged searches
on a single connection without a complition, it wouldn't fail.
@@ -685,13 +653,13 @@ def test_search_multiple_paging(topology, test_user):
users_num = 100
page_size = 30
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
@@ -699,33 +667,33 @@ def test_search_multiple_paging(topology, test_user):
for ii in range(3):
log.info('Iteration %d' % ii)
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
pctrls = [
c
for c in rctrls
if c.controlType == SimplePagedResultsControl.controlType
- ]
+ ]
# Copy cookie from response control to request control
req_ctrl.cookie = pctrls[0].cookie
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
finally:
log.info('Set Directory Manager bind back
(test_search_multiple_paging)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
@pytest.mark.parametrize("invalid_cookie", [1000, -1])
-def test_search_invalid_cookie(topology, test_user, invalid_cookie):
+def test_search_invalid_cookie(topology_st, test_user, invalid_cookie):
"""Verify that using invalid cookie while performing
search with the simple paged results control throws
a TypeError exception
@@ -745,41 +713,41 @@ def test_search_invalid_cookie(topology, test_user,
invalid_cookie):
users_num = 100
page_size = 50
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
controls = [req_ctrl]
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
log.info('Put an invalid cookie (%d) to the control. TypeError is
expected' %
invalid_cookie)
req_ctrl.cookie = invalid_cookie
with pytest.raises(TypeError):
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
finally:
log.info('Set Directory Manager bind back (test_search_invalid_cookie)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
-def test_search_abandon_with_zero_size(topology, test_user):
+def test_search_abandon_with_zero_size(topology_st, test_user):
"""Verify that search with simple paged results control
can be abandon using page_size = 0
@@ -797,37 +765,37 @@ def test_search_abandon_with_zero_size(topology, test_user):
users_num = 10
page_size = 0
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
controls = [req_ctrl]
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=controls)
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=controls)
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
pctrls = [
c
for c in rctrls
if c.controlType == SimplePagedResultsControl.controlType
- ]
+ ]
assert not pctrls[0].cookie
finally:
log.info('Set Directory Manager bind back
(test_search_abandon_with_zero_size)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
-def test_search_pagedsizelimit_success(topology, test_user):
+def test_search_pagedsizelimit_success(topology_st, test_user):
"""Verify that search with a simple paged results control
returns all entries it should without errors while
valid value set to nsslapd-pagedsizelimit.
@@ -849,20 +817,20 @@ def test_search_pagedsizelimit_success(topology, test_user):
page_size = 10
attr_name = 'nsslapd-pagedsizelimit'
attr_value = '20'
- attr_value_bck = change_conf_attr(topology, DN_CONFIG,
+ attr_value_bck = change_conf_attr(topology_st, DN_CONFIG,
attr_name, attr_value)
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
controls = [req_ctrl]
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
log.info('%d results' % len(all_results))
@@ -870,15 +838,15 @@ def test_search_pagedsizelimit_success(topology, test_user):
finally:
log.info('Set Directory Manager bind back
(test_search_pagedsizelimit_success)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
- change_conf_attr(topology, DN_CONFIG,
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
+ change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-pagedsizelimit', attr_value_bck)
@pytest.mark.parametrize('conf_attr,user_attr,expected_rs',
(('5', '15', 'PASS'), ('15',
'5', ldap.SIZELIMIT_EXCEEDED)))
-def test_search_nspagedsizelimit(topology, test_user,
+def test_search_nspagedsizelimit(topology_st, test_user,
conf_attr, user_attr, expected_rs):
"""Verify that nsPagedSizeLimit attribute overrides
nsslapd-pagedsizelimit while performing search with
@@ -909,17 +877,17 @@ def test_search_nspagedsizelimit(topology, test_user,
users_num = 10
page_size = 10
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
- conf_attr_bck = change_conf_attr(topology, DN_CONFIG,
+ conf_attr_bck = change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-pagedsizelimit', conf_attr)
- user_attr_bck = change_conf_attr(topology, TEST_USER_DN,
+ user_attr_bck = change_conf_attr(topology_st, TEST_USER_DN,
'nsPagedSizeLimit', user_attr)
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
controls = [req_ctrl]
@@ -927,29 +895,29 @@ def test_search_nspagedsizelimit(topology, test_user,
if expected_rs == ldap.SIZELIMIT_EXCEEDED:
log.info('Expect to fail with SIZELIMIT_EXCEEDED')
with pytest.raises(expected_rs):
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
elif expected_rs == 'PASS':
log.info('Expect to pass')
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
log.info('%d results' % len(all_results))
assert len(all_results) == len(users_list)
finally:
log.info('Set Directory Manager bind back
(test_search_nspagedsizelimit)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
- change_conf_attr(topology, DN_CONFIG,
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
+ change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-pagedsizelimit', conf_attr_bck)
- change_conf_attr(topology, TEST_USER_DN,
+ change_conf_attr(topology_st, TEST_USER_DN,
'nsPagedSizeLimit', user_attr_bck)
@pytest.mark.parametrize('conf_attr_values,expected_rs',
((('5000', '100', '100'),
ldap.ADMINLIMIT_EXCEEDED),
(('5000', '120', '122'),
'PASS')))
-def test_search_paged_limits(topology, test_user, conf_attr_values, expected_rs):
+def test_search_paged_limits(topology_st, test_user, conf_attr_values, expected_rs):
"""Verify that nsslapd-idlistscanlimit and
nsslapd-lookthroughlimit can limit the administrator
search abilities.
@@ -979,21 +947,21 @@ def test_search_paged_limits(topology, test_user, conf_attr_values,
expected_rs)
users_num = 101
page_size = 10
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
- size_attr_bck = change_conf_attr(topology, DN_CONFIG,
+ size_attr_bck = change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-sizelimit', conf_attr_values[0])
- pagedsize_attr_bck = change_conf_attr(topology, DN_CONFIG,
+ pagedsize_attr_bck = change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-pagedsizelimit',
conf_attr_values[0])
- idlistscan_attr_bck = change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ idlistscan_attr_bck = change_conf_attr(topology_st, 'cn=config,%s' %
DN_LDBM,
'nsslapd-idlistscanlimit',
conf_attr_values[1])
- lookthrough_attr_bck = change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ lookthrough_attr_bck = change_conf_attr(topology_st, 'cn=config,%s' %
DN_LDBM,
'nsslapd-lookthroughlimit',
conf_attr_values[2])
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
controls = [req_ctrl]
@@ -1001,32 +969,32 @@ def test_search_paged_limits(topology, test_user, conf_attr_values,
expected_rs)
if expected_rs == ldap.ADMINLIMIT_EXCEEDED:
log.info('Expect to fail with ADMINLIMIT_EXCEEDED')
with pytest.raises(expected_rs):
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
elif expected_rs == 'PASS':
log.info('Expect to pass')
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
log.info('%d results' % len(all_results))
assert len(all_results) == len(users_list)
finally:
log.info('Set Directory Manager bind back (test_search_paged_limits)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
- change_conf_attr(topology, DN_CONFIG,
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
+ change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-sizelimit', size_attr_bck)
- change_conf_attr(topology, DN_CONFIG,
+ change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-pagedsizelimit', pagedsize_attr_bck)
- change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ change_conf_attr(topology_st, 'cn=config,%s' % DN_LDBM,
'nsslapd-lookthroughlimit', lookthrough_attr_bck)
- change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ change_conf_attr(topology_st, 'cn=config,%s' % DN_LDBM,
'nsslapd-idlistscanlimit', idlistscan_attr_bck)
@pytest.mark.parametrize('conf_attr_values,expected_rs',
((('1000', '100', '100'),
ldap.ADMINLIMIT_EXCEEDED),
(('1000', '120', '122'),
'PASS')))
-def test_search_paged_user_limits(topology, test_user, conf_attr_values, expected_rs):
+def test_search_paged_user_limits(topology_st, test_user, conf_attr_values,
expected_rs):
"""Verify that nsPagedIDListScanLimit and nsPagedLookthroughLimit
override nsslapd-idlistscanlimit and nsslapd-lookthroughlimit
while performing search with the simple paged results control.
@@ -1057,21 +1025,21 @@ def test_search_paged_user_limits(topology, test_user,
conf_attr_values, expecte
users_num = 101
page_size = 10
- users_list = add_users(topology, users_num, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
- lookthrough_attr_bck = change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ lookthrough_attr_bck = change_conf_attr(topology_st, 'cn=config,%s' %
DN_LDBM,
'nsslapd-lookthroughlimit',
conf_attr_values[0])
- idlistscan_attr_bck = change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ idlistscan_attr_bck = change_conf_attr(topology_st, 'cn=config,%s' %
DN_LDBM,
'nsslapd-idlistscanlimit',
conf_attr_values[0])
- user_idlistscan_attr_bck = change_conf_attr(topology, TEST_USER_DN,
+ user_idlistscan_attr_bck = change_conf_attr(topology_st, TEST_USER_DN,
'nsPagedIDListScanLimit',
conf_attr_values[1])
- user_lookthrough_attr_bck = change_conf_attr(topology, TEST_USER_DN,
+ user_lookthrough_attr_bck = change_conf_attr(topology_st, TEST_USER_DN,
'nsPagedLookthroughLimit',
conf_attr_values[2])
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
controls = [req_ctrl]
@@ -1079,29 +1047,29 @@ def test_search_paged_user_limits(topology, test_user,
conf_attr_values, expecte
if expected_rs == ldap.ADMINLIMIT_EXCEEDED:
log.info('Expect to fail with ADMINLIMIT_EXCEEDED')
with pytest.raises(expected_rs):
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
elif expected_rs == 'PASS':
log.info('Expect to pass')
- all_results = paged_search(topology, DEFAULT_SUFFIX, controls,
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, controls,
search_flt, searchreq_attrlist)
log.info('%d results' % len(all_results))
assert len(all_results) == len(users_list)
finally:
log.info('Set Directory Manager bind back
(test_search_paged_user_limits)')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
- change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
+ change_conf_attr(topology_st, 'cn=config,%s' % DN_LDBM,
'nsslapd-lookthroughlimit', lookthrough_attr_bck)
- change_conf_attr(topology, 'cn=config,%s' % DN_LDBM,
+ change_conf_attr(topology_st, 'cn=config,%s' % DN_LDBM,
'nsslapd-idlistscanlimit', idlistscan_attr_bck)
- change_conf_attr(topology, TEST_USER_DN,
+ change_conf_attr(topology_st, TEST_USER_DN,
'nsPagedIDListScanLimit', user_idlistscan_attr_bck)
- change_conf_attr(topology, TEST_USER_DN,
+ change_conf_attr(topology_st, TEST_USER_DN,
'nsPagedLookthroughLimit', user_lookthrough_attr_bck)
-def test_ger_basic(topology, test_user):
+def test_ger_basic(topology_st, test_user):
"""Verify that search with a simple paged results control
and get effective rights control returns all entries
it should without errors.
@@ -1118,19 +1086,19 @@ def test_ger_basic(topology, test_user):
an 'attributeLevelRights' returned
"""
- users_list = add_users(topology, 20, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, 20, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
page_size = 4
try:
log.info('Set bind to directory manager')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
spr_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
ger_ctrl = GetEffectiveRightsControl(True, "dn: " + DN_DM)
- all_results = paged_search(topology, DEFAULT_SUFFIX, [spr_ctrl, ger_ctrl],
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, [spr_ctrl, ger_ctrl],
search_flt, searchreq_attrlist)
log.info('{} results'.format(len(all_results)))
@@ -1139,10 +1107,10 @@ def test_ger_basic(topology, test_user):
assert all(attrs['attributeLevelRights'][0] for dn, attrs in
all_results)
finally:
log.info('Remove added users')
- del_users(topology, users_list)
+ del_users(topology_st, users_list)
-def test_multi_suffix_search(topology, test_user, new_suffixes):
+def test_multi_suffix_search(topology_st, test_user, new_suffixes):
"""Verify that page result search returns empty cookie
if there is no returned entry.
@@ -1169,27 +1137,27 @@ def test_multi_suffix_search(topology, test_user, new_suffixes):
users_num = 20
log.info('Clear the access log')
- topology.standalone.deleteAccessLogs()
+ topology_st.standalone.deleteAccessLogs()
- users_list_1 = add_users(topology, users_num / 2, NEW_SUFFIX_1)
- users_list_2 = add_users(topology, users_num / 2, NEW_SUFFIX_2)
+ users_list_1 = add_users(topology_st, users_num / 2, NEW_SUFFIX_1)
+ users_list_2 = add_users(topology_st, users_num / 2, NEW_SUFFIX_2)
try:
log.info('Set DM bind')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
- all_results = paged_search(topology, NEW_SUFFIX_1, [req_ctrl],
- search_flt, searchreq_attrlist)
+ all_results = paged_search(topology_st, NEW_SUFFIX_1, [req_ctrl],
+ search_flt, searchreq_attrlist)
log.info('{} results'.format(len(all_results)))
assert len(all_results) == users_num
log.info('Restart the server to flush the logs')
- topology.standalone.restart(timeout=10)
+ topology_st.standalone.restart(timeout=10)
- access_log_lines =
topology.standalone.ds_access_log.match('.*pr_cookie=.*')
+ access_log_lines =
topology_st.standalone.ds_access_log.match('.*pr_cookie=.*')
pr_cookie_list = ([line.rsplit('=', 1)[-1] for line in
access_log_lines])
pr_cookie_list = [int(pr_cookie) for pr_cookie in pr_cookie_list]
log.info('Assert that last pr_cookie == -1 and others pr_cookie == 0')
@@ -1198,12 +1166,12 @@ def test_multi_suffix_search(topology, test_user, new_suffixes):
assert pr_cookie_list[-1] == -1
finally:
log.info('Remove added users')
- del_users(topology, users_list_1)
- del_users(topology, users_list_2)
+ del_users(topology_st, users_list_1)
+ del_users(topology_st, users_list_2)
@pytest.mark.parametrize('conf_attr_value', (None, '-1',
'1000'))
-def test_maxsimplepaged_per_conn_success(topology, test_user, conf_attr_value):
+def test_maxsimplepaged_per_conn_success(topology_st, test_user, conf_attr_value):
"""Verify that nsslapd-maxsimplepaged-per-conn acts according design
:Feature: Simple paged results
@@ -1222,37 +1190,37 @@ def test_maxsimplepaged_per_conn_success(topology, test_user,
conf_attr_value):
results requests per connection.
"""
- users_list = add_users(topology, 20, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, 20, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
page_size = 4
if conf_attr_value:
- max_per_con_bck = change_conf_attr(topology, DN_CONFIG,
+ max_per_con_bck = change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-maxsimplepaged-per-conn',
conf_attr_value)
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
- all_results = paged_search(topology, DEFAULT_SUFFIX, [req_ctrl],
+ all_results = paged_search(topology_st, DEFAULT_SUFFIX, [req_ctrl],
search_flt, searchreq_attrlist)
log.info('{} results'.format(len(all_results)))
assert len(all_results) == len(users_list)
finally:
log.info('Remove added users')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
if conf_attr_value:
- change_conf_attr(topology, DN_CONFIG,
+ change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-maxsimplepaged-per-conn', max_per_con_bck)
@pytest.mark.parametrize('conf_attr_value', ('0', '1'))
-def test_maxsimplepaged_per_conn_failure(topology, test_user, conf_attr_value):
+def test_maxsimplepaged_per_conn_failure(topology_st, test_user, conf_attr_value):
"""Verify that nsslapd-maxsimplepaged-per-conn acts according design
:Feature: Simple paged results
@@ -1270,43 +1238,43 @@ def test_maxsimplepaged_per_conn_failure(topology, test_user,
conf_attr_value):
:Assert: During the searches UNWILLING_TO_PERFORM should be throwned
"""
- users_list = add_users(topology, 20, DEFAULT_SUFFIX)
+ users_list = add_users(topology_st, 20, DEFAULT_SUFFIX)
search_flt = r'(uid=test*)'
searchreq_attrlist = ['dn', 'sn']
page_size = 4
- max_per_con_bck = change_conf_attr(topology, DN_CONFIG,
+ max_per_con_bck = change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-maxsimplepaged-per-conn',
conf_attr_value)
try:
log.info('Set user bind')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
log.info('Create simple paged results control instance')
req_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
with pytest.raises(ldap.UNWILLING_TO_PERFORM):
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=[req_ctrl])
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=[req_ctrl])
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
# If nsslapd-maxsimplepaged-per-conn = 1,
# it should pass this point, but failed on the next search
assert conf_attr_value == '1'
- msgid = topology.standalone.search_ext(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- search_flt,
- searchreq_attrlist,
- serverctrls=[req_ctrl])
- rtype, rdata, rmsgid, rctrls = topology.standalone.result3(msgid)
+ msgid = topology_st.standalone.search_ext(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ search_flt,
+ searchreq_attrlist,
+ serverctrls=[req_ctrl])
+ rtype, rdata, rmsgid, rctrls = topology_st.standalone.result3(msgid)
finally:
log.info('Remove added users')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- del_users(topology, users_list)
- change_conf_attr(topology, DN_CONFIG,
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ del_users(topology_st, users_list)
+ change_conf_attr(topology_st, DN_CONFIG,
'nsslapd-maxsimplepaged-per-conn', max_per_con_bck)
diff --git a/dirsrvtests/tests/suites/pam_passthru_plugin/pam_test.py
b/dirsrvtests/tests/suites/pam_passthru_plugin/pam_test.py
deleted file mode 100644
index 9ff4261..0000000
--- a/dirsrvtests/tests/suites/pam_passthru_plugin/pam_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_pam_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_pam_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/passthru_plugin/passthru_test.py
b/dirsrvtests/tests/suites/passthru_plugin/passthru_test.py
deleted file mode 100644
index 956d414..0000000
--- a/dirsrvtests/tests/suites/passthru_plugin/passthru_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_passthru_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_passthru_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/password/password_test.py
b/dirsrvtests/tests/suites/password/password_test.py
index 3781492..f450c9a 100644
--- a/dirsrvtests/tests/suites/password/password_test.py
+++ b/dirsrvtests/tests/suites/password/password_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -17,58 +17,16 @@ from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_password_init(topology):
- '''
- Do init, if necessary
- '''
-
- return
-
-
-def test_password_delete_specific_password(topology):
- '''
- Delete a specific userpassword, and make sure it is actually deleted from the entry
- '''
+def test_password_delete_specific_password(topology_st):
+ """ Delete a specific userpassword, and make sure
+ it is actually deleted from the entry
+ """
log.info('Running test_password_delete_specific_password...')
@@ -78,11 +36,11 @@ def test_password_delete_specific_password(topology):
# Add a test user with a password
#
try:
- topology.standalone.add_s(Entry((USER_DN, {'objectclass': "top
extensibleObject".split(),
- 'sn': '1',
- 'cn': 'user 1',
- 'uid': 'user1',
- 'userpassword': PASSWORD})))
+ topology_st.standalone.add_s(Entry((USER_DN, {'objectclass': "top
extensibleObject".split(),
+ 'sn': '1',
+ 'cn': 'user 1',
+ 'uid': 'user1',
+ 'userpassword':
PASSWORD})))
except ldap.LDAPError as e:
log.fatal('test_password_delete_specific_password: Failed to add test user
' +
USER_DN + ': error ' + e.message['desc'])
@@ -92,7 +50,7 @@ def test_password_delete_specific_password(topology):
# Delete the exact password
#
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_DELETE, 'userpassword',
PASSWORD)])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_DELETE,
'userpassword', PASSWORD)])
except ldap.LDAPError as e:
log.fatal('test_password_delete_specific_password: Failed to delete
userpassword: error ' +
e.message['desc'])
@@ -102,7 +60,7 @@ def test_password_delete_specific_password(topology):
# Check the password is actually deleted
#
try:
- entry = topology.standalone.search_s(USER_DN, ldap.SCOPE_BASE,
'objectclass=top')
+ entry = topology_st.standalone.search_s(USER_DN, ldap.SCOPE_BASE,
'objectclass=top')
if entry[0].hasAttr('userpassword'):
log.fatal('test_password_delete_specific_password: Entry incorrectly
still have the userpassword attribute')
assert False
@@ -115,7 +73,7 @@ def test_password_delete_specific_password(topology):
# Cleanup
#
try:
- topology.standalone.delete_s(USER_DN)
+ topology_st.standalone.delete_s(USER_DN)
except ldap.LDAPError as e:
log.fatal('test_password_delete_specific_password: Failed to delete user(%s),
error: %s' %
(USER_DN, e.message('desc')))
diff --git a/dirsrvtests/tests/suites/password/pwdAdmin_test.py
b/dirsrvtests/tests/suites/password/pwdAdmin_test.py
index dc8fdab..46991d8 100644
--- a/dirsrvtests/tests/suites/password/pwdAdmin_test.py
+++ b/dirsrvtests/tests/suites/password/pwdAdmin_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -18,11 +18,11 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
CONFIG_DN = 'cn=config'
ADMIN_NAME = 'passwd_admin'
ADMIN_DN = 'cn=%s,%s' % (ADMIN_NAME, SUFFIX)
@@ -35,40 +35,7 @@ ENTRY_DN = 'cn=%s,%s' % (ENTRY_NAME, SUFFIX)
INVALID_PWDS = ('2_Short', 'No_Number', 'N0Special',
'{SSHA}bBy8UdtPZwu8uZna9QOYG3Pr41RpIRVDl8wddw==')
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_pwdAdmin_init(topology):
+def test_pwdAdmin_init(topology_st):
'''
Create our future Password Admin entry, set the password policy, and test
that its working
@@ -78,28 +45,28 @@ def test_pwdAdmin_init(topology):
# Add Password Admin 1
try:
- topology.standalone.add_s(Entry((ADMIN_DN, {'objectclass': "top
extensibleObject".split(),
- 'cn': ADMIN_NAME,
- 'userpassword': ADMIN_PWD})))
+ topology_st.standalone.add_s(Entry((ADMIN_DN, {'objectclass': "top
extensibleObject".split(),
+ 'cn': ADMIN_NAME,
+ 'userpassword':
ADMIN_PWD})))
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin_init: Failed to add test user' + ADMIN_DN +
': error ' + e.message['desc'])
assert False
# Add Password Admin 2
try:
- topology.standalone.add_s(Entry((ADMIN2_DN, {'objectclass': "top
extensibleObject".split(),
- 'cn': ADMIN2_NAME,
- 'userpassword': ADMIN_PWD})))
+ topology_st.standalone.add_s(Entry((ADMIN2_DN, {'objectclass': "top
extensibleObject".split(),
+ 'cn': ADMIN2_NAME,
+ 'userpassword':
ADMIN_PWD})))
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin_init: Failed to add test user ' + ADMIN2_DN +
': error ' + e.message['desc'])
assert False
# Add Password Admin Group
try:
- topology.standalone.add_s(Entry((ADMIN_GROUP_DN, {'objectclass':
"top groupOfUNiqueNames".split(),
- 'cn': 'password admin group',
- 'uniquemember': ADMIN_DN,
- 'uniquemember': ADMIN2_DN})))
+ topology_st.standalone.add_s(Entry((ADMIN_GROUP_DN, {'objectclass':
"top groupOfUNiqueNames".split(),
+ 'cn': 'password
admin group',
+ 'uniquemember':
ADMIN_DN,
+ 'uniquemember':
ADMIN2_DN})))
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin_init: Failed to add group' + ADMIN_GROUP_DN +
': error ' + e.message['desc'])
assert False
@@ -107,13 +74,13 @@ def test_pwdAdmin_init(topology):
# Configure password policy
log.info('test_pwdAdmin_init: Configuring password policy...')
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'nsslapd-pwpolicy-local', 'on'),
- (ldap.MOD_REPLACE,
'passwordCheckSyntax', 'on'),
- (ldap.MOD_REPLACE,
'passwordMinCategories', '1'),
- (ldap.MOD_REPLACE,
'passwordMinTokenLength', '1'),
- (ldap.MOD_REPLACE,
'passwordExp', 'on'),
- (ldap.MOD_REPLACE,
'passwordMinDigits', '1'),
- (ldap.MOD_REPLACE,
'passwordMinSpecials', '1')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'nsslapd-pwpolicy-local', 'on'),
+ (ldap.MOD_REPLACE,
'passwordCheckSyntax', 'on'),
+ (ldap.MOD_REPLACE,
'passwordMinCategories', '1'),
+ (ldap.MOD_REPLACE,
'passwordMinTokenLength', '1'),
+ (ldap.MOD_REPLACE,
'passwordExp', 'on'),
+ (ldap.MOD_REPLACE,
'passwordMinDigits', '1'),
+ (ldap.MOD_REPLACE,
'passwordMinSpecials', '1')])
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin_init: Failed configure password policy: ' +
e.message['desc'])
@@ -124,14 +91,14 @@ def test_pwdAdmin_init(topology):
#
log.info('Add aci to allow password admin to add/update entries...')
- ACI_TARGET = "(target = \"ldap:///%s\")" % SUFFIX
- ACI_TARGETATTR = "(targetattr = *)"
- ACI_ALLOW = "(version 3.0; acl \"Password Admin Access\"; allow
(all) "
- ACI_SUBJECT = "(userdn = \"ldap:///anyone\");)"
- ACI_BODY = ACI_TARGET + ACI_TARGETATTR + ACI_ALLOW + ACI_SUBJECT
+ ACI_TARGET = "(target = \"ldap:///%s\")" % SUFFIX
+ ACI_TARGETATTR = "(targetattr = *)"
+ ACI_ALLOW = "(version 3.0; acl \"Password Admin Access\"; allow (all)
"
+ ACI_SUBJECT = "(userdn = \"ldap:///anyone\");)"
+ ACI_BODY = ACI_TARGET + ACI_TARGETATTR + ACI_ALLOW + ACI_SUBJECT
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
try:
- topology.standalone.modify_s(SUFFIX, mod)
+ topology_st.standalone.modify_s(SUFFIX, mod)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin_init: Failed to add aci for password admin: ' +
e.message['desc'])
@@ -142,10 +109,10 @@ def test_pwdAdmin_init(topology):
#
log.info('test_pwdAdmin_init: Bind as the Password Administator (before
activating)...')
try:
- topology.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
+ topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin_init: Failed to bind as the Password Admin: ' +
- e.message['desc'])
+ e.message['desc'])
assert False
#
@@ -166,12 +133,12 @@ def test_pwdAdmin_init(topology):
log.info('test_pwdAdmin_init: Create a regular user entry %s with password
(%s)...' %
(ENTRY_DN, passwd))
try:
- topology.standalone.add_s(entry)
+ topology_st.standalone.add_s(entry)
except ldap.LDAPError as e:
# We failed as expected
failed_as_expected = True
log.info('test_pwdAdmin_init: Add failed as expected: password (%s)
result (%s)'
- % (passwd, e.message['desc']))
+ % (passwd, e.message['desc']))
if not failed_as_expected:
log.fatal('test_pwdAdmin_init: We were incorrectly able to add an entry
' +
@@ -179,7 +146,7 @@ def test_pwdAdmin_init(topology):
assert False
-def test_pwdAdmin(topology):
+def test_pwdAdmin(topology_st):
'''
Test that password administrators/root DN can
bypass password syntax/policy.
@@ -209,7 +176,7 @@ def test_pwdAdmin(topology):
# Bind as Root DN
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Root DN failed to authenticate: ' +
e.message['desc'])
@@ -217,7 +184,7 @@ def test_pwdAdmin(topology):
# Set the password admin
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'passwordAdminDN', ADMIN_DN)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'passwordAdminDN', ADMIN_DN)])
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to add password admin to config: ' +
e.message['desc'])
@@ -225,7 +192,7 @@ def test_pwdAdmin(topology):
# Bind as Password Admin
try:
- topology.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
+ topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to bind as the Password Admin: ' +
e.message['desc'])
@@ -239,7 +206,7 @@ def test_pwdAdmin(topology):
log.info('test_pwdAdmin: Create a regular user entry %s with password
(%s)...' %
(ENTRY_DN, passwd))
try:
- topology.standalone.add_s(entry)
+ topology_st.standalone.add_s(entry)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to add entry with password (%s) result
(%s)'
% (passwd, e.message['desc']))
@@ -249,7 +216,7 @@ def test_pwdAdmin(topology):
# Delete entry for the next pass
try:
- topology.standalone.delete_s(ENTRY_DN)
+ topology_st.standalone.delete_s(ENTRY_DN)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to delete entry: %s' %
(e.message['desc']))
@@ -260,7 +227,7 @@ def test_pwdAdmin(topology):
#
entry.setValues('userpassword', ADMIN_PWD)
try:
- topology.standalone.add_s(entry)
+ topology_st.standalone.add_s(entry)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to add entry with valid password (%s) result
(%s)' %
(passwd, e.message['desc']))
@@ -274,7 +241,7 @@ def test_pwdAdmin(topology):
# Bind as root DN
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Root DN failed to authenticate: ' +
e.message['desc'])
@@ -282,7 +249,7 @@ def test_pwdAdmin(topology):
# Remove password admin
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_DELETE,
'passwordAdminDN', None)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_DELETE,
'passwordAdminDN', None)])
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to remove password admin from config: '
+
e.message['desc'])
@@ -290,7 +257,7 @@ def test_pwdAdmin(topology):
# Bind as Password Admin (who is no longer an admin)
try:
- topology.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
+ topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to bind as the Password Admin: ' +
e.message['desc'])
@@ -303,7 +270,7 @@ def test_pwdAdmin(topology):
failed_as_expected = False
entry.setValues('userpassword', passwd)
try:
- topology.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE,
'userpassword', passwd)])
+ topology_st.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE,
'userpassword', passwd)])
except ldap.LDAPError as e:
# We failed as expected
failed_as_expected = True
@@ -322,14 +289,14 @@ def test_pwdAdmin(topology):
# Bind as root DN to make the update
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Root DN failed to authenticate: ' +
e.message['desc'])
assert False
# Update config - set the password admin
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'passwordAdminDN', ADMIN_DN)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'passwordAdminDN', ADMIN_DN)])
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to add password admin to config: ' +
e.message['desc'])
@@ -337,7 +304,7 @@ def test_pwdAdmin(topology):
# Bind as Password Admin
try:
- topology.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
+ topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to bind as the Password Admin: ' +
e.message['desc'])
@@ -348,10 +315,10 @@ def test_pwdAdmin(topology):
#
for passwd in INVALID_PWDS:
try:
- topology.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE,
'userpassword', passwd)])
+ topology_st.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE,
'userpassword', passwd)])
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Password update failed unexpectedly: password
(%s) result (%s)'
- % (passwd, e.message['desc']))
+ % (passwd, e.message['desc']))
assert False
log.info('test_pwdAdmin: Password update succeeded (%s)' % passwd)
@@ -362,14 +329,14 @@ def test_pwdAdmin(topology):
# Bind as root DN to make the update
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Root DN failed to authenticate: ' +
e.message['desc'])
assert False
# Update config - set the password admin group
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'passwordAdminDN', ADMIN_GROUP_DN)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
'passwordAdminDN', ADMIN_GROUP_DN)])
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to add password admin to config: ' +
e.message['desc'])
@@ -377,7 +344,7 @@ def test_pwdAdmin(topology):
# Bind as admin2
try:
- topology.standalone.simple_bind_s(ADMIN2_DN, ADMIN_PWD)
+ topology_st.standalone.simple_bind_s(ADMIN2_DN, ADMIN_PWD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Failed to bind as the Password Admin2: ' +
e.message['desc'])
@@ -386,22 +353,22 @@ def test_pwdAdmin(topology):
# Make some invalid password updates, but they should succeed
for passwd in INVALID_PWDS:
try:
- topology.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE,
'userpassword', passwd)])
+ topology_st.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE,
'userpassword', passwd)])
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Password update failed unexpectedly: password
(%s) result (%s)'
- % (passwd, e.message['desc']))
+ % (passwd, e.message['desc']))
assert False
log.info('test_pwdAdmin: Password update succeeded (%s)' % passwd)
# Cleanup - bind as Root DN for the other tests
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_pwdAdmin: Root DN failed to authenticate: ' +
e.message['desc'])
assert False
-def test_pwdAdmin_config_validation(topology):
+def test_pwdAdmin_config_validation(topology_st):
'''
Test config validation:
@@ -410,7 +377,7 @@ def test_pwdAdmin_config_validation(topology):
'''
# Add mulitple attributes - one already eists so just try and add as second one
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_ADD,
'passwordAdminDN', ENTRY_DN)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_ADD,
'passwordAdminDN', ENTRY_DN)])
log.fatal('test_pwdAdmin_config_validation: Incorrectly was able to add two
config attributes')
assert False
except ldap.LDAPError as e:
@@ -419,7 +386,7 @@ def test_pwdAdmin_config_validation(topology):
# Attempt to set invalid DN
try:
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_ADD,
'passwordAdminDN', 'ZZZZZ')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_ADD,
'passwordAdminDN', 'ZZZZZ')])
log.fatal('test_pwdAdmin_config_validation: Incorrectly was able to add
invalid DN')
assert False
except ldap.LDAPError as e:
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py
b/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py
index b474f61..a359b65 100644
--- a/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py
@@ -1,3 +1,11 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
import os
import time
import subprocess
@@ -9,86 +17,39 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
-DEBUGGING = False
OU_PEOPLE = 'ou=people,{}'.format(DEFAULT_SUFFIX)
TEST_USER_NAME = 'simplepaged_test'
TEST_USER_DN = 'uid={},{}'.format(TEST_USER_NAME, OU_PEOPLE)
TEST_USER_PWD = 'simplepaged_test'
-PW_POLICY_CONT_USER = 'cn="cn=nsPwPolicyEntry,uid=simplepaged_test,'\
- 'ou=people,dc=example,dc=com",'\
+PW_POLICY_CONT_USER = 'cn="cn=nsPwPolicyEntry,uid=simplepaged_test,' \
+ 'ou=people,dc=example,dc=com",' \
'cn=nsPwPolicyContainer,ou=people,dc=example,dc=com'
-PW_POLICY_CONT_PEOPLE = 'cn="cn=nsPwPolicyEntry,'\
- 'ou=people,dc=example,dc=com",'\
+PW_POLICY_CONT_PEOPLE = 'cn="cn=nsPwPolicyEntry,' \
+ 'ou=people,dc=example,dc=com",' \
'cn=nsPwPolicyContainer,ou=people,dc=example,dc=com'
-if DEBUGGING:
- logging.getLogger(__name__).setLevel(logging.DEBUG)
-else:
- logging.getLogger(__name__).setLevel(logging.INFO)
-
+logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
-class TopologyStandalone(object):
- """The DS Topology Class"""
- def __init__(self, standalone):
- """Init"""
- standalone.open()
- self.standalone = standalone
-
-
@pytest.fixture(scope="module")
-def topology(request):
- """Create DS Deployment"""
-
- # Creating standalone instance ...
- if DEBUGGING:
- standalone = DirSrv(verbose=True)
- else:
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- """If we are debugging just stop the instances, otherwise remove
- them
- """
- if DEBUGGING:
- standalone.stop()
- else:
- standalone.delete()
-
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-(a)pytest.fixture(scope="module")
-def test_user(topology, request):
+def test_user(topology_st, request):
"""User for binding operation"""
log.info('Adding user {}'.format(TEST_USER_DN))
try:
- topology.standalone.add_s(Entry((TEST_USER_DN, {
- 'objectclass': 'top
person'.split(),
- 'objectclass':
'organizationalPerson',
- 'objectclass': 'inetorgperson',
- 'cn': TEST_USER_NAME,
- 'sn': TEST_USER_NAME,
- 'userpassword': TEST_USER_PWD,
- 'mail': '%s(a)redhat.com' %
TEST_USER_NAME,
- 'uid': TEST_USER_NAME
- })))
+ topology_st.standalone.add_s(Entry((TEST_USER_DN, {
+ 'objectclass': 'top person'.split(),
+ 'objectclass': 'organizationalPerson',
+ 'objectclass': 'inetorgperson',
+ 'cn': TEST_USER_NAME,
+ 'sn': TEST_USER_NAME,
+ 'userpassword': TEST_USER_PWD,
+ 'mail': '%s(a)redhat.com' % TEST_USER_NAME,
+ 'uid': TEST_USER_NAME
+ })))
except ldap.LDAPError as e:
log.error('Failed to add user (%s): error (%s)' % (TEST_USER_DN,
e.message['desc']))
@@ -96,19 +57,20 @@ def test_user(topology, request):
def fin():
log.info('Deleting user {}'.format(TEST_USER_DN))
- topology.standalone.delete_s(TEST_USER_DN)
+ topology_st.standalone.delete_s(TEST_USER_DN)
+
request.addfinalizer(fin)
@pytest.fixture(scope="module")
-def password_policy(topology, test_user):
+def password_policy(topology_st, test_user):
"""Set up password policy for subtree and user"""
log.info('Enable fine-grained policy')
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-pwpolicy-local',
- 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
+ 'nsslapd-pwpolicy-local',
+ 'on')])
except ldap.LDAPError as e:
log.error('Failed to set fine-grained policy: error {}'.format(
e.message['desc']))
@@ -116,7 +78,7 @@ def password_policy(topology, test_user):
log.info('Create password policy for subtree {}'.format(OU_PEOPLE))
try:
- subprocess.call(['%s/ns-newpwpolicy.pl' %
topology.standalone.get_sbin_dir(),
+ subprocess.call(['%s/ns-newpwpolicy.pl' %
topology_st.standalone.get_sbin_dir(),
'-D', DN_DM, '-w', PASSWORD,
'-p', str(PORT_STANDALONE), '-h',
HOST_STANDALONE,
'-S', OU_PEOPLE, '-Z', SERVERID_STANDALONE])
@@ -127,18 +89,18 @@ def password_policy(topology, test_user):
log.info('Add pwdpolicysubentry attribute to {}'.format(OU_PEOPLE))
try:
- topology.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_REPLACE,
- 'pwdpolicysubentry',
- PW_POLICY_CONT_PEOPLE)])
+ topology_st.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_REPLACE,
+ 'pwdpolicysubentry',
+ PW_POLICY_CONT_PEOPLE)])
except ldap.LDAPError as e:
- log.error('Failed to pwdpolicysubentry pw policy '\
+ log.error('Failed to pwdpolicysubentry pw policy ' \
'policy for {}: error {}'.format(OU_PEOPLE,
e.message['desc']))
raise e
log.info('Create password policy for subtree {}'.format(TEST_USER_DN))
try:
- subprocess.call(['%s/ns-newpwpolicy.pl' %
topology.standalone.get_sbin_dir(),
+ subprocess.call(['%s/ns-newpwpolicy.pl' %
topology_st.standalone.get_sbin_dir(),
'-D', DN_DM, '-w', PASSWORD,
'-p', str(PORT_STANDALONE), '-h',
HOST_STANDALONE,
'-U', TEST_USER_DN, '-Z', SERVERID_STANDALONE])
@@ -149,11 +111,11 @@ def password_policy(topology, test_user):
log.info('Add pwdpolicysubentry attribute to {}'.format(TEST_USER_DN))
try:
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
- 'pwdpolicysubentry',
- PW_POLICY_CONT_USER)])
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ 'pwdpolicysubentry',
+ PW_POLICY_CONT_USER)])
except ldap.LDAPError as e:
- log.error('Failed to pwdpolicysubentry pw policy '\
+ log.error('Failed to pwdpolicysubentry pw policy ' \
'policy for {}: error {}'.format(TEST_USER_DN,
e.message['desc']))
raise e
@@ -163,7 +125,7 @@ def password_policy(topology, test_user):
[('on', 'off', ldap.UNWILLING_TO_PERFORM),
('off', 'off', ldap.UNWILLING_TO_PERFORM),
('off', 'on', None), ('on',
'on', None)])
-def test_change_pwd(topology, test_user, password_policy,
+def test_change_pwd(topology_st, test_user, password_policy,
subtree_pwchange, user_pwchange, exception):
"""Verify that 'passwordChange' attr works as expected
User should have a priority over a subtree.
@@ -186,24 +148,23 @@ def test_change_pwd(topology, test_user, password_policy,
log.info('Set passwordChange to "{}" -
{}'.format(subtree_pwchange,
PW_POLICY_CONT_PEOPLE))
try:
- topology.standalone.modify_s(PW_POLICY_CONT_PEOPLE, [(ldap.MOD_REPLACE,
- 'passwordChange',
- subtree_pwchange)])
+ topology_st.standalone.modify_s(PW_POLICY_CONT_PEOPLE, [(ldap.MOD_REPLACE,
+
'passwordChange',
+ subtree_pwchange)])
except ldap.LDAPError as e:
- log.error('Failed to set passwordChange '\
+ log.error('Failed to set passwordChange ' \
'policy for {}: error {}'.format(PW_POLICY_CONT_PEOPLE,
e.message['desc']))
raise e
-
log.info('Set passwordChange to "{}" - {}'.format(user_pwchange,
PW_POLICY_CONT_USER))
try:
- topology.standalone.modify_s(PW_POLICY_CONT_USER, [(ldap.MOD_REPLACE,
- 'passwordChange',
- user_pwchange)])
+ topology_st.standalone.modify_s(PW_POLICY_CONT_USER, [(ldap.MOD_REPLACE,
+ 'passwordChange',
+ user_pwchange)])
except ldap.LDAPError as e:
- log.error('Failed to set passwordChange '\
+ log.error('Failed to set passwordChange ' \
'policy for {}: error {}'.format(PW_POLICY_CONT_USER,
e.message['desc']))
raise e
@@ -211,29 +172,29 @@ def test_change_pwd(topology, test_user, password_policy,
try:
log.info('Bind as user and modify userPassword')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
if exception:
with pytest.raises(exception):
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ 'userPassword',
+ 'new_pass')])
+ else:
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
'userPassword',
'new_pass')])
- else:
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
- 'userPassword',
- 'new_pass')])
except ldap.LDAPError as e:
log.error('Failed to change userpassword for {}: error {}'.format(
TEST_USER_DN, e.message['info']))
raise e
finally:
log.info('Bind as DM')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
- 'userPassword',
- TEST_USER_PWD)])
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ 'userPassword',
+ TEST_USER_PWD)])
-def test_pwd_min_age(topology, test_user, password_policy):
+def test_pwd_min_age(topology_st, test_user, password_policy):
"""If we set passwordMinAge to some value, for example to 10, then it
should not allow the user to change the password within 10 seconds after
his previous change.
@@ -261,33 +222,33 @@ def test_pwd_min_age(topology, test_user, password_policy):
log.info('Set passwordminage to "{}" - {}'.format(num_seconds,
PW_POLICY_CONT_PEOPLE))
try:
- topology.standalone.modify_s(PW_POLICY_CONT_PEOPLE, [(ldap.MOD_REPLACE,
- 'passwordminage',
- num_seconds)])
+ topology_st.standalone.modify_s(PW_POLICY_CONT_PEOPLE, [(ldap.MOD_REPLACE,
+
'passwordminage',
+ num_seconds)])
except ldap.LDAPError as e:
- log.error('Failed to set passwordminage '\
+ log.error('Failed to set passwordminage ' \
'policy for {}: error {}'.format(PW_POLICY_CONT_PEOPLE,
e.message['desc']))
raise e
log.info('Set passwordminage to "{}" - {}'.format(num_seconds,
PW_POLICY_CONT_USER))
try:
- topology.standalone.modify_s(PW_POLICY_CONT_USER, [(ldap.MOD_REPLACE,
- 'passwordminage',
- num_seconds)])
+ topology_st.standalone.modify_s(PW_POLICY_CONT_USER, [(ldap.MOD_REPLACE,
+ 'passwordminage',
+ num_seconds)])
except ldap.LDAPError as e:
- log.error('Failed to set passwordminage '\
+ log.error('Failed to set passwordminage ' \
'policy for {}: error {}'.format(PW_POLICY_CONT_USER,
e.message['desc']))
raise e
log.info('Set passwordminage to "{}" - {}'.format(num_seconds,
DN_CONFIG))
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
- 'passwordminage',
- num_seconds)])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
+ 'passwordminage',
+ num_seconds)])
except ldap.LDAPError as e:
- log.error('Failed to set passwordminage '\
+ log.error('Failed to set passwordminage ' \
'policy for {}: error {}'.format(DN_CONFIG,
e.message['desc']))
raise e
@@ -295,10 +256,10 @@ def test_pwd_min_age(topology, test_user, password_policy):
try:
log.info('Bind as user and modify userPassword')
- topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
- 'userPassword',
- 'new_pass')])
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ 'userPassword',
+ 'new_pass')])
except ldap.LDAPError as e:
log.error('Failed to change userpassword for {}: error {}'.format(
TEST_USER_DN, e.message['info']))
@@ -306,31 +267,31 @@ def test_pwd_min_age(topology, test_user, password_policy):
time.sleep(1)
log.info('Bind as user and modify userPassword straight away after previous
change')
- topology.standalone.simple_bind_s(TEST_USER_DN, 'new_pass')
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, 'new_pass')
with pytest.raises(ldap.CONSTRAINT_VIOLATION):
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
- 'userPassword',
- 'new_new_pass')])
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ 'userPassword',
+ 'new_new_pass')])
log.info('Wait {} second'.format(int(num_seconds) + 2))
time.sleep(int(num_seconds) + 2)
try:
log.info('Bind as user and modify userPassword')
- topology.standalone.simple_bind_s(TEST_USER_DN, 'new_pass')
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
- 'userPassword',
- TEST_USER_PWD)])
+ topology_st.standalone.simple_bind_s(TEST_USER_DN, 'new_pass')
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ 'userPassword',
+ TEST_USER_PWD)])
except ldap.LDAPError as e:
log.error('Failed to change userpassword for {}: error {}'.format(
TEST_USER_DN, e.message['info']))
raise e
finally:
log.info('Bind as DM')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
- topology.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
- 'userPassword',
- TEST_USER_PWD)])
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_REPLACE,
+ 'userPassword',
+ TEST_USER_PWD)])
if __name__ == '__main__':
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py
b/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py
index 67127e5..5a51124 100644
--- a/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py
@@ -19,7 +19,9 @@ from lib389 import DirSrvTools
from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
+from lib389.topologies import topology_st
+logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
CONFIG_DN = 'cn=config'
@@ -37,63 +39,23 @@ TEMP_USER = 'cn=test{}'
TEMP_USER_DN = '%s,%s' % (TEMP_USER, OU_PEOPLE)
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- """This fixture is used to standalone topology for the
'module'."""
- standalone = DirSrv(verbose=False)
-
- # Args for the standalone instance
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
-
- # Get the status of the instance and restart it if it exists
- instance_standalone = standalone.exists()
-
- # Remove the instance
- if instance_standalone:
- standalone.delete()
-
- # Create the instance
- standalone.create()
-
- # Used to retrieve configuration information (dbdir, confdir...)
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- # Here we have standalone instance up and running
- return TopologyStandalone(standalone)
-
-
@pytest.fixture(scope="module")
-def test_user(topology, request):
+def test_user(topology_st, request):
"""User for binding operation"""
log.info('Adding user {}'.format(BN))
try:
- topology.standalone.add_s(Entry((BN,
- {'objectclass': ['top',
- 'person',
- 'organizationalPerson',
- 'inetOrgPerson'],
- 'cn': 'bind user',
- 'sn': 'bind user',
- 'userPassword': PASSWORD})))
+ topology_st.standalone.add_s(Entry((BN,
+ {'objectclass': ['top',
+ 'person',
+
'organizationalPerson',
+ 'inetOrgPerson'],
+ 'cn': 'bind user',
+ 'sn': 'bind user',
+ 'userPassword': PASSWORD})))
log.info('Adding an aci for the bind user')
BN_ACI = '(targetattr="*")(version 3.0; acl "pwp test";
allow (all) userdn="ldap:///%s";)' % BN
- topology.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_ADD, 'aci', BN_ACI)])
+ topology_st.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_ADD, 'aci',
BN_ACI)])
except ldap.LDAPError as e:
log.error('Failed to add user (%s): error (%s)' % (BN,
@@ -102,13 +64,14 @@ def test_user(topology, request):
def fin():
log.info('Deleting user {}'.format(BN))
- topology.standalone.delete_s(BN)
- topology.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_DELETE, 'aci',
BN_ACI)])
+ topology_st.standalone.delete_s(BN)
+ topology_st.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_DELETE, 'aci',
BN_ACI)])
+
request.addfinalizer(fin)
@pytest.fixture(scope="module")
-def password_policy(topology, test_user):
+def password_policy(topology_st, test_user):
"""Set global password policy.
Then, set fine-grained subtree level password policy
to ou=People with no password syntax.
@@ -118,9 +81,9 @@ def password_policy(topology, test_user):
log.info('Enable fine-grained policy')
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
- 'nsslapd-pwpolicy-local',
- 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
+ 'nsslapd-pwpolicy-local',
+ 'on')])
except ldap.LDAPError as e:
log.error('Failed to set fine-grained policy: error {}'.format(
e.message['desc']))
@@ -128,7 +91,7 @@ def password_policy(topology, test_user):
log.info('Create password policy for subtree {}'.format(OU_PEOPLE))
try:
- subprocess.call(['%s/ns-newpwpolicy.pl' %
topology.standalone.get_sbin_dir(),
+ subprocess.call(['%s/ns-newpwpolicy.pl' %
topology_st.standalone.get_sbin_dir(),
'-D', DN_DM, '-w', PASSWORD,
'-p', str(PORT_STANDALONE), '-h',
HOST_STANDALONE,
'-S', OU_PEOPLE, '-Z', SERVERID_STANDALONE])
@@ -139,32 +102,32 @@ def password_policy(topology, test_user):
log.info('Add pwdpolicysubentry attribute to {}'.format(OU_PEOPLE))
try:
- topology.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_REPLACE,
- 'pwdpolicysubentry',
- PWP_CONTAINER_PEOPLE)])
+ topology_st.standalone.modify_s(OU_PEOPLE, [(ldap.MOD_REPLACE,
+ 'pwdpolicysubentry',
+ PWP_CONTAINER_PEOPLE)])
except ldap.LDAPError as e:
- log.error('Failed to pwdpolicysubentry pw policy '\
+ log.error('Failed to pwdpolicysubentry pw policy ' \
'policy for {}: error {}'.format(OU_PEOPLE,
e.message['desc']))
raise e
log.info("Set the default settings for the policy container.")
- topology.standalone.modify_s(PWP_CONTAINER_PEOPLE,
- [(ldap.MOD_REPLACE, 'passwordMustChange',
'off'),
- (ldap.MOD_REPLACE, 'passwordExp',
'off'),
- (ldap.MOD_REPLACE, 'passwordMinAge',
'0'),
- (ldap.MOD_REPLACE, 'passwordChange',
'off'),
- (ldap.MOD_REPLACE, 'passwordStorageScheme',
'ssha')])
+ topology_st.standalone.modify_s(PWP_CONTAINER_PEOPLE,
+ [(ldap.MOD_REPLACE, 'passwordMustChange',
'off'),
+ (ldap.MOD_REPLACE, 'passwordExp',
'off'),
+ (ldap.MOD_REPLACE, 'passwordMinAge',
'0'),
+ (ldap.MOD_REPLACE, 'passwordChange',
'off'),
+ (ldap.MOD_REPLACE, 'passwordStorageScheme',
'ssha')])
- check_attr_val(topology, CONFIG_DN, ATTR_INHERIT_GLOBAL, 'off')
- check_attr_val(topology, CONFIG_DN, ATTR_CHECK_SYNTAX, 'off')
+ check_attr_val(topology_st, CONFIG_DN, ATTR_INHERIT_GLOBAL, 'off')
+ check_attr_val(topology_st, CONFIG_DN, ATTR_CHECK_SYNTAX, 'off')
-def check_attr_val(topology, dn, attr, expected):
+def check_attr_val(topology_st, dn, attr, expected):
"""Check that entry has the value"""
try:
- centry = topology.standalone.search_s(dn, ldap.SCOPE_BASE, 'cn=*')
+ centry = topology_st.standalone.search_s(dn, ldap.SCOPE_BASE, 'cn=*')
assert centry[0], 'Failed to get %s' % dn
val = centry[0].getValue(attr)
@@ -179,7 +142,7 @@ def check_attr_val(topology, dn, attr, expected):
@pytest.mark.parametrize('inherit_value,checksyntax_value',
[('off', 'off'), ('on', 'off'),
('off', 'on')])
-def test_entry_has_no_restrictions(topology, password_policy, test_user,
+def test_entry_has_no_restrictions(topology_st, password_policy, test_user,
inherit_value, checksyntax_value):
"""Make sure an entry added to ou=people
has no password syntax restrictions when:
@@ -206,47 +169,47 @@ def test_entry_has_no_restrictions(topology, password_policy,
test_user,
log.info('Set {} to {}'.format(ATTR_INHERIT_GLOBAL, inherit_value))
log.info('Set {} to {}'.format(ATTR_CHECK_SYNTAX, checksyntax_value))
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
- ATTR_INHERIT_GLOBAL, inherit_value)])
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
- ATTR_CHECK_SYNTAX, checksyntax_value)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
+ ATTR_INHERIT_GLOBAL, inherit_value)])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
+ ATTR_CHECK_SYNTAX, checksyntax_value)])
# Wait a second for cn=config to apply
time.sleep(1)
- check_attr_val(topology, CONFIG_DN, ATTR_INHERIT_GLOBAL, inherit_value)
- check_attr_val(topology, CONFIG_DN, ATTR_CHECK_SYNTAX, checksyntax_value)
+ check_attr_val(topology_st, CONFIG_DN, ATTR_INHERIT_GLOBAL, inherit_value)
+ check_attr_val(topology_st, CONFIG_DN, ATTR_CHECK_SYNTAX, checksyntax_value)
log.info('Bind as test user')
- topology.standalone.simple_bind_s(BN, PASSWORD)
+ topology_st.standalone.simple_bind_s(BN, PASSWORD)
log.info('Make sure an entry added to ou=people has '
'no password syntax restrictions.')
try:
- topology.standalone.add_s(Entry((TEMP_USER_DN.format('0'),
- {'objectclass': ['top',
- 'person',
-
'organizationalPerson',
- 'inetOrgPerson'],
- 'cn': TEMP_USER.format('0'),
- 'sn': TEMP_USER.format('0'),
- 'userPassword': 'short'})))
+ topology_st.standalone.add_s(Entry((TEMP_USER_DN.format('0'),
+ {'objectclass': ['top',
+ 'person',
+
'organizationalPerson',
+ 'inetOrgPerson'],
+ 'cn':
TEMP_USER.format('0'),
+ 'sn':
TEMP_USER.format('0'),
+ 'userPassword': 'short'})))
except ldap.LDAPError as e:
log.fatal('Failed to add cn=test0 with userPassword: short: ' +
e.message['desc'])
raise e
finally:
log.info('Bind as DM user')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
log.info('Remove {}'.format(TEMP_USER_DN.format('0')))
try:
- topology.standalone.delete_s(TEMP_USER_DN.format('0'))
+ topology_st.standalone.delete_s(TEMP_USER_DN.format('0'))
except ldap.NO_SUCH_OBJECT as e:
log.fatal('There is no {}, it is a
problem'.format(TEMP_USER_DN.format('0')))
raise e
@pytest.mark.parametrize('container', [DN_CONFIG, PWP_CONTAINER_PEOPLE])
-def test_entry_has_restrictions(topology, password_policy, test_user, container):
+def test_entry_has_restrictions(topology_st, password_policy, test_user, container):
"""Set 'nsslapd-pwpolicy-inherit-global: on'
and 'passwordCheckSyntax: on'. Make sure that
syntax rules work, if set them at both: cn=config and
@@ -271,56 +234,56 @@ def test_entry_has_restrictions(topology, password_policy,
test_user, container)
log.info('Set {} to {}'.format(ATTR_INHERIT_GLOBAL, 'on'))
log.info('Set {} to {}'.format(ATTR_CHECK_SYNTAX, 'on'))
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
- ATTR_INHERIT_GLOBAL, 'on')])
- topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
- ATTR_CHECK_SYNTAX, 'on')])
- topology.standalone.modify_s(container, [(ldap.MOD_REPLACE,
- 'passwordMinLength' ,
'9')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
+ ATTR_INHERIT_GLOBAL, 'on')])
+ topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE,
+ ATTR_CHECK_SYNTAX, 'on')])
+ topology_st.standalone.modify_s(container, [(ldap.MOD_REPLACE,
+ 'passwordMinLength',
'9')])
# Wait a second for cn=config to apply
time.sleep(1)
- check_attr_val(topology, CONFIG_DN, ATTR_INHERIT_GLOBAL, 'on')
- check_attr_val(topology, CONFIG_DN, ATTR_CHECK_SYNTAX, 'on')
+ check_attr_val(topology_st, CONFIG_DN, ATTR_INHERIT_GLOBAL, 'on')
+ check_attr_val(topology_st, CONFIG_DN, ATTR_CHECK_SYNTAX, 'on')
log.info('Bind as test user')
- topology.standalone.simple_bind_s(BN, PASSWORD)
+ topology_st.standalone.simple_bind_s(BN, PASSWORD)
log.info('Try to add user with a short password (<9)')
with pytest.raises(ldap.CONSTRAINT_VIOLATION):
- topology.standalone.add_s(Entry((TEMP_USER_DN.format('0'),
- {'objectclass': ['top',
- 'person',
-
'organizationalPerson',
- 'inetOrgPerson'],
- 'cn': TEMP_USER.format('0'),
- 'sn': TEMP_USER.format('0'),
- 'userPassword': 'short'})))
+ topology_st.standalone.add_s(Entry((TEMP_USER_DN.format('0'),
+ {'objectclass': ['top',
+ 'person',
+
'organizationalPerson',
+ 'inetOrgPerson'],
+ 'cn':
TEMP_USER.format('0'),
+ 'sn':
TEMP_USER.format('0'),
+ 'userPassword': 'short'})))
log.info('Try to add user with a long password (>9)')
try:
- topology.standalone.add_s(Entry((TEMP_USER_DN.format('1'),
- {'objectclass': ['top',
- 'person',
-
'organizationalPerson',
- 'inetOrgPerson'],
- 'cn': TEMP_USER.format('1'),
- 'sn': TEMP_USER.format('1'),
- 'userPassword':
'Reallylong1'})))
+ topology_st.standalone.add_s(Entry((TEMP_USER_DN.format('1'),
+ {'objectclass': ['top',
+ 'person',
+
'organizationalPerson',
+ 'inetOrgPerson'],
+ 'cn':
TEMP_USER.format('1'),
+ 'sn':
TEMP_USER.format('1'),
+ 'userPassword':
'Reallylong1'})))
except ldap.LDAPError as e:
log.fatal('Failed to add cn=test1 with userPassword: short: '
+ e.message['desc'])
raise e
finally:
log.info('Bind as DM user')
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
log.info('Remove {}'.format(TEMP_USER_DN.format('0')))
try:
- topology.standalone.delete_s(TEMP_USER_DN.format('0'))
+ topology_st.standalone.delete_s(TEMP_USER_DN.format('0'))
except ldap.NO_SUCH_OBJECT as e:
log.info('There is no {}, it is
okay'.format(TEMP_USER_DN.format('0')))
try:
- topology.standalone.delete_s(TEMP_USER_DN.format('1'))
+ topology_st.standalone.delete_s(TEMP_USER_DN.format('1'))
except ldap.NO_SUCH_OBJECT as e:
log.fatal('There is no {}, it is a
problem'.format(TEMP_USER_DN.format('1')))
raise e
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_syntax_test.py
b/dirsrvtests/tests/suites/password/pwdPolicy_syntax_test.py
index aad4e40..7336c4d 100644
--- a/dirsrvtests/tests/suites/password/pwdPolicy_syntax_test.py
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_syntax_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -15,74 +15,25 @@ from lib389 import DirSrv, Entry
from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-DEBUGGING = False
-
USER_DN = 'uid=user,ou=People,%s' % DEFAULT_SUFFIX
-if DEBUGGING:
- logging.getLogger(__name__).setLevel(logging.DEBUG)
-else:
- logging.getLogger(__name__).setLevel(logging.INFO)
-
-
+logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
-class TopologyStandalone(object):
- """The DS Topology Class"""
- def __init__(self, standalone):
- """Init"""
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- """Create DS Deployment"""
-
- # Creating standalone instance ...
- if DEBUGGING:
- standalone = DirSrv(verbose=True)
- else:
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- """If we are debugging just stop the instances, otherwise remove
- them
- """
- if DEBUGGING:
- standalone.stop()
- else:
- standalone.delete()
-
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
def _create_user(inst):
"""Create the test user."""
inst.add_s(Entry((
- USER_DN, {
- 'objectClass': 'top account
simplesecurityobject'.split(),
- 'uid': 'user',
- 'userpassword': PASSWORD
- })))
+ USER_DN, {
+ 'objectClass': 'top account simplesecurityobject'.split(),
+ 'uid': 'user',
+ 'userpassword': PASSWORD
+ })))
def setPolicy(inst, attr, value):
@@ -129,7 +80,7 @@ def resetPasswd(inst):
# Now set the password
try:
inst.modify_s(USER_DN,
- [(ldap.MOD_REPLACE, 'userpassword', PASSWORD)])
+ [(ldap.MOD_REPLACE, 'userpassword', PASSWORD)])
except ldap.LDAPError as e:
log.fatal("Failed to reset user password: " + str(e))
assert False
@@ -145,7 +96,7 @@ def tryPassword(inst, policy_attr, value, reset_value, pw_bad, pw_good,
msg):
setPolicy(inst, policy_attr, value)
try:
inst.modify_s(USER_DN,
- [(ldap.MOD_REPLACE, 'userpassword', pw_bad)])
+ [(ldap.MOD_REPLACE, 'userpassword', pw_bad)])
log.fatal('Invalid password was unexpectedly accepted (%s)' %
(policy_attr))
assert False
@@ -160,7 +111,7 @@ def tryPassword(inst, policy_attr, value, reset_value, pw_bad,
pw_good, msg):
# Change password that is allowed
try:
inst.modify_s(USER_DN,
- [(ldap.MOD_REPLACE, 'userpassword', pw_good)])
+ [(ldap.MOD_REPLACE, 'userpassword', pw_good)])
except ldap.LDAPError as e:
log.fatal("Failed to change password: " + str(e))
assert False
@@ -170,46 +121,46 @@ def tryPassword(inst, policy_attr, value, reset_value, pw_bad,
pw_good, msg):
setPolicy(inst, policy_attr, reset_value)
-def test_pwdPolicy_syntax(topology):
+def test_pwdPolicy_syntax(topology_st):
'''
Password policy test: Ensure that on a password change, the policy syntax
is enforced correctly.
'''
# Create a user
- _create_user(topology.standalone)
+ _create_user(topology_st.standalone)
# Set the password policy globally
- topology.standalone.config.set('passwordCheckSyntax', 'on')
- topology.standalone.config.set('nsslapd-pwpolicy-local', 'off')
- topology.standalone.config.set('passwordMinCategories', '1')
+ topology_st.standalone.config.set('passwordCheckSyntax', 'on')
+ topology_st.standalone.config.set('nsslapd-pwpolicy-local', 'off')
+ topology_st.standalone.config.set('passwordMinCategories', '1')
#
# Test each syntax catagory
#
# Min Length
- tryPassword(topology.standalone, 'passwordMinLength', 10, 2,
'passwd',
+ tryPassword(topology_st.standalone, 'passwordMinLength', 10, 2,
'passwd',
'password123', 'length too short')
# Min Digit
- tryPassword(topology.standalone, 'passwordMinDigits', 2, 0,
'passwd',
+ tryPassword(topology_st.standalone, 'passwordMinDigits', 2, 0,
'passwd',
'password123', 'does not contain minimum number of
digits')
# Min Alphas
- tryPassword(topology.standalone, 'passwordMinAlphas', 2, 0,
'p123456789',
+ tryPassword(topology_st.standalone, 'passwordMinAlphas', 2, 0,
'p123456789',
'password123', 'does not contain minimum number of
alphas')
# Max Repeats
- tryPassword(topology.standalone, 'passwordMaxRepeats', 2, 0,
'passsword',
+ tryPassword(topology_st.standalone, 'passwordMaxRepeats', 2, 0,
'passsword',
'pasword123', 'too many repeating characters')
# Min Specials
- tryPassword(topology.standalone, 'passwordMinSpecials', 2, 0,
'passwd',
+ tryPassword(topology_st.standalone, 'passwordMinSpecials', 2, 0,
'passwd',
'password_#$',
'does not contain minimum number of special characters')
# Min Lowers
- tryPassword(topology.standalone, 'passwordMinLowers', 2, 0,
'PASSWORD123',
+ tryPassword(topology_st.standalone, 'passwordMinLowers', 2, 0,
'PASSWORD123',
'password123',
'does not contain minimum number of lowercase characters')
# Min Uppers
- tryPassword(topology.standalone, 'passwordMinUppers', 2, 0,
'password',
+ tryPassword(topology_st.standalone, 'passwordMinUppers', 2, 0,
'password',
'PASSWORD',
'does not contain minimum number of lowercase characters')
# Min 8-bits - "ldap" package only accepts ascii strings at the moment
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
b/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
index f3e57f4..fd0236c 100644
--- a/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
@@ -1,3 +1,11 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
import os
import sys
import time
@@ -12,69 +20,18 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
-DEBUGGING = False
CONFIG_ATTR = 'passwordSendExpiringTime'
USER_DN = 'uid=tuser,{:s}'.format(DEFAULT_SUFFIX)
USER_PASSWD = 'secret123'
-if DEBUGGING:
- logging.getLogger(__name__).setLevel(logging.DEBUG)
-else:
- logging.getLogger(__name__).setLevel(logging.INFO)
-
+logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
-class TopologyStandalone(object):
- """The DS Topology Class"""
- def __init__(self, standalone):
- """Init"""
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- """Create DS Deployment"""
-
- # Creating standalone instance ...
- if DEBUGGING:
- standalone = DirSrv(verbose=True)
- else:
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- """If we are debugging just stop the instances, otherwise remove
- them
- """
-
- if DEBUGGING:
- standalone.stop()
- else:
- standalone.delete()
-
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
-
@pytest.fixture
-def global_policy(topology, request):
+def global_policy(topology_st, request):
"""Sets the required global
password policy attributes under
cn=config entry
@@ -86,21 +43,21 @@ def global_policy(topology, request):
CONFIG_ATTR: ''}
try:
log.info('Get the default values')
- entry = topology.standalone.getEntry(DN_CONFIG, ldap.SCOPE_BASE,
- '(objectClass=*)', attrs.keys())
+ entry = topology_st.standalone.getEntry(DN_CONFIG, ldap.SCOPE_BASE,
+ '(objectClass=*)', attrs.keys())
for key in attrs.keys():
attrs[key] = entry.getValue(key)
log.info('Set the new values')
- topology.standalone.modify_s(DN_CONFIG, [
- (ldap.MOD_REPLACE, 'passwordExp',
'on'),
- (ldap.MOD_REPLACE, 'passwordMaxAge',
'172800'),
- (ldap.MOD_REPLACE, 'passwordWarning',
'86400'),
- (ldap.MOD_REPLACE, CONFIG_ATTR, 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG, [
+ (ldap.MOD_REPLACE, 'passwordExp', 'on'),
+ (ldap.MOD_REPLACE, 'passwordMaxAge', '172800'),
+ (ldap.MOD_REPLACE, 'passwordWarning', '86400'),
+ (ldap.MOD_REPLACE, CONFIG_ATTR, 'on')])
except ldap.LDAPError as ex:
- log.error("Failed to set global password policy, error:{:s}"\
+ log.error("Failed to set global password policy, error:{:s}" \
.format(ex.message['desc']))
raise ex
@@ -110,11 +67,12 @@ def global_policy(topology, request):
try:
log.info('Reset the defaults')
for key in attrs.keys():
- topology.standalone.modify_s(DN_CONFIG, [
+ topology_st.standalone.modify_s(DN_CONFIG, [
(ldap.MOD_REPLACE, key, attrs[key])])
except ldap.LDAPError as ex:
log.error("Failed to set defaults,
error:{:s}".format(ex.message['desc']))
raise ex
+
request.addfinalizer(fin)
# A short sleep is required after the modifying password policy or cn=config
@@ -122,7 +80,7 @@ def global_policy(topology, request):
@pytest.fixture
-def global_policy_default(topology, request):
+def global_policy_default(topology_st, request):
"""Sets the required global password policy
attributes for testing the default behavior
of password expiry warning time
@@ -131,22 +89,22 @@ def global_policy_default(topology, request):
attrs = {'passwordExp': '',
'passwordMaxAge': '',
'passwordWarning': '',
- CONFIG_ATTR : ''}
+ CONFIG_ATTR: ''}
try:
log.info('Get the default values')
- entry = topology.standalone.getEntry(DN_CONFIG, ldap.SCOPE_BASE,
- '(objectClass=*)', attrs.keys())
+ entry = topology_st.standalone.getEntry(DN_CONFIG, ldap.SCOPE_BASE,
+ '(objectClass=*)', attrs.keys())
for key in attrs.keys():
attrs[key] = entry.getValue(key)
log.info('Set the new values')
- topology.standalone.modify_s(DN_CONFIG, [
- (ldap.MOD_REPLACE, 'passwordExp',
'on'),
- (ldap.MOD_REPLACE, 'passwordMaxAge',
'86400'),
- (ldap.MOD_REPLACE, 'passwordWarning',
'86400'),
- (ldap.MOD_REPLACE, CONFIG_ATTR, 'off')])
+ topology_st.standalone.modify_s(DN_CONFIG, [
+ (ldap.MOD_REPLACE, 'passwordExp', 'on'),
+ (ldap.MOD_REPLACE, 'passwordMaxAge', '86400'),
+ (ldap.MOD_REPLACE, 'passwordWarning', '86400'),
+ (ldap.MOD_REPLACE, CONFIG_ATTR, 'off')])
except ldap.LDAPError as ex:
- log.error("Failed to set global password policy, error:{:s}"\
+ log.error("Failed to set global password policy, error:{:s}" \
.format(ex.message['desc']))
raise ex
@@ -156,13 +114,14 @@ def global_policy_default(topology, request):
log.info('Reset the defaults')
try:
for key in attrs.keys():
- topology.standalone.modify_s(DN_CONFIG, [
- (ldap.MOD_REPLACE, key, attrs[key])
- ])
+ topology_st.standalone.modify_s(DN_CONFIG, [
+ (ldap.MOD_REPLACE, key, attrs[key])
+ ])
except ldap.LDAPError as ex:
- log.error("Failed to reset defaults, error:{:s}"\
+ log.error("Failed to reset defaults, error:{:s}" \
.format(ex.message['desc']))
raise ex
+
request.addfinalizer(fin)
# A short sleep is required after modifying password policy or cn=config
@@ -170,7 +129,7 @@ def global_policy_default(topology, request):
@pytest.fixture
-def add_user(topology, request):
+def add_user(topology_st, request):
"""Adds a user for binding"""
user_data = {'objectClass': 'top person inetOrgPerson'.split(),
@@ -181,7 +140,7 @@ def add_user(topology, request):
log.info('Add the user')
try:
- topology.standalone.add_s(Entry((USER_DN, user_data)))
+ topology_st.standalone.add_s(Entry((USER_DN, user_data)))
except ldap.LDAPError as ex:
log.error("Failed to add user,
error:{:s}".format(ex.message['desc']))
raise ex
@@ -191,27 +150,28 @@ def add_user(topology, request):
log.info('Remove the user entry')
try:
- topology.standalone.delete_s(USER_DN)
+ topology_st.standalone.delete_s(USER_DN)
except ldap.LDAPError as ex:
- log.error("Failed to remove user, error:{:s}"\
+ log.error("Failed to remove user, error:{:s}" \
.format(ex.message['desc']))
raise ex
+
request.addfinalizer(fin)
@pytest.fixture
-def local_policy(topology, add_user):
+def local_policy(topology_st, add_user):
"""Sets fine grained policy for user entry"""
log.info("Setting fine grained policy for user ({:s})".format(USER_DN))
try:
- subprocess.call(['%s/ns-newpwpolicy.pl' %
topology.standalone.get_sbin_dir(),
+ subprocess.call(['%s/ns-newpwpolicy.pl' %
topology_st.standalone.get_sbin_dir(),
'-D', DN_DM,
'-w', PASSWORD, '-h', HOST_STANDALONE,
'-p', str(PORT_STANDALONE), '-U', USER_DN,
'-Z', SERVERID_STANDALONE])
except subprocess.CalledProcessError as ex:
- log.error("Failed to set fine grained policy, error:{:s}"\
+ log.error("Failed to set fine grained policy, error:{:s}" \
.format(str(ex)))
raise ex
@@ -219,7 +179,7 @@ def local_policy(topology, add_user):
time.sleep(0.5)
-def get_password_warning(topology):
+def get_password_warning(topology_st):
"""Gets the password expiry warning time for the
user"""
res_type = res_data = res_msgid = res_ctrls = None
@@ -227,31 +187,31 @@ def get_password_warning(topology):
log.info('Bind with the user and request the password expiry warning time')
try:
- result_id = topology.standalone.simple_bind(USER_DN, USER_PASSWD,
- serverctrls = [PasswordPolicyControl()])
- res_type, res_data, res_msgid, res_ctrls =\
- topology.standalone.result3(result_id)
+ result_id = topology_st.standalone.simple_bind(USER_DN, USER_PASSWD,
+
serverctrls=[PasswordPolicyControl()])
+ res_type, res_data, res_msgid, res_ctrls = \
+ topology_st.standalone.result3(result_id)
# This exception will be thrown when the user's password has expired
except ldap.INVALID_CREDENTIALS as ex:
raise ex
except ldap.LDAPError as ex:
- log.error("Failed to get password expiry warning time, error:{:s}"\
- .format(ex.message['desc']))
+ log.error("Failed to get password expiry warning time, error:{:s}" \
+ .format(ex.message['desc']))
raise ex
# Return the control
return res_ctrls
-def set_conf_attr(topology, attr, val):
+def set_conf_attr(topology_st, attr, val):
"""Sets the value of a given attribute under
cn=config"""
log.info("Setting {:s} to {:s}".format(attr, val))
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, attr, val)])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, attr, val)])
except ldap.LDAPError as ex:
- log.error("Failed to set {:s} to {:s} error:{:s}"\
+ log.error("Failed to set {:s} to {:s} error:{:s}" \
.format(attr, val, ex.message['desc']))
raise ex
@@ -259,17 +219,17 @@ def set_conf_attr(topology, attr, val):
time.sleep(0.5)
-def get_conf_attr(topology, attr):
+def get_conf_attr(topology_st, attr):
"""Gets the value of a given
attribute under cn=config entry
"""
try:
- entry = topology.standalone.getEntry(DN_CONFIG, ldap.SCOPE_BASE,
- '(objectClass=*)', [attr])
+ entry = topology_st.standalone.getEntry(DN_CONFIG, ldap.SCOPE_BASE,
+ '(objectClass=*)', [attr])
val = entry.getValue(attr)
except ldap.LDAPError as ex:
- log.error("Failed to get the value of {:s}, error:{:s}"\
+ log.error("Failed to get the value of {:s}, error:{:s}" \
.format(attr, ex.message['desc']))
raise ex
@@ -277,8 +237,8 @@ def get_conf_attr(topology, attr):
return val
-(a)pytest.mark.parametrize("value", (' ' , 'junk123',
'on', 'off'))
-def test_different_values(topology, value):
+(a)pytest.mark.parametrize("value", (' ', 'junk123',
'on', 'off'))
+def test_different_values(topology_st, value):
"""Try to set passwordSendExpiringTime attribute
to various values both valid and invalid
@@ -298,31 +258,31 @@ def test_different_values(topology, value):
"""
log.info('Get the default value')
- defval = get_conf_attr(topology, CONFIG_ATTR)
+ defval = get_conf_attr(topology_st, CONFIG_ATTR)
if value not in ('on', 'off'):
log.info('An invalid value is being tested')
with pytest.raises(ldap.OPERATIONS_ERROR):
- set_conf_attr(topology, CONFIG_ATTR, value)
+ set_conf_attr(topology_st, CONFIG_ATTR, value)
log.info('Now check the value is unchanged')
- assert get_conf_attr(topology, CONFIG_ATTR) == defval
+ assert get_conf_attr(topology_st, CONFIG_ATTR) == defval
log.info("Invalid value {:s} was rejected correctly".format(value))
else:
log.info('A valid value is being tested')
- set_conf_attr(topology, CONFIG_ATTR, value)
+ set_conf_attr(topology_st, CONFIG_ATTR, value)
log.info('Now check that the value has been changed')
- assert get_conf_attr(topology, CONFIG_ATTR) == value
+ assert get_conf_attr(topology_st, CONFIG_ATTR) == value
log.info("{:s} is now set to {:s}".format(CONFIG_ATTR, value))
log.info('Set passwordSendExpiringTime back to the default value')
- set_conf_attr(topology, CONFIG_ATTR, defval)
+ set_conf_attr(topology_st, CONFIG_ATTR, defval)
-def test_expiry_time(topology, global_policy, add_user):
+def test_expiry_time(topology_st, global_policy, add_user):
"""Test whether the password expiry warning
time for a user is returned appropriately
@@ -346,23 +306,23 @@ def test_expiry_time(topology, global_policy, add_user):
res_ctrls = None
try:
log.info('Get the password expiry warning time')
- log.info("Binding with ({:s}) and requesting the password expiry warning
time"\
+ log.info("Binding with ({:s}) and requesting the password expiry warning
time" \
.format(USER_DN))
- res_ctrls = get_password_warning(topology)
+ res_ctrls = get_password_warning(topology_st)
log.info('Check whether the time is returned')
assert res_ctrls
- log.info("user's password will expire in {:d} seconds"\
+ log.info("user's password will expire in {:d} seconds" \
.format(res_ctrls[0].timeBeforeExpiration))
finally:
log.info("Rebinding as DM")
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
-(a)pytest.mark.parametrize("attr,val",[(CONFIG_ATTR, 'off'),
- ('passwordWarning', '3600')])
-def test_password_warning(topology, global_policy, add_user, attr, val):
+(a)pytest.mark.parametrize("attr,val", [(CONFIG_ATTR, 'off'),
+ ('passwordWarning', '3600')])
+def test_password_warning(topology_st, global_policy, add_user, attr, val):
"""Test password expiry warning time by
setting passwordSendExpiringTime to off
and setting passwordWarning to a short value
@@ -393,25 +353,25 @@ def test_password_warning(topology, global_policy, add_user, attr,
val):
try:
log.info('Set configuration parameter')
- set_conf_attr(topology, attr, val)
+ set_conf_attr(topology_st, attr, val)
- log.info("Binding with ({:s}) and requesting password expiry warning
time"\
+ log.info("Binding with ({:s}) and requesting password expiry warning
time" \
.format(USER_DN))
- res_ctrls = get_password_warning(topology)
+ res_ctrls = get_password_warning(topology_st)
log.info('Check the state of the control')
if not res_ctrls:
- log.info("Password Expiry warning time is not returned as {:s} is set to
{:s}"\
+ log.info("Password Expiry warning time is not returned as {:s} is set to
{:s}" \
.format(attr, val))
else:
- log.info("({:s}) password will expire in {:d} seconds"\
+ log.info("({:s}) password will expire in {:d} seconds" \
.format(USER_DN, res_ctrls[0].timeBeforeExpiration))
finally:
log.info("Rebinding as DM")
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
-def test_with_different_password_states(topology, global_policy, add_user):
+def test_with_different_password_states(topology_st, global_policy, add_user):
"""Test the control with different password states
:Feature: Password Expiry Warning Time
@@ -440,17 +400,17 @@ def test_with_different_password_states(topology, global_policy,
add_user):
res_ctrls = None
try:
- log.info("Expiring user's password by moving the"\
+ log.info("Expiring user's password by moving the" \
" system date past the valid period")
subprocess.check_call(['/usr/bin/date', '-s', '+30
day'])
log.info('Wait for the server to pick up new date')
time.sleep(5)
- log.info("Attempting to bind with user {:s} and retrive the password"\
+ log.info("Attempting to bind with user {:s} and retrive the password"
\
" expiry warning time".format(USER_DN))
with pytest.raises(ldap.INVALID_CREDENTIALS) as ex:
- res_ctrls = get_password_warning(topology)
+ res_ctrls = get_password_warning(topology_st)
log.info("Bind Failed, error: {:s}".format(str(ex)))
@@ -460,21 +420,21 @@ def test_with_different_password_states(topology, global_policy,
add_user):
log.info('Wait for the server to pick up new date')
time.sleep(5)
- log.info("Rebinding with {:s} and retrieving the password"\
+ log.info("Rebinding with {:s} and retrieving the password" \
" expiry warning time".format(USER_DN))
- res_ctrls = get_password_warning(topology)
+ res_ctrls = get_password_warning(topology_st)
log.info('Check that the control is returned')
assert res_ctrls
- log.info("user's password will expire in {:d} seconds"\
+ log.info("user's password will expire in {:d} seconds" \
.format(res_ctrls[0].timeBeforeExpiration))
finally:
log.info("Rebinding as DM")
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
-def test_default_behavior(topology, global_policy_default, add_user):
+def test_default_behavior(topology_st, global_policy_default, add_user):
"""Test the default behavior of password
expiry warning time
@@ -498,22 +458,22 @@ def test_default_behavior(topology, global_policy_default,
add_user):
res_ctrls = None
try:
- log.info("Binding with {:s} and requesting the password expiry warning
time"\
+ log.info("Binding with {:s} and requesting the password expiry warning
time" \
.format(USER_DN))
- res_ctrls = get_password_warning(topology)
+ res_ctrls = get_password_warning(topology_st)
log.info('Check that control is returned even'
'if passwordSendExpiringTime is set to off')
assert res_ctrls
- log.info("user's password will expire in {:d} seconds"\
+ log.info("user's password will expire in {:d} seconds" \
.format(res_ctrls[0].timeBeforeExpiration))
finally:
log.info("Rebinding as DM")
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
-def test_with_local_policy(topology, global_policy, local_policy):
+def test_with_local_policy(topology_st, global_policy, local_policy):
"""Test the attribute with fine grained policy
set for the user
@@ -540,9 +500,9 @@ def test_with_local_policy(topology, global_policy, local_policy):
res_ctrls = None
try:
- log.info("Attempting to get password expiry warning time for"\
+ log.info("Attempting to get password expiry warning time for" \
" user {:s}".format(USER_DN))
- res_ctrls = get_password_warning(topology)
+ res_ctrls = get_password_warning(topology_st)
log.info('Check that the control is not returned')
assert not res_ctrls
@@ -550,7 +510,7 @@ def test_with_local_policy(topology, global_policy, local_policy):
log.info("Password expiry warning time is not returned")
finally:
log.info("Rebinding as DM")
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
if __name__ == '__main__':
diff --git a/dirsrvtests/tests/suites/password/pwd_algo_test.py
b/dirsrvtests/tests/suites/password/pwd_algo_test.py
index aa8cbf5..b31f1ec 100644
--- a/dirsrvtests/tests/suites/password/pwd_algo_test.py
+++ b/dirsrvtests/tests/suites/password/pwd_algo_test.py
@@ -1,3 +1,11 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
import os
import sys
import time
@@ -10,64 +18,14 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
-DEBUGGING = True
USER_DN = 'uid=user,ou=People,%s' % DEFAULT_SUFFIX
-if DEBUGGING:
- logging.getLogger(__name__).setLevel(logging.DEBUG)
-else:
- logging.getLogger(__name__).setLevel(logging.INFO)
-
-
+logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
-class TopologyStandalone(object):
- """The DS Topology Class"""
- def __init__(self, standalone):
- """Init"""
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- """Create DS Deployment"""
-
- # Creating standalone instance ...
- if DEBUGGING:
- standalone = DirSrv(verbose=True)
- else:
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- """If we are debugging just stop the instances, otherwise remove
- them
- """
- if DEBUGGING:
- standalone.stop()
- else:
- standalone.delete()
-
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
def _test_bind(inst, password):
result = True
userconn = ldap.initialize("ldap://%s:%s" % (HOST_STANDALONE,
PORT_STANDALONE))
@@ -78,59 +36,52 @@ def _test_bind(inst, password):
result = False
return result
+
def _test_algo(inst, algo_name):
inst.config.set('passwordStorageScheme', algo_name)
- if DEBUGGING:
- print('Testing %s', algo_name)
-
# Create the user with a password
inst.add_s(Entry((
- USER_DN, {
- 'objectClass': 'top account
simplesecurityobject'.split(),
- 'uid': 'user',
- 'userpassword': 'Secret123'
- })))
+ USER_DN, {
+ 'objectClass': 'top account simplesecurityobject'.split(),
+ 'uid': 'user',
+ 'userpassword': 'Secret123'
+ })))
# Make sure when we read the userPassword field, it is the correct ALGO
- pw_field = inst.search_s(USER_DN, ldap.SCOPE_BASE, '(objectClass=*)',
['userPassword'] )[0]
-
- if DEBUGGING:
- print(pw_field.getValue('userPassword'))
+ pw_field = inst.search_s(USER_DN, ldap.SCOPE_BASE, '(objectClass=*)',
['userPassword'])[0]
if algo_name != 'CLEAR':
- assert(algo_name.lower() in pw_field.getValue('userPassword').lower())
+ assert (algo_name.lower() in pw_field.getValue('userPassword').lower())
# Now make sure a bind works
- assert(_test_bind(inst, 'Secret123'))
+ assert (_test_bind(inst, 'Secret123'))
# Bind with a wrong shorter password, should fail
- assert(not _test_bind(inst, 'Wrong'))
+ assert (not _test_bind(inst, 'Wrong'))
# Bind with a wrong longer password, should fail
- assert(not _test_bind(inst, 'This is even more wrong'))
+ assert (not _test_bind(inst, 'This is even more wrong'))
# Bind with a wrong exact length password.
- assert(not _test_bind(inst, 'Alsowrong'))
+ assert (not _test_bind(inst, 'Alsowrong'))
# Bind with a subset password, should fail
- assert(not _test_bind(inst, 'Secret'))
+ assert (not _test_bind(inst, 'Secret'))
if algo_name != 'CRYPT':
# Bind with a subset password that is 1 char shorter, to detect off by 1 in
clear
- assert(not _test_bind(inst, 'Secret12'))
+ assert (not _test_bind(inst, 'Secret12'))
# Bind with a superset password, should fail
- assert(not _test_bind(inst, 'Secret123456'))
+ assert (not _test_bind(inst, 'Secret123456'))
# Delete the user
inst.delete_s(USER_DN)
# done!
-def test_pwd_algo_test(topology):
- """
- Assert that all of our password algorithms correctly PASS and FAIL varying
- password conditions.
+def test_pwd_algo_test(topology_st):
+ """Assert that all of our password algorithms correctly PASS and FAIL
varying
+ password conditions.
"""
- if DEBUGGING:
- # Add debugging steps(if any)...
- pass
- for algo in ('CLEAR', 'CRYPT', 'MD5', 'SHA',
'SHA256', 'SHA384', 'SHA512', 'SMD5', 'SSHA',
'SSHA256', 'SSHA384', 'SSHA512'):
- _test_algo(topology.standalone, algo)
+ for algo in (
+ 'CLEAR', 'CRYPT', 'MD5', 'SHA',
'SHA256', 'SHA384', 'SHA512', 'SMD5', 'SSHA',
'SSHA256', 'SSHA384',
+ 'SSHA512'):
+ _test_algo(topology_st.standalone, algo)
log.info('Test PASSED')
@@ -140,4 +91,3 @@ if __name__ == '__main__':
# -s for DEBUG mode
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s %s" % CURRENT_FILE)
-
diff --git a/dirsrvtests/tests/suites/password/pwp_history_test.py
b/dirsrvtests/tests/suites/password/pwp_history_test.py
index d4d3e60..31d48f9 100644
--- a/dirsrvtests/tests/suites/password/pwp_history_test.py
+++ b/dirsrvtests/tests/suites/password/pwp_history_test.py
@@ -1,3 +1,11 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
import os
import ldap
import logging
@@ -8,50 +16,13 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-class TopologyStandalone(object):
- """ Topology class """
- def __init__(self, standalone):
- """ init """
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- """
- Creating standalone instance ...
- """
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- # Delete each instance in the end
- def fin():
- """ Clean up instance """
- standalone.delete()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- standalone.clearTmpDir(__file__)
-
- return TopologyStandalone(standalone)
-
-
-def test_pwp_history_test(topology):
+def test_pwp_history_test(topology_st):
"""
Test password policy history feature:
- Test password history is enforced
@@ -65,15 +36,15 @@ def test_pwp_history_test(topology):
# Configure password history policy and add a test user
#
try:
- topology.standalone.modify_s("cn=config",
- [(ldap.MOD_REPLACE,
- 'passwordHistory', 'on'),
- (ldap.MOD_REPLACE,
- 'passwordInHistory', '3'),
- (ldap.MOD_REPLACE,
- 'passwordChange', 'on'),
- (ldap.MOD_REPLACE,
- 'passwordStorageScheme',
'CLEAR')])
+ topology_st.standalone.modify_s("cn=config",
+ [(ldap.MOD_REPLACE,
+ 'passwordHistory', 'on'),
+ (ldap.MOD_REPLACE,
+ 'passwordInHistory', '3'),
+ (ldap.MOD_REPLACE,
+ 'passwordChange', 'on'),
+ (ldap.MOD_REPLACE,
+ 'passwordStorageScheme',
'CLEAR')])
log.info('Configured password policy.')
except ldap.LDAPError as e:
log.fatal('Failed to configure password policy: ' + str(e))
@@ -81,12 +52,12 @@ def test_pwp_history_test(topology):
time.sleep(1)
try:
- topology.standalone.add_s(Entry((USER_DN, {
- 'objectclass': ['top',
'extensibleObject'],
- 'sn': 'user',
- 'cn': 'test user',
- 'uid': 'testuser',
- 'userpassword': 'password'})))
+ topology_st.standalone.add_s(Entry((USER_DN, {
+ 'objectclass': ['top', 'extensibleObject'],
+ 'sn': 'user',
+ 'cn': 'test user',
+ 'uid': 'testuser',
+ 'userpassword': 'password'})))
except ldap.LDAPError as e:
log.fatal('Failed to add test user' + USER_DN + ': error ' +
str(e))
assert False
@@ -95,15 +66,15 @@ def test_pwp_history_test(topology):
# Test that password history is enforced.
#
try:
- topology.standalone.simple_bind_s(USER_DN, 'password')
+ topology_st.standalone.simple_bind_s(USER_DN, 'password')
except ldap.LDAPError as e:
log.fatal('Failed to bind as user: ' + str(e))
assert False
# Attempt to change password to the same password
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password')])
log.info('Incorrectly able to to set password to existing password.')
assert False
except ldap.CONSTRAINT_VIOLATION:
@@ -118,13 +89,13 @@ def test_pwp_history_test(topology):
# password1
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password1')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password1')])
except ldap.LDAPError as e:
log.fatal('Failed to change password: ' + str(e))
assert False
try:
- topology.standalone.simple_bind_s(USER_DN, 'password1')
+ topology_st.standalone.simple_bind_s(USER_DN, 'password1')
except ldap.LDAPError as e:
log.fatal('Failed to bind as user using "password1": ' +
str(e))
assert False
@@ -132,13 +103,13 @@ def test_pwp_history_test(topology):
# password2
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password2')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password2')])
except ldap.LDAPError as e:
log.fatal('Failed to change password: ' + str(e))
assert False
try:
- topology.standalone.simple_bind_s(USER_DN, 'password2')
+ topology_st.standalone.simple_bind_s(USER_DN, 'password2')
except ldap.LDAPError as e:
log.fatal('Failed to bind as user using "password2": ' +
str(e))
assert False
@@ -146,13 +117,13 @@ def test_pwp_history_test(topology):
# password3
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password3')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password3')])
except ldap.LDAPError as e:
log.fatal('Failed to change password: ' + str(e))
assert False
try:
- topology.standalone.simple_bind_s(USER_DN, 'password3')
+ topology_st.standalone.simple_bind_s(USER_DN, 'password3')
except ldap.LDAPError as e:
log.fatal('Failed to bind as user using "password3": ' +
str(e))
assert False
@@ -160,13 +131,13 @@ def test_pwp_history_test(topology):
# password4
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password4')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password4')])
except ldap.LDAPError as e:
log.fatal('Failed to change password: ' + str(e))
assert False
try:
- topology.standalone.simple_bind_s(USER_DN, 'password4')
+ topology_st.standalone.simple_bind_s(USER_DN, 'password4')
except ldap.LDAPError as e:
log.fatal('Failed to bind as user using "password4": ' +
str(e))
assert False
@@ -176,9 +147,9 @@ def test_pwp_history_test(topology):
# Check that we only have 3 passwords stored in history\
#
try:
- entry = topology.standalone.search_s(USER_DN, ldap.SCOPE_BASE,
- 'objectclass=*',
- ['passwordHistory'])
+ entry = topology_st.standalone.search_s(USER_DN, ldap.SCOPE_BASE,
+ 'objectclass=*',
+ ['passwordHistory'])
pwds = entry[0].getValues('passwordHistory')
if len(pwds) != 3:
log.fatal('Incorrect number of passwords stored in histry: %d' %
@@ -194,8 +165,8 @@ def test_pwp_history_test(topology):
# Attempt to change the password to previous passwords
#
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password1')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password1')])
log.info('Incorrectly able to to set password to previous password1.')
assert False
except ldap.CONSTRAINT_VIOLATION:
@@ -205,8 +176,8 @@ def test_pwp_history_test(topology):
assert False
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password2')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password2')])
log.info('Incorrectly able to to set password to previous password2.')
assert False
except ldap.CONSTRAINT_VIOLATION:
@@ -215,8 +186,8 @@ def test_pwp_history_test(topology):
log.fatal('Failed to attempt to change password: ' + str(e))
assert False
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password3')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password3')])
log.info('Incorrectly able to to set password to previous password3.')
assert False
except ldap.CONSTRAINT_VIOLATION:
@@ -229,29 +200,29 @@ def test_pwp_history_test(topology):
# Reset password by Directory Manager(admin reset)
#
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('Failed to bind as rootDN: ' + str(e))
assert False
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
- 'password-reset')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
+ 'password-reset')])
except ldap.LDAPError as e:
log.fatal('Failed to attempt to reset password: ' + str(e))
assert False
# Try and change the password to the previous password before the reset
try:
- topology.standalone.simple_bind_s(USER_DN, 'password-reset')
+ topology_st.standalone.simple_bind_s(USER_DN, 'password-reset')
except ldap.LDAPError as e:
log.fatal('Failed to bind as user: ' + str(e))
assert False
try:
- topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
- 'userpassword',
'password4')])
+ topology_st.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+ 'userpassword',
'password4')])
log.info('Incorrectly able to to set password to previous password4.')
assert False
except ldap.CONSTRAINT_VIOLATION:
diff --git a/dirsrvtests/tests/suites/posix_winsync_plugin/posix_winsync_test.py
b/dirsrvtests/tests/suites/posix_winsync_plugin/posix_winsync_test.py
deleted file mode 100644
index 1c1a993..0000000
--- a/dirsrvtests/tests/suites/posix_winsync_plugin/posix_winsync_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_posix_winsync_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_posix_winsync_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/psearch/psearch_test.py
b/dirsrvtests/tests/suites/psearch/psearch_test.py
deleted file mode 100644
index f78e19e..0000000
--- a/dirsrvtests/tests/suites/psearch/psearch_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_psearch_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_psearch_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/referint_plugin/referint_test.py
b/dirsrvtests/tests/suites/referint_plugin/referint_test.py
deleted file mode 100644
index ded1622..0000000
--- a/dirsrvtests/tests/suites/referint_plugin/referint_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_referint_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_referint_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/replication/cleanallruv_test.py
b/dirsrvtests/tests/suites/replication/cleanallruv_test.py
index afed323..4f9ac46 100644
--- a/dirsrvtests/tests/suites/replication/cleanallruv_test.py
+++ b/dirsrvtests/tests/suites/replication/cleanallruv_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -20,11 +20,11 @@ from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
+from lib389.topologies import topology_m4
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
-
class AddUsers(threading.Thread):
def __init__(self, inst, num_users):
@@ -34,7 +34,8 @@ class AddUsers(threading.Thread):
self.num_users = num_users
def openConnection(self, inst):
- # Open a new connection to our LDAP server
+ """Open a new connection to our LDAP server"""
+
server = DirSrv(verbose=False)
args_instance[SER_HOST] = inst.host
args_instance[SER_PORT] = inst.port
@@ -45,7 +46,8 @@ class AddUsers(threading.Thread):
return server
def run(self):
- # Start adding users
+ """Start adding users"""
+
conn = self.openConnection(self.inst)
idx = 0
@@ -53,9 +55,10 @@ class AddUsers(threading.Thread):
USER_DN = 'uid=' + self.inst.serverid + '_' + str(idx) +
',' + DEFAULT_SUFFIX
try:
conn.add_s(Entry((USER_DN, {'objectclass': 'top
extensibleObject'.split(),
- 'uid': 'user' + str(idx)})))
+ 'uid': 'user' + str(idx)})))
+
+ # One of the masters was probably put into read only mode - just break out
except ldap.UNWILLING_TO_PERFORM:
- # One of the masters was probably put into read only mode - just break
out
break
except ldap.ALREADY_EXISTS:
pass
@@ -67,38 +70,23 @@ class AddUsers(threading.Thread):
conn.close()
-def remove_master4_agmts(msg, topology):
- """Remove all the repl agmts to master4.
- """
+def remove_master4_agmts(msg, topology_m4):
+ """Remove all the repl agmts to master4. """
+
log.info('%s: remove all the agreements to master 4...' % msg)
- try:
- topology.master1.agreement.delete(DEFAULT_SUFFIX,
- topology.master4.host,
- topology.master4.port)
- except ldap.LDAPError as e:
- log.fatal('%s: Failed to delete agmt(m1 -> m4), error: %s' %
- (msg, str(e)))
- assert False
- try:
- topology.master2.agreement.delete(DEFAULT_SUFFIX,
- topology.master4.host,
- topology.master4.port)
- except ldap.LDAPError as e:
- log.fatal('%s: Failed to delete agmt(m2 -> m4), error: %s' %
- (msg, str(e)))
- assert False
- try:
- topology.master3.agreement.delete(DEFAULT_SUFFIX,
- topology.master4.host,
- topology.master4.port)
- except ldap.LDAPError as e:
- log.fatal('%s: Failed to delete agmt(m3 -> m4), error: ' %
- (msg, str(e)))
- assert False
+ for num in range(1, 4):
+ try:
+
topology_m4.ms["master{}".format(num)].agreement.delete(DEFAULT_SUFFIX,
+
topology_m4.ms["master4"].host,
+
topology_m4.ms["master4"].port)
+ except ldap.LDAPError as e:
+ log.fatal('{}: Failed to delete agmt(m{} -> m4), error:
{}'.format(msg, num, str(e)))
+ assert False
-def check_ruvs(msg, topology):
+def check_ruvs(msg, topology_m4):
"""Check masters 1- 3 for master 4's rid."""
+
clean = False
count = 0
while not clean and count < 10:
@@ -106,13 +94,12 @@ def check_ruvs(msg, topology):
# Check master 1
try:
- entry = topology.master1.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- REPLICA_RUV_FILTER)
+ entry = topology_m4.ms["master1"].search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ REPLICA_RUV_FILTER)
if not entry:
log.error('%s: Failed to find db tombstone entry from master' %
msg)
- repl_fail(replica_inst)
elements = entry[0].getValues('nsds50ruv')
for ruv in elements:
if 'replica 4' in ruv:
@@ -127,13 +114,12 @@ def check_ruvs(msg, topology):
# Check master 2
try:
- entry = topology.master2.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- REPLICA_RUV_FILTER)
+ entry = topology_m4.ms["master2"].search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ REPLICA_RUV_FILTER)
if not entry:
log.error('%s: Failed to find tombstone entry from master' %
msg)
- repl_fail(replica_inst)
elements = entry[0].getValues('nsds50ruv')
for ruv in elements:
if 'replica 4' in ruv:
@@ -148,13 +134,12 @@ def check_ruvs(msg, topology):
# Check master 3
try:
- entry = topology.master3.search_s(DEFAULT_SUFFIX,
- ldap.SCOPE_SUBTREE,
- REPLICA_RUV_FILTER)
+ entry = topology_m4.ms["master3"].search_s(DEFAULT_SUFFIX,
+ ldap.SCOPE_SUBTREE,
+ REPLICA_RUV_FILTER)
if not entry:
log.error('%s: Failed to find db tombstone entry from master' %
msg)
- repl_fail(replica_inst)
elements = entry[0].getValues('nsds50ruv')
for ruv in elements:
if 'replica 4' in ruv:
@@ -173,7 +158,7 @@ def check_ruvs(msg, topology):
return clean
-def task_done(topology, task_dn, timeout=60):
+def task_done(topology_m4, task_dn, timeout=60):
"""Check if the task is complete"""
attrlist = ['nsTaskLog', 'nsTaskStatus', 'nsTaskExitCode',
'nsTaskCurrentItem', 'nsTaskTotalItems']
@@ -182,7 +167,7 @@ def task_done(topology, task_dn, timeout=60):
while not done and count < timeout:
try:
- entry = topology.master1.getEntry(task_dn, attrlist=attrlist)
+ entry = topology_m4.ms["master1"].getEntry(task_dn,
attrlist=attrlist)
if not entry or entry.nsTaskExitCode:
done = True
break
@@ -197,270 +182,7 @@ def task_done(topology, task_dn, timeout=60):
return done
-class TopologyReplication(object):
- def __init__(self, master1, master2, master3, master4, m1_m2_agmt, m1_m3_agmt,
m1_m4_agmt):
- master1.open()
- self.master1 = master1
- master2.open()
- self.master2 = master2
- master3.open()
- self.master3 = master3
- master4.open()
- self.master4 = master4
-
- # Store the agreement dn's for future initializations
- self.m1_m2_agmt = m1_m2_agmt
- self.m1_m3_agmt = m1_m3_agmt
- self.m1_m4_agmt = m1_m4_agmt
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating master 1...
- master1 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_1
- args_instance[SER_PORT] = PORT_MASTER_1
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master1.allocate(args_master)
- instance_master1 = master1.exists()
- if instance_master1:
- master1.delete()
- master1.create()
- master1.open()
- master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_1)
- master1.log = log
-
- # Creating master 2...
- master2 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_2
- args_instance[SER_PORT] = PORT_MASTER_2
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master2.allocate(args_master)
- instance_master2 = master2.exists()
- if instance_master2:
- master2.delete()
- master2.create()
- master2.open()
- master2.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_2)
-
- # Creating master 3...
- master3 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_3
- args_instance[SER_PORT] = PORT_MASTER_3
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_3
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master3.allocate(args_master)
- instance_master3 = master3.exists()
- if instance_master3:
- master3.delete()
- master3.create()
- master3.open()
- master3.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_3)
-
- # Creating master 4...
- master4 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_4
- args_instance[SER_PORT] = PORT_MASTER_4
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_4
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master4.allocate(args_master)
- instance_master4 = master4.exists()
- if instance_master4:
- master4.delete()
- master4.create()
- master4.open()
- master4.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_4)
-
- #
- # Create all the agreements
- #
- # Creating agreement from master 1 to master 2
- properties = {RA_NAME: 'meTo_%s:%s' % (master2.host, master2.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m1_m2_agmt = master1.agreement.create(suffix=SUFFIX, host=master2.host,
port=master2.port, properties=properties)
- if not m1_m2_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m1_m2_agmt)
-
- # Creating agreement from master 1 to master 3
- properties = {RA_NAME: 'meTo_%s:%s' % (master3.host, master3.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m1_m3_agmt = master1.agreement.create(suffix=SUFFIX, host=master3.host,
port=master3.port, properties=properties)
- if not m1_m3_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m1_m3_agmt)
-
- # Creating agreement from master 1 to master 4
- properties = {RA_NAME: 'meTo_%s:%s' % (master4.host, master4.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m1_m4_agmt = master1.agreement.create(suffix=SUFFIX, host=master4.host,
port=master4.port, properties=properties)
- if not m1_m4_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m1_m4_agmt)
-
- # Creating agreement from master 2 to master 1
- properties = {RA_NAME: 'meTo_%s:%s' % (master1.host, master1.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m2_m1_agmt = master2.agreement.create(suffix=SUFFIX, host=master1.host,
port=master1.port, properties=properties)
- if not m2_m1_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m2_m1_agmt)
-
- # Creating agreement from master 2 to master 3
- properties = {RA_NAME: 'meTo_%s:%s' % (master3.host, master3.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m2_m3_agmt = master2.agreement.create(suffix=SUFFIX, host=master3.host,
port=master3.port, properties=properties)
- if not m2_m3_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m2_m3_agmt)
-
- # Creating agreement from master 2 to master 4
- properties = {RA_NAME: 'meTo_%s:%s' % (master4.host, master4.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m2_m4_agmt = master2.agreement.create(suffix=SUFFIX, host=master4.host,
port=master4.port, properties=properties)
- if not m2_m4_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m2_m4_agmt)
-
- # Creating agreement from master 3 to master 1
- properties = {RA_NAME: 'meTo_%s:%s' % (master1.host, master1.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m3_m1_agmt = master3.agreement.create(suffix=SUFFIX, host=master1.host,
port=master1.port, properties=properties)
- if not m3_m1_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m3_m1_agmt)
-
- # Creating agreement from master 3 to master 2
- properties = {RA_NAME: 'meTo_%s:%s' % (master2.host, master2.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m3_m2_agmt = master3.agreement.create(suffix=SUFFIX, host=master2.host,
port=master2.port, properties=properties)
- if not m3_m2_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m3_m2_agmt)
-
- # Creating agreement from master 3 to master 4
- properties = {RA_NAME: 'meTo_%s:%s' % (master4.host, master4.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m3_m4_agmt = master3.agreement.create(suffix=SUFFIX, host=master4.host,
port=master4.port, properties=properties)
- if not m3_m4_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m3_m4_agmt)
-
- # Creating agreement from master 4 to master 1
- properties = {RA_NAME: 'meTo_%s:%s' % (master1.host, master1.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m4_m1_agmt = master4.agreement.create(suffix=SUFFIX, host=master1.host,
port=master1.port, properties=properties)
- if not m4_m1_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m4_m1_agmt)
-
- # Creating agreement from master 4 to master 2
- properties = {RA_NAME: 'meTo_%s:%s' % (master2.host, master2.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m4_m2_agmt = master4.agreement.create(suffix=SUFFIX, host=master2.host,
port=master2.port, properties=properties)
- if not m4_m2_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m4_m2_agmt)
-
- # Creating agreement from master 4 to master 3
- properties = {RA_NAME: 'meTo_%s:%s' % (master3.host, master3.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m4_m3_agmt = master4.agreement.create(suffix=SUFFIX, host=master3.host,
port=master3.port, properties=properties)
- if not m4_m3_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m4_m3_agmt)
-
- # Allow the replicas to get situated with the new agreements
- time.sleep(5)
-
- #
- # Initialize all the agreements
- #
- master1.agreement.init(SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
- master1.waitForReplInit(m1_m2_agmt)
- master1.agreement.init(SUFFIX, HOST_MASTER_3, PORT_MASTER_3)
- master1.waitForReplInit(m1_m3_agmt)
- master1.agreement.init(SUFFIX, HOST_MASTER_4, PORT_MASTER_4)
- master1.waitForReplInit(m1_m4_agmt)
-
- # Check replication is working...
- if master1.testReplication(DEFAULT_SUFFIX, master2):
- log.info('Replication is working.')
- else:
- log.fatal('Replication is not working.')
- assert False
-
- # Clear out the tmp dir
- master1.clearTmpDir(__file__)
- def fin():
- master1.delete()
- master2.delete()
- master3.delete()
- master4.delete()
- request.addfinalizer(fin)
-
- return TopologyReplication(master1, master2, master3, master4, m1_m2_agmt,
m1_m3_agmt, m1_m4_agmt)
-
-
-def restore_master4(topology):
+def restore_master4(topology_m4):
'''
In our tests will always be removing master 4, so we need a common
way to restore it for another test
@@ -469,45 +191,46 @@ def restore_master4(topology):
log.info('Restoring master 4...')
# Enable replication on master 4
- topology.master4.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_4)
+ topology_m4.ms["master4"].replica.enableReplication(suffix=SUFFIX,
role=REPLICAROLE_MASTER,
+ replicaId=REPLICAID_MASTER_4)
#
# Create agreements from master 4 -> m1, m2 ,m3
#
# Creating agreement from master 4 to master 1
- properties = {RA_NAME: 'meTo_%s:%s' % (topology.master1.host,
topology.master1.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ properties = {RA_NAME: 'meTo_%s:%s' %
(topology_m4.ms["master1"].host, topology_m4.ms["master1"].port),
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m4_m1_agmt = topology.master4.agreement.create(suffix=SUFFIX,
host=topology.master1.host,
- port=topology.master1.port,
properties=properties)
+ m4_m1_agmt = topology_m4.ms["master4"].agreement.create(suffix=SUFFIX,
host=topology_m4.ms["master1"].host,
+
port=topology_m4.ms["master1"].port, properties=properties)
if not m4_m1_agmt:
log.fatal("Fail to create a master -> master replica agreement")
sys.exit(1)
log.debug("%s created" % m4_m1_agmt)
# Creating agreement from master 4 to master 2
- properties = {RA_NAME: 'meTo_%s:%s' % (topology.master2.host,
topology.master2.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ properties = {RA_NAME: 'meTo_%s:%s' %
(topology_m4.ms["master2"].host, topology_m4.ms["master2"].port),
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m4_m2_agmt = topology.master4.agreement.create(suffix=SUFFIX,
host=topology.master2.host,
- port=topology.master2.port,
properties=properties)
+ m4_m2_agmt = topology_m4.ms["master4"].agreement.create(suffix=SUFFIX,
host=topology_m4.ms["master2"].host,
+
port=topology_m4.ms["master2"].port, properties=properties)
if not m4_m2_agmt:
log.fatal("Fail to create a master -> master replica agreement")
sys.exit(1)
log.debug("%s created" % m4_m2_agmt)
# Creating agreement from master 4 to master 3
- properties = {RA_NAME: 'meTo_%s:%s' % (topology.master3.host,
topology.master3.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ properties = {RA_NAME: 'meTo_%s:%s' %
(topology_m4.ms["master3"].host, topology_m4.ms["master3"].port),
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m4_m3_agmt = topology.master4.agreement.create(suffix=SUFFIX,
host=topology.master3.host,
- port=topology.master3.port,
properties=properties)
+ m4_m3_agmt = topology_m4.ms["master4"].agreement.create(suffix=SUFFIX,
host=topology_m4.ms["master3"].host,
+
port=topology_m4.ms["master3"].port, properties=properties)
if not m4_m3_agmt:
log.fatal("Fail to create a master -> master replica agreement")
sys.exit(1)
@@ -517,39 +240,39 @@ def restore_master4(topology):
# Create agreements from m1, m2, m3 to master 4
#
# Creating agreement from master 1 to master 4
- properties = {RA_NAME: 'meTo_%s:%s' % (topology.master4.host,
topology.master4.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ properties = {RA_NAME: 'meTo_%s:%s' %
(topology_m4.ms["master4"].host, topology_m4.ms["master4"].port),
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m1_m4_agmt = topology.master1.agreement.create(suffix=SUFFIX,
host=topology.master4.host,
- port=topology.master4.port,
properties=properties)
+ m1_m4_agmt = topology_m4.ms["master1"].agreement.create(suffix=SUFFIX,
host=topology_m4.ms["master4"].host,
+
port=topology_m4.ms["master4"].port, properties=properties)
if not m1_m4_agmt:
log.fatal("Fail to create a master -> master replica agreement")
sys.exit(1)
log.debug("%s created" % m1_m4_agmt)
# Creating agreement from master 2 to master 4
- properties = {RA_NAME: 'meTo_%s:%s' % (topology.master4.host,
topology.master4.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ properties = {RA_NAME: 'meTo_%s:%s' %
(topology_m4.ms["master4"].host, topology_m4.ms["master4"].port),
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m2_m4_agmt = topology.master2.agreement.create(suffix=SUFFIX,
host=topology.master4.host,
- port=topology.master4.port,
properties=properties)
+ m2_m4_agmt = topology_m4.ms["master2"].agreement.create(suffix=SUFFIX,
host=topology_m4.ms["master4"].host,
+
port=topology_m4.ms["master4"].port, properties=properties)
if not m2_m4_agmt:
log.fatal("Fail to create a master -> master replica agreement")
sys.exit(1)
log.debug("%s created" % m2_m4_agmt)
# Creating agreement from master 3 to master 4
- properties = {RA_NAME: 'meTo_%s:%s' % (topology.master4.host,
topology.master4.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ properties = {RA_NAME: 'meTo_%s:%s' %
(topology_m4.ms["master4"].host, topology_m4.ms["master4"].port),
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m3_m4_agmt = topology.master3.agreement.create(suffix=SUFFIX,
host=topology.master4.host,
- port=topology.master4.port,
properties=properties)
+ m3_m4_agmt = topology_m4.ms["master3"].agreement.create(suffix=SUFFIX,
host=topology_m4.ms["master4"].host,
+
port=topology_m4.ms["master4"].port, properties=properties)
if not m3_m4_agmt:
log.fatal("Fail to create a master -> master replica agreement")
sys.exit(1)
@@ -558,39 +281,39 @@ def restore_master4(topology):
#
# Stop the servers - this allows the rid(for master4) to be used again
#
- topology.master1.stop(timeout=30)
- topology.master2.stop(timeout=30)
- topology.master3.stop(timeout=30)
- topology.master4.stop(timeout=30)
+ topology_m4.ms["master1"].stop(timeout=30)
+ topology_m4.ms["master2"].stop(timeout=30)
+ topology_m4.ms["master3"].stop(timeout=30)
+ topology_m4.ms["master4"].stop(timeout=30)
#
# Initialize the agreements
#
# m1 -> m2
- topology.master1.start(timeout=30)
- topology.master2.start(timeout=30)
+ topology_m4.ms["master1"].start(timeout=30)
+ topology_m4.ms["master2"].start(timeout=30)
time.sleep(5)
- topology.master1.agreement.init(SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
- topology.master1.waitForReplInit(topology.m1_m2_agmt)
+ topology_m4.ms["master1"].agreement.init(SUFFIX, HOST_MASTER_2,
PORT_MASTER_2)
+
topology_m4.ms["master1"].waitForReplInit(topology_m4.ms["master1_agmts"]["m1_m2"])
# m1 -> m3
- topology.master3.start(timeout=30)
+ topology_m4.ms["master3"].start(timeout=30)
time.sleep(5)
- topology.master1.agreement.init(SUFFIX, HOST_MASTER_3, PORT_MASTER_3)
- topology.master1.waitForReplInit(topology.m1_m3_agmt)
+ topology_m4.ms["master1"].agreement.init(SUFFIX, HOST_MASTER_3,
PORT_MASTER_3)
+
topology_m4.ms["master1"].waitForReplInit(topology_m4.ms["master1_agmts"]["m1_m3"])
# m1 -> m4
time.sleep(5)
- topology.master4.start(timeout=30)
- topology.master1.agreement.init(SUFFIX, HOST_MASTER_4, PORT_MASTER_4)
- topology.master1.waitForReplInit(topology.m1_m4_agmt)
+ topology_m4.ms["master4"].start(timeout=30)
+ topology_m4.ms["master1"].agreement.init(SUFFIX, HOST_MASTER_4,
PORT_MASTER_4)
+
topology_m4.ms["master1"].waitForReplInit(topology_m4.ms["master1_agmts"]["m1_m4"])
time.sleep(5)
#
# Test Replication is working
#
# Check replication is working with previous working master(m1 -> m2)
- if topology.master1.testReplication(DEFAULT_SUFFIX, topology.master2):
+ if topology_m4.ms["master1"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master2"]):
log.info('Replication is working m1 -> m2.')
else:
log.fatal('restore_master4: Replication is not working from m1 ->
m2.')
@@ -598,7 +321,7 @@ def restore_master4(topology):
time.sleep(1)
# Check replication is working from master 1 to master 4...
- if topology.master1.testReplication(DEFAULT_SUFFIX, topology.master4):
+ if topology_m4.ms["master1"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master4"]):
log.info('Replication is working m1 -> m4.')
else:
log.fatal('restore_master4: Replication is not working from m1 ->
m4.')
@@ -606,7 +329,7 @@ def restore_master4(topology):
time.sleep(1)
# Check replication is working from master 4 to master1...
- if topology.master4.testReplication(DEFAULT_SUFFIX, topology.master1):
+ if topology_m4.ms["master4"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master1"]):
log.info('Replication is working m4 -> m1.')
else:
log.fatal('restore_master4: Replication is not working from m4 ->
1.')
@@ -616,7 +339,7 @@ def restore_master4(topology):
log.info('Master 4 has been successfully restored.')
-def test_cleanallruv_init(topology):
+def test_cleanallruv_init(topology_m4):
'''
Make updates on each master to make sure we have the all master RUVs on
each master.
@@ -625,61 +348,61 @@ def test_cleanallruv_init(topology):
log.info('Initializing cleanAllRUV test suite...')
# Master 1
- if not topology.master1.testReplication(DEFAULT_SUFFIX, topology.master2):
+ if not topology_m4.ms["master1"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master2"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 1
and master 2.')
assert False
- if not topology.master1.testReplication(DEFAULT_SUFFIX, topology.master3):
+ if not topology_m4.ms["master1"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master3"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 1
and master 3.')
assert False
- if not topology.master1.testReplication(DEFAULT_SUFFIX, topology.master4):
+ if not topology_m4.ms["master1"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master4"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 1
and master 4.')
assert False
# Master 2
- if not topology.master2.testReplication(DEFAULT_SUFFIX, topology.master1):
+ if not topology_m4.ms["master2"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master1"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 1.')
assert False
- if not topology.master2.testReplication(DEFAULT_SUFFIX, topology.master3):
+ if not topology_m4.ms["master2"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master3"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 3.')
assert False
- if not topology.master2.testReplication(DEFAULT_SUFFIX, topology.master4):
+ if not topology_m4.ms["master2"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master4"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 4.')
assert False
# Master 3
- if not topology.master3.testReplication(DEFAULT_SUFFIX, topology.master1):
+ if not topology_m4.ms["master3"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master1"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 1.')
assert False
- if not topology.master3.testReplication(DEFAULT_SUFFIX, topology.master2):
+ if not topology_m4.ms["master3"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master2"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 2.')
assert False
- if not topology.master3.testReplication(DEFAULT_SUFFIX, topology.master4):
+ if not topology_m4.ms["master3"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master4"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 4.')
assert False
# Master 4
- if not topology.master4.testReplication(DEFAULT_SUFFIX, topology.master1):
+ if not topology_m4.ms["master4"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master1"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 1.')
assert False
- if not topology.master4.testReplication(DEFAULT_SUFFIX, topology.master2):
+ if not topology_m4.ms["master4"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master2"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 2.')
assert False
- if not topology.master4.testReplication(DEFAULT_SUFFIX, topology.master3):
+ if not topology_m4.ms["master4"].testReplication(DEFAULT_SUFFIX,
topology_m4.ms["master3"]):
log.fatal('test_cleanallruv_init: Replication is not working between master 2
and master 3.')
assert False
log.info('Initialized cleanAllRUV test suite.')
-def test_cleanallruv_clean(topology):
+def test_cleanallruv_clean(topology_m4):
'''
Disable a master, remove agreements to that master, and clean the RUVs on
the remaining replicas
@@ -689,20 +412,16 @@ def test_cleanallruv_clean(topology):
# Disable master 4
log.info('test_cleanallruv_clean: disable master 4...')
- try:
- topology.master4.replica.disableReplication(DEFAULT_SUFFIX)
- except:
- log.fatal('error!')
- assert False
+ topology_m4.ms["master4"].replica.disableReplication(DEFAULT_SUFFIX)
# Remove the agreements from the other masters that point to master 4
- remove_master4_agmts("test_cleanallruv_clean", topology)
+ remove_master4_agmts("test_cleanallruv_clean", topology_m4)
# Run the task
log.info('test_cleanallruv_clean: run the cleanAllRUV task...')
try:
- topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX, replicaid='4',
- args={TASK_WAIT: True})
+ topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
replicaid='4',
+ args={TASK_WAIT: True})
except ValueError as e:
log.fatal('test_cleanallruv_clean: Problem running cleanAllRuv task: ' +
e.message('desc'))
@@ -710,7 +429,7 @@ def test_cleanallruv_clean(topology):
# Check the other master's RUV for 'replica 4'
log.info('test_cleanallruv_clean: check all the masters have been
cleaned...')
- clean = check_ruvs("test_cleanallruv_clean", topology)
+ clean = check_ruvs("test_cleanallruv_clean", topology_m4)
if not clean:
log.fatal('test_cleanallruv_clean: Failed to clean replicas')
@@ -721,10 +440,10 @@ def test_cleanallruv_clean(topology):
#
# Cleanup - restore master 4
#
- restore_master4(topology)
+ restore_master4(topology_m4)
-def test_cleanallruv_clean_restart(topology):
+def test_cleanallruv_clean_restart(topology_m4):
'''
Test that if a master istopped during the clean process, that it
resumes and finishes when its started.
@@ -734,23 +453,19 @@ def test_cleanallruv_clean_restart(topology):
# Disable master 4
log.info('test_cleanallruv_clean_restart: disable master 4...')
- try:
- topology.master4.replica.disableReplication(DEFAULT_SUFFIX)
- except:
- log.fatal('error!')
- assert False
+ topology_m4.ms["master4"].replica.disableReplication(DEFAULT_SUFFIX)
# Remove the agreements from the other masters that point to master 4
log.info('test_cleanallruv_clean: remove all the agreements to master 4...')
- remove_master4_agmts("test_cleanallruv_clean restart", topology)
+ remove_master4_agmts("test_cleanallruv_clean restart", topology_m4)
# Stop master 3 to keep the task running, so we can stop master 1...
- topology.master3.stop(timeout=30)
+ topology_m4.ms["master3"].stop(timeout=30)
# Run the task
log.info('test_cleanallruv_clean_restart: run the cleanAllRUV task...')
try:
- (task_dn, rc) = topology.master1.tasks.cleanAllRUV(
+ (task_dn, rc) = topology_m4.ms["master1"].tasks.cleanAllRUV(
suffix=DEFAULT_SUFFIX, replicaid='4', args={TASK_WAIT: False})
except ValueError as e:
log.fatal('test_cleanallruv_clean_restart: Problem running cleanAllRuv task:
' +
@@ -759,27 +474,27 @@ def test_cleanallruv_clean_restart(topology):
# Sleep a bit, then stop master 1
time.sleep(5)
- topology.master1.stop(timeout=30)
+ topology_m4.ms["master1"].stop(timeout=30)
# Now start master 3 & 1, and make sure we didn't crash
- topology.master3.start(timeout=30)
- if topology.master3.detectDisorderlyShutdown():
+ topology_m4.ms["master3"].start(timeout=30)
+ if topology_m4.ms["master3"].detectDisorderlyShutdown():
log.fatal('test_cleanallruv_clean_restart: Master 3 previously
crashed!')
assert False
- topology.master1.start(timeout=30)
- if topology.master1.detectDisorderlyShutdown():
+ topology_m4.ms["master1"].start(timeout=30)
+ if topology_m4.ms["master1"].detectDisorderlyShutdown():
log.fatal('test_cleanallruv_clean_restart: Master 1 previously
crashed!')
assert False
# Wait a little for agmts/cleanallruv to wake up
- if not task_done(topology, task_dn):
+ if not task_done(topology_m4, task_dn):
log.fatal('test_cleanallruv_clean_restart: cleanAllRUV task did not
finish')
assert False
# Check the other master's RUV for 'replica 4'
log.info('test_cleanallruv_clean_restart: check all the masters have been
cleaned...')
- clean = check_ruvs("test_cleanallruv_clean_restart", topology)
+ clean = check_ruvs("test_cleanallruv_clean_restart", topology_m4)
if not clean:
log.fatal('Failed to clean replicas')
assert False
@@ -789,10 +504,10 @@ def test_cleanallruv_clean_restart(topology):
#
# Cleanup - restore master 4
#
- restore_master4(topology)
+ restore_master4(topology_m4)
-def test_cleanallruv_clean_force(topology):
+def test_cleanallruv_clean_force(topology_m4):
'''
Disable a master, remove agreements to that master, and clean the RUVs on
the remaining replicas
@@ -801,33 +516,29 @@ def test_cleanallruv_clean_force(topology):
log.info('Running test_cleanallruv_clean_force...')
# Stop master 3, while we update master 4, so that 3 is behind the other masters
- topology.master3.stop(timeout=10)
+ topology_m4.ms["master3"].stop(timeout=10)
# Add a bunch of updates to master 4
- m4_add_users = AddUsers(topology.master4, 1500)
+ m4_add_users = AddUsers(topology_m4.ms["master4"], 1500)
m4_add_users.start()
m4_add_users.join()
# Disable master 4
log.info('test_cleanallruv_clean_force: disable master 4...')
- try:
- topology.master4.replica.disableReplication(DEFAULT_SUFFIX)
- except:
- log.fatal('error!')
- assert False
+ topology_m4.ms["master4"].replica.disableReplication(DEFAULT_SUFFIX)
# Start master 3, it should be out of sync with the other replicas...
- topology.master3.start(timeout=30)
+ topology_m4.ms["master3"].start(timeout=30)
# Remove the agreements from the other masters that point to master 4
- remove_master4_agmts("test_cleanallruv_clean_force", topology)
+ remove_master4_agmts("test_cleanallruv_clean_force", topology_m4)
# Run the task, use "force" because master 3 is not in sync with the other
replicas
# in regards to the replica 4 RUV
log.info('test_cleanallruv_clean_force: run the cleanAllRUV task...')
try:
- topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX, replicaid='4',
- force=True, args={TASK_WAIT: True})
+ topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
replicaid='4',
+ force=True, args={TASK_WAIT: True})
except ValueError as e:
log.fatal('test_cleanallruv_clean_force: Problem running cleanAllRuv task:
' +
e.message('desc'))
@@ -835,7 +546,7 @@ def test_cleanallruv_clean_force(topology):
# Check the other master's RUV for 'replica 4'
log.info('test_cleanallruv_clean_force: check all the masters have been
cleaned...')
- clean = check_ruvs("test_cleanallruv_clean_force", topology)
+ clean = check_ruvs("test_cleanallruv_clean_force", topology_m4)
if not clean:
log.fatal('test_cleanallruv_clean_force: Failed to clean replicas')
assert False
@@ -845,10 +556,10 @@ def test_cleanallruv_clean_force(topology):
#
# Cleanup - restore master 4
#
- restore_master4(topology)
+ restore_master4(topology_m4)
-def test_cleanallruv_abort(topology):
+def test_cleanallruv_abort(topology_m4):
'''
Test the abort task.
@@ -864,24 +575,20 @@ def test_cleanallruv_abort(topology):
# Disable master 4
log.info('test_cleanallruv_abort: disable replication on master 4...')
- try:
- topology.master4.replica.disableReplication(DEFAULT_SUFFIX)
- except:
- log.fatal('test_cleanallruv_abort: failed to disable replication')
- assert False
+ topology_m4.ms["master4"].replica.disableReplication(DEFAULT_SUFFIX)
# Remove the agreements from the other masters that point to master 4
- remove_master4_agmts("test_cleanallruv_abort", topology)
+ remove_master4_agmts("test_cleanallruv_abort", topology_m4)
# Stop master 2
log.info('test_cleanallruv_abort: stop master 2 to freeze the cleanAllRUV
task...')
- topology.master2.stop(timeout=30)
+ topology_m4.ms["master2"].stop(timeout=30)
# Run the task
log.info('test_cleanallruv_abort: add the cleanAllRUV task...')
try:
- (clean_task_dn, rc) = topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
- replicaid='4', args={TASK_WAIT: False})
+ (clean_task_dn, rc) =
topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
+
replicaid='4', args={TASK_WAIT: False})
except ValueError as e:
log.fatal('test_cleanallruv_abort: Problem running cleanAllRuv task: ' +
e.message('desc'))
@@ -893,8 +600,8 @@ def test_cleanallruv_abort(topology):
# Abort the task
log.info('test_cleanallruv_abort: abort the cleanAllRUV task...')
try:
- topology.master1.tasks.abortCleanAllRUV(suffix=DEFAULT_SUFFIX,
replicaid='4',
- args={TASK_WAIT: True})
+ topology_m4.ms["master1"].tasks.abortCleanAllRUV(suffix=DEFAULT_SUFFIX,
replicaid='4',
+ args={TASK_WAIT: True})
except ValueError as e:
log.fatal('test_cleanallruv_abort: Problem running abortCleanAllRuv task:
' +
e.message('desc'))
@@ -902,21 +609,21 @@ def test_cleanallruv_abort(topology):
# Check master 1 does not have the clean task running
log.info('test_cleanallruv_abort: check master 1 no longer has a cleanAllRUV
task...')
- if not task_done(topology, clean_task_dn):
+ if not task_done(topology_m4, clean_task_dn):
log.fatal('test_cleanallruv_abort: CleanAllRUV task was not aborted')
assert False
# Start master 2
log.info('test_cleanallruv_abort: start master 2 to begin the restore
process...')
- topology.master2.start(timeout=30)
+ topology_m4.ms["master2"].start(timeout=30)
#
# Now run the clean task task again to we can properly restore master 4
#
log.info('test_cleanallruv_abort: run cleanAllRUV task so we can properly restore
master 4...')
try:
- topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
- replicaid='4', args={TASK_WAIT: True})
+ topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
+ replicaid='4',
args={TASK_WAIT: True})
except ValueError as e:
log.fatal('test_cleanallruv_abort: Problem running cleanAllRuv task: ' +
e.message('desc'))
assert False
@@ -926,10 +633,10 @@ def test_cleanallruv_abort(topology):
#
# Cleanup - Restore master 4
#
- restore_master4(topology)
+ restore_master4(topology_m4)
-def test_cleanallruv_abort_restart(topology):
+def test_cleanallruv_abort_restart(topology_m4):
'''
Test the abort task can handle a restart, and then resume
'''
@@ -938,25 +645,21 @@ def test_cleanallruv_abort_restart(topology):
# Disable master 4
log.info('test_cleanallruv_abort_restart: disable replication on master
4...')
- try:
- topology.master4.replica.disableReplication(DEFAULT_SUFFIX)
- except:
- log.fatal('error!')
- assert False
+ topology_m4.ms["master4"].replica.disableReplication(DEFAULT_SUFFIX)
# Remove the agreements from the other masters that point to master 4
log.info('test_cleanallruv_abort_restart: remove all the agreements to master
4...)')
- remove_master4_agmts("test_cleanallruv_abort_restart", topology)
+ remove_master4_agmts("test_cleanallruv_abort_restart", topology_m4)
# Stop master 3
log.info('test_cleanallruv_abort_restart: stop master 3 to freeze the cleanAllRUV
task...')
- topology.master3.stop()
+ topology_m4.ms["master3"].stop()
# Run the task
log.info('test_cleanallruv_abort_restart: add the cleanAllRUV task...')
try:
- (clean_task_dn, rc) = topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
- replicaid='4', args={TASK_WAIT: False})
+ (clean_task_dn, rc) =
topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
+
replicaid='4', args={TASK_WAIT: False})
except ValueError as e:
log.fatal('test_cleanallruv_abort_restart: Problem running cleanAllRuv task:
' +
e.message('desc'))
@@ -968,8 +671,8 @@ def test_cleanallruv_abort_restart(topology):
# Abort the task
log.info('test_cleanallruv_abort_restart: abort the cleanAllRUV task...')
try:
- topology.master1.tasks.abortCleanAllRUV(suffix=DEFAULT_SUFFIX,
replicaid='4',
- certify=True, args={TASK_WAIT: False})
+ topology_m4.ms["master1"].tasks.abortCleanAllRUV(suffix=DEFAULT_SUFFIX,
replicaid='4',
+ certify=True, args={TASK_WAIT:
False})
except ValueError as e:
log.fatal('test_cleanallruv_abort_restart: Problem running
test_cleanallruv_abort_restart task: ' +
e.message('desc'))
@@ -981,21 +684,21 @@ def test_cleanallruv_abort_restart(topology):
# Check master 1 does not have the clean task running
log.info('test_cleanallruv_abort: check master 1 no longer has a cleanAllRUV
task...')
- if not task_done(topology, clean_task_dn):
+ if not task_done(topology_m4, clean_task_dn):
log.fatal('test_cleanallruv_abort_restart: CleanAllRUV task was not
aborted')
assert False
# Now restart master 1, and make sure the abort process completes
- topology.master1.restart()
- if topology.master1.detectDisorderlyShutdown():
+ topology_m4.ms["master1"].restart()
+ if topology_m4.ms["master1"].detectDisorderlyShutdown():
log.fatal('test_cleanallruv_abort_restart: Master 1 previously
crashed!')
assert False
# Start master 3
- topology.master3.start()
+ topology_m4.ms["master3"].start()
# Check master 1 tried to run abort task. We expect the abort task to be aborted.
- if not topology.master1.searchErrorsLog('Aborting abort task'):
+ if not topology_m4.ms["master1"].searchErrorsLog('Aborting abort
task'):
log.fatal('test_cleanallruv_abort_restart: Abort task did not restart')
assert False
@@ -1004,8 +707,8 @@ def test_cleanallruv_abort_restart(topology):
#
log.info('test_cleanallruv_abort_restart: run cleanAllRUV task so we can properly
restore master 4...')
try:
- topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
- replicaid='4', args={TASK_WAIT: True})
+ topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
+ replicaid='4',
args={TASK_WAIT: True})
except ValueError as e:
log.fatal('test_cleanallruv_abort_restart: Problem running cleanAllRuv task:
' +
e.message('desc'))
@@ -1016,10 +719,10 @@ def test_cleanallruv_abort_restart(topology):
#
# Cleanup - Restore master 4
#
- restore_master4(topology)
+ restore_master4(topology_m4)
-def test_cleanallruv_abort_certify(topology):
+def test_cleanallruv_abort_certify(topology_m4):
'''
Test the abort task.
@@ -1035,24 +738,20 @@ def test_cleanallruv_abort_certify(topology):
# Disable master 4
log.info('test_cleanallruv_abort_certify: disable replication on master
4...')
- try:
- topology.master4.replica.disableReplication(DEFAULT_SUFFIX)
- except:
- log.fatal('error!')
- assert False
+ topology_m4.ms["master4"].replica.disableReplication(DEFAULT_SUFFIX)
# Remove the agreements from the other masters that point to master 4
- remove_master4_agmts("test_cleanallruv_abort_certify", topology)
+ remove_master4_agmts("test_cleanallruv_abort_certify", topology_m4)
# Stop master 2
log.info('test_cleanallruv_abort_certify: stop master 2 to freeze the cleanAllRUV
task...')
- topology.master2.stop()
+ topology_m4.ms["master2"].stop()
# Run the task
log.info('test_cleanallruv_abort_certify: add the cleanAllRUV task...')
try:
- (clean_task_dn, rc) = topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
- replicaid='4', args={TASK_WAIT: False})
+ (clean_task_dn, rc) =
topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
+
replicaid='4', args={TASK_WAIT: False})
except ValueError as e:
log.fatal('test_cleanallruv_abort_certify: Problem running cleanAllRuv task:
' +
e.message('desc'))
@@ -1064,8 +763,9 @@ def test_cleanallruv_abort_certify(topology):
# Abort the task
log.info('test_cleanallruv_abort_certify: abort the cleanAllRUV task...')
try:
- (abort_task_dn, rc) =
topology.master1.tasks.abortCleanAllRUV(suffix=DEFAULT_SUFFIX,
- replicaid='4', certify=True, args={TASK_WAIT:
False})
+ (abort_task_dn, rc) =
topology_m4.ms["master1"].tasks.abortCleanAllRUV(suffix=DEFAULT_SUFFIX,
+
replicaid='4', certify=True,
+
args={TASK_WAIT: False})
except ValueError as e:
log.fatal('test_cleanallruv_abort_certify: Problem running abortCleanAllRuv
task: ' +
e.message('desc'))
@@ -1075,36 +775,36 @@ def test_cleanallruv_abort_certify(topology):
log.info('test_cleanallruv_abort_certify: sleep for 5 seconds')
time.sleep(5)
- if task_done(topology, abort_task_dn, 60):
+ if task_done(topology_m4, abort_task_dn, 60):
log.fatal('test_cleanallruv_abort_certify: abort task incorrectly
finished')
assert False
# Now start master 2 so it can be aborted
log.info('test_cleanallruv_abort_certify: start master 2 to allow the abort task
to finish...')
- topology.master2.start()
+ topology_m4.ms["master2"].start()
# Wait for the abort task to stop
- if not task_done(topology, abort_task_dn, 60):
+ if not task_done(topology_m4, abort_task_dn, 60):
log.fatal('test_cleanallruv_abort_certify: The abort CleanAllRUV task was not
aborted')
assert False
# Check master 1 does not have the clean task running
log.info('test_cleanallruv_abort_certify: check master 1 no longer has a
cleanAllRUV task...')
- if not task_done(topology, clean_task_dn):
+ if not task_done(topology_m4, clean_task_dn):
log.fatal('test_cleanallruv_abort_certify: CleanAllRUV task was not
aborted')
assert False
# Start master 2
log.info('test_cleanallruv_abort_certify: start master 2 to begin the restore
process...')
- topology.master2.start()
+ topology_m4.ms["master2"].start()
#
# Now run the clean task task again to we can properly restore master 4
#
log.info('test_cleanallruv_abort_certify: run cleanAllRUV task so we can properly
restore master 4...')
try:
- topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
- replicaid='4', args={TASK_WAIT: True})
+ topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
+ replicaid='4',
args={TASK_WAIT: True})
except ValueError as e:
log.fatal('test_cleanallruv_abort_certify: Problem running cleanAllRuv task:
' +
e.message('desc'))
@@ -1115,10 +815,10 @@ def test_cleanallruv_abort_certify(topology):
#
# Cleanup - Restore master 4
#
- restore_master4(topology)
+ restore_master4(topology_m4)
-def test_cleanallruv_stress_clean(topology):
+def test_cleanallruv_stress_clean(topology_m4):
'''
Put each server(m1 - m4) under stress, and perform the entire clean process
'''
@@ -1126,13 +826,13 @@ def test_cleanallruv_stress_clean(topology):
log.info('test_cleanallruv_stress_clean: put all the masters under load...')
# Put all the masters under load
- m1_add_users = AddUsers(topology.master1, 2000)
+ m1_add_users = AddUsers(topology_m4.ms["master1"], 2000)
m1_add_users.start()
- m2_add_users = AddUsers(topology.master2, 2000)
+ m2_add_users = AddUsers(topology_m4.ms["master2"], 2000)
m2_add_users.start()
- m3_add_users = AddUsers(topology.master3, 2000)
+ m3_add_users = AddUsers(topology_m4.ms["master3"], 2000)
m3_add_users.start()
- m4_add_users = AddUsers(topology.master4, 2000)
+ m4_add_users = AddUsers(topology_m4.ms["master4"], 2000)
m4_add_users.start()
# Allow sometime to get replication flowing in all directions
@@ -1142,7 +842,7 @@ def test_cleanallruv_stress_clean(topology):
# Put master 4 into read only mode
log.info('test_cleanallruv_stress_clean: put master 4 into read-only
mode...')
try:
- topology.master4.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-readonly', 'on')])
+ topology_m4.ms["master4"].modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-readonly', 'on')])
except ldap.LDAPError as e:
log.fatal('test_cleanallruv_stress_clean: Failed to put master 4 into
read-only mode: error ' +
e.message['desc'])
@@ -1155,19 +855,19 @@ def test_cleanallruv_stress_clean(topology):
# Disable master 4
log.info('test_cleanallruv_stress_clean: disable replication on master
4...')
try:
- topology.master4.replica.disableReplication(DEFAULT_SUFFIX)
+ topology_m4.ms["master4"].replica.disableReplication(DEFAULT_SUFFIX)
except:
log.fatal('test_cleanallruv_stress_clean: failed to diable replication')
assert False
# Remove the agreements from the other masters that point to master 4
- remove_master4_agmts("test_cleanallruv_stress_clean", topology)
+ remove_master4_agmts("test_cleanallruv_stress_clean", topology_m4)
# Run the task
log.info('test_cleanallruv_stress_clean: Run the cleanAllRUV task...')
try:
- topology.master1.tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX, replicaid='4',
- args={TASK_WAIT: True})
+ topology_m4.ms["master1"].tasks.cleanAllRUV(suffix=DEFAULT_SUFFIX,
replicaid='4',
+ args={TASK_WAIT: True})
except ValueError as e:
log.fatal('test_cleanallruv_stress_clean: Problem running cleanAllRuv task:
' +
e.message('desc'))
@@ -1182,7 +882,7 @@ def test_cleanallruv_stress_clean(topology):
# Check the other master's RUV for 'replica 4'
log.info('test_cleanallruv_stress_clean: check if all the replicas have been
cleaned...')
- clean = check_ruvs("test_cleanallruv_stress_clean", topology)
+ clean = check_ruvs("test_cleanallruv_stress_clean", topology_m4)
if not clean:
log.fatal('test_cleanallruv_stress_clean: Failed to clean replicas')
assert False
@@ -1199,13 +899,13 @@ def test_cleanallruv_stress_clean(topology):
# Turn off readonly mode
try:
- topology.master4.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-readonly', 'off')])
+ topology_m4.ms["master4"].modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-readonly', 'off')])
except ldap.LDAPError as e:
log.fatal('test_cleanallruv_stress_clean: Failed to put master 4 into
read-only mode: error ' +
e.message['desc'])
assert False
- restore_master4(topology)
+ restore_master4(topology_m4)
if __name__ == '__main__':
diff --git a/dirsrvtests/tests/suites/replication/wait_for_async_feature_test.py
b/dirsrvtests/tests/suites/replication/wait_for_async_feature_test.py
index 02c27b9..54b47e6 100644
--- a/dirsrvtests/tests/suites/replication/wait_for_async_feature_test.py
+++ b/dirsrvtests/tests/suites/replication/wait_for_async_feature_test.py
@@ -1,3 +1,11 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
import os
import sys
import time
@@ -11,6 +19,7 @@ from lib389.properties import *
from lib389.tasks import *
from lib389.utils import *
from collections import Counter
+from lib389.topologies import topology_m2
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
@@ -20,157 +29,49 @@ installation1_prefix = None
WAITFOR_ASYNC_ATTR = "nsDS5ReplicaWaitForAsyncResults"
-class TopologyReplication(object):
- def __init__(self, master1, master2, m1_m2_agmt, m2_m1_agmt):
- master1.open()
- master2.open()
- self.masters = ((master1, m1_m2_agmt),
- (master2, m2_m1_agmt))
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating master 1...
- master1 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_1
- args_instance[SER_PORT] = PORT_MASTER_1
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master1.allocate(args_master)
- instance_master1 = master1.exists()
- if instance_master1:
- master1.delete()
- master1.create()
- master1.open()
- master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_1)
-
- # Creating master 2...
- master2 = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_MASTER_2
- args_instance[SER_PORT] = PORT_MASTER_2
- args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_master = args_instance.copy()
- master2.allocate(args_master)
- instance_master2 = master2.exists()
- if instance_master2:
- master2.delete()
- master2.create()
- master2.open()
- master2.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER,
replicaId=REPLICAID_MASTER_2)
-
- #
- # Create all the agreements
- #
- # Creating agreement from master 1 to master 2
- properties = {RA_NAME: 'meTo_%s:%s' %(master2.host, master2.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m1_m2_agmt = master1.agreement.create(suffix=SUFFIX, host=master2.host,
port=master2.port, properties=properties)
- if not m1_m2_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m1_m2_agmt)
-
- # Creating agreement from master 2 to master 1
- properties = {RA_NAME: 'meTo_%s:%s' %(master1.host, master1.port),
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- m2_m1_agmt = master2.agreement.create(suffix=SUFFIX, host=master1.host,
port=master1.port, properties=properties)
- if not m2_m1_agmt:
- log.fatal("Fail to create a master -> master replica agreement")
- sys.exit(1)
- log.debug("%s created" % m2_m1_agmt)
-
- # Allow the replicas to get situated with the new agreements...
- time.sleep(5)
-
- #
- # Initialize all the agreements
- #
- master1.agreement.init(SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
- master1.waitForReplInit(m1_m2_agmt)
- master2.agreement.init(SUFFIX, HOST_MASTER_1, PORT_MASTER_1)
- master2.waitForReplInit(m2_m1_agmt)
-
- # Check replication is working...
- if master1.testReplication(DEFAULT_SUFFIX, master2):
- log.info('Replication is working.')
- else:
- log.fatal('Replication is not working.')
- assert False
-
- log.info("Set Replication Debugging loglevel for the errorlog")
- master1.setLogLevel(LOG_REPLICA)
- master2.setLogLevel(LOG_REPLICA)
-
- logging_attr = 'nsslapd-logging-hr-timestamps-enabled'
- master1.modify_s("cn=config", [(ldap.MOD_REPLACE, logging_attr,
"off")])
- master2.modify_s("cn=config", [(ldap.MOD_REPLACE, logging_attr,
"off")])
-
- # Delete each instance in the end
- def fin():
- master1.delete()
- master2.delete()
- request.addfinalizer(fin)
-
- # Clear out the tmp dir
- master1.clearTmpDir(__file__)
-
- return TopologyReplication(master1, master2, m1_m2_agmt, m2_m1_agmt)
-
-
-(a)pytest.fixture(params=[(None, (4, 10)),
- ('2000', (0, 1)),
- ('0', (4, 10)),
- ('-5', (4, 10))])
-def waitfor_async_attr(topology, request):
+(a)pytest.fixture(params=[(None, (4, 11)),
+ ('2000', (0, 2)),
+ ('0', (4, 11)),
+ ('-5', (4, 11))])
+def waitfor_async_attr(topology_m2, request):
"""Sets attribute on all replicas"""
attr_value = request.param[0]
expected_result = request.param[1]
# Run through all masters
- for master in topology.masters:
- agmt = master[1]
+ for num in range(1, 3):
+ master = topology_m2.ms["master{}".format(num)]
+ agmt = topology_m2.ms["master{}_agmts".format(num)].values()[0]
try:
if attr_value:
log.info("Set %s: %s on %s" % (
- WAITFOR_ASYNC_ATTR, attr_value, master[0].serverid))
+ WAITFOR_ASYNC_ATTR, attr_value, master.serverid))
mod = [(ldap.MOD_REPLACE, WAITFOR_ASYNC_ATTR, attr_value)]
else:
log.info("Delete %s from %s" % (
- WAITFOR_ASYNC_ATTR, master[0].serverid))
+ WAITFOR_ASYNC_ATTR, master.serverid))
mod = [(ldap.MOD_DELETE, WAITFOR_ASYNC_ATTR, None)]
- master[0].modify_s(agmt, mod)
+ master.modify_s(agmt, mod)
except ldap.LDAPError as e:
log.error('Failed to set or delete %s attribute: (%s)' % (
- WAITFOR_ASYNC_ATTR, e.message['desc']))
+ WAITFOR_ASYNC_ATTR, e.message['desc']))
return (attr_value, expected_result)
@pytest.fixture
-def entries(topology, request):
+def entries(topology_m2, request):
"""Adds entries to the master1"""
- master1 = topology.masters[0][0]
+ master1 = topology_m2.ms["master1"]
TEST_OU = "test"
test_dn = SUFFIX
test_list = []
log.info("Add 100 nested entries under replicated suffix on %s" %
master1.serverid)
- for i in xrange(100):
+ for i in range(100):
test_dn = 'ou=%s%s,%s' % (TEST_OU, i, test_dn)
test_list.insert(0, test_dn)
try:
@@ -180,7 +81,7 @@ def entries(topology, request):
'ou': TEST_OU})))
except ldap.LDAPError as e:
log.error('Failed to add entry (%s): error (%s)' % (test_dn,
-
e.message['desc']))
+
e.message['desc']))
assert False
log.info("Delete created entries")
@@ -196,14 +97,15 @@ def entries(topology, request):
log.info("Clear the errors log in the end of the test case")
with open(master1.errlog, 'w') as errlog:
errlog.writelines("")
+
request.addfinalizer(fin)
-def test_not_int_value(topology):
+def test_not_int_value(topology_m2):
"""Tests not integer value"""
- master1 = topology.masters[0][0]
- agmt = topology.masters[0][1]
+ master1 = topology_m2.ms["master1"]
+ agmt = topology_m2.ms["master1_agmts"]["m1_m2"]
log.info("Try to set %s: wv1" % WAITFOR_ASYNC_ATTR)
try:
@@ -213,15 +115,15 @@ def test_not_int_value(topology):
assert e.message['desc'] == 'Invalid syntax'
-def test_multi_value(topology):
+def test_multi_value(topology_m2):
"""Tests multi value"""
- master1 = topology.masters[0][0]
- agmt = topology.masters[0][1]
+ master1 = topology_m2.ms["master1"]
+ agmt = topology_m2.ms["master1_agmts"]["m1_m2"]
log.info("agmt: %s" % agmt)
log.info("Try to set %s: 100 and 101 in the same time (multi value test)" %
(
- WAITFOR_ASYNC_ATTR))
+ WAITFOR_ASYNC_ATTR))
try:
mod = [(ldap.MOD_ADD, WAITFOR_ASYNC_ATTR, "100")]
master1.modify_s(agmt, mod)
@@ -231,34 +133,46 @@ def test_multi_value(topology):
assert e.message['desc'] == 'Object class violation'
-def test_value_check(topology, waitfor_async_attr):
+def test_value_check(topology_m2, waitfor_async_attr):
"""Checks that value has been set correctly"""
attr_value = waitfor_async_attr[0]
- for master in topology.masters:
- agmt = master[1]
+ for num in range(1, 3):
+ master = topology_m2.ms["master{}".format(num)]
+ agmt = topology_m2.ms["master{}_agmts".format(num)].values()[0]
- log.info("Check attr %s on %s" % (WAITFOR_ASYNC_ATTR,
master[0].serverid))
+ log.info("Check attr %s on %s" % (WAITFOR_ASYNC_ATTR,
master.serverid))
try:
if attr_value:
- entry = master[0].search_s(agmt, ldap.SCOPE_BASE, "%s=%s" % (
- WAITFOR_ASYNC_ATTR, attr_value))
+ entry = master.search_s(agmt, ldap.SCOPE_BASE, "%s=%s" % (
+ WAITFOR_ASYNC_ATTR, attr_value))
assert entry
else:
- entry = master[0].search_s(agmt, ldap.SCOPE_BASE, "%s=*" %
WAITFOR_ASYNC_ATTR)
+ entry = master.search_s(agmt, ldap.SCOPE_BASE, "%s=*" %
WAITFOR_ASYNC_ATTR)
assert not entry
except ldap.LDAPError as e:
log.fatal('Search failed, error: ' + e.message['desc'])
assert False
-def test_behavior_with_value(topology, waitfor_async_attr, entries):
+def test_behavior_with_value(topology_m2, waitfor_async_attr, entries):
"""Tests replication behavior with valid
nsDS5ReplicaWaitForAsyncResults attribute values
"""
- master1 = topology.masters[0][0]
+ master1 = topology_m2.ms["master1"]
+ master2 = topology_m2.ms["master2"]
+
+ log.info("Set Replication Debugging loglevel for the errorlog")
+ master1.setLogLevel(LOG_REPLICA)
+ master2.setLogLevel(LOG_REPLICA)
+
+ master1.modify_s("cn=config", [(ldap.MOD_REPLACE,
+ 'nsslapd-logging-hr-timestamps-enabled',
"off")])
+ master2.modify_s("cn=config", [(ldap.MOD_REPLACE,
+ 'nsslapd-logging-hr-timestamps-enabled',
"off")])
+
sync_dict = Counter()
min_ap = waitfor_async_attr[1][0]
max_ap = waitfor_async_attr[1][1]
@@ -268,8 +182,9 @@ def test_behavior_with_value(topology, waitfor_async_attr, entries):
log.info("Gather all sync attempts within Counter dict, group by
timestamp")
with open(master1.errlog, 'r') as errlog:
errlog_filtered = filter(lambda x: "waitfor_async_results" in x,
errlog)
+
+ # Watch only over unsuccessful sync attempts
for line in errlog_filtered:
- # Watch only over unsuccessful sync attempts
if line.split()[3] != line.split()[4]:
timestamp = line.split(']')[0]
sync_dict[timestamp] += 1
diff --git a/dirsrvtests/tests/suites/replsync_plugin/repl_sync_test.py
b/dirsrvtests/tests/suites/replsync_plugin/repl_sync_test.py
deleted file mode 100644
index fc3a559..0000000
--- a/dirsrvtests/tests/suites/replsync_plugin/repl_sync_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_repl_sync_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_repl_sync_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/resource_limits/res_limits_test.py
b/dirsrvtests/tests/suites/resource_limits/res_limits_test.py
deleted file mode 100644
index e904bbf..0000000
--- a/dirsrvtests/tests/suites/resource_limits/res_limits_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_res_limits_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_res_limits_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/retrocl_plugin/retrocl_test.py
b/dirsrvtests/tests/suites/retrocl_plugin/retrocl_test.py
deleted file mode 100644
index d1419fa..0000000
--- a/dirsrvtests/tests/suites/retrocl_plugin/retrocl_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_retrocl_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_retrocl_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/reverpwd_plugin/reverpwd_test.py
b/dirsrvtests/tests/suites/reverpwd_plugin/reverpwd_test.py
deleted file mode 100644
index b5b978b..0000000
--- a/dirsrvtests/tests/suites/reverpwd_plugin/reverpwd_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_reverpwd_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_reverpwd_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/roles_plugin/roles_test.py
b/dirsrvtests/tests/suites/roles_plugin/roles_test.py
deleted file mode 100644
index 2a5ea23..0000000
--- a/dirsrvtests/tests/suites/roles_plugin/roles_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_roles_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_roles_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/rootdn_plugin/rootdn_plugin_test.py
b/dirsrvtests/tests/suites/rootdn_plugin/rootdn_plugin_test.py
index a904644..929f0e9 100644
--- a/dirsrvtests/tests/suites/rootdn_plugin/rootdn_plugin_test.py
+++ b/dirsrvtests/tests/suites/rootdn_plugin/rootdn_plugin_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -18,50 +18,16 @@ from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
from lib389.tasks import *
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
-
PLUGIN_DN = 'cn=' + PLUGIN_ROOTDN_ACCESS + ',cn=plugins,cn=config'
USER1_DN = 'uid=user1,' + DEFAULT_SUFFIX
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_rootdn_init(topology):
+def test_rootdn_init(topology_st):
'''
Initialize our setup to test the ROot DN Access Control Plugin
@@ -85,7 +51,7 @@ def test_rootdn_init(topology):
ACI = ('(target ="ldap:///cn=config")(targetattr =
"*")(version 3.0' +
';acl "all access";allow
(all)(userdn="ldap:///anyone");)')
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_ADD, 'aci', ACI)])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_ADD, 'aci', ACI)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_init: Failed to add aci to config: error ' +
e.message['desc'])
@@ -95,7 +61,7 @@ def test_rootdn_init(topology):
# Create a user to modify the config
#
try:
- topology.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
+ topology_st.standalone.add_s(Entry((USER1_DN, {'objectclass': "top
extensibleObject".split(),
'uid': 'user1',
'userpassword': PASSWORD})))
except ldap.LDAPError as e:
@@ -107,7 +73,7 @@ def test_rootdn_init(topology):
# Enable dynamic plugins
#
try:
- topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
+ topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
log.fatal('test_rootdn_init: Failed to set dynamic plugins: error ' +
e.message['desc'])
assert False
@@ -115,12 +81,12 @@ def test_rootdn_init(topology):
#
# Enable the plugin (aftewr enabling dynamic plugins)
#
- topology.standalone.plugins.enable(PLUGIN_ROOTDN_ACCESS)
+ topology_st.standalone.plugins.enable(PLUGIN_ROOTDN_ACCESS)
log.info('test_rootdn_init: Initialized root DN test suite.')
-def test_rootdn_access_specific_time(topology):
+def test_rootdn_access_specific_time(topology_st):
'''
Test binding inside and outside of a specific time
'''
@@ -137,7 +103,7 @@ def test_rootdn_access_specific_time(topology):
close_time = '1800'
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-open-time', open_time),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-open-time', open_time),
(ldap.MOD_ADD, 'rootdn-close-time',
close_time)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_specific_time: Failed to set (blocking)
open/close times: error ' +
@@ -148,7 +114,7 @@ def test_rootdn_access_specific_time(topology):
# Bind as Root DN - should fail
#
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
succeeded = True
except ldap.LDAPError as e:
succeeded = False
@@ -161,13 +127,13 @@ def test_rootdn_access_specific_time(topology):
# Set config to allow the entire day
#
try:
- topology.standalone.simple_bind_s(USER1_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER1_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_specific_time: test_rootdn: failed to bind as
user1')
assert False
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
(ldap.MOD_REPLACE, 'rootdn-close-time',
'2359')])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_specific_time: Failed to set (open) open/close
times: error ' +
@@ -175,7 +141,7 @@ def test_rootdn_access_specific_time(topology):
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_specific_time: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -185,7 +151,7 @@ def test_rootdn_access_specific_time(topology):
# Cleanup - undo the changes we made so the next test has a clean slate
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-open-time', None),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-open-time', None),
(ldap.MOD_DELETE,
'rootdn-close-time', None)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_specific_time: Failed to delete open and close
time: error ' +
@@ -193,7 +159,7 @@ def test_rootdn_access_specific_time(topology):
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_specific_time: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -202,7 +168,7 @@ def test_rootdn_access_specific_time(topology):
log.info('test_rootdn_access_specific_time: PASSED')
-def test_rootdn_access_day_of_week(topology):
+def test_rootdn_access_day_of_week(topology_st):
'''
Test the days of week feature
'''
@@ -231,7 +197,7 @@ def test_rootdn_access_day_of_week(topology):
# Set the deny days
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed',
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed',
deny_days)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_day_of_week: Failed to set the deny days: error
' +
@@ -242,7 +208,7 @@ def test_rootdn_access_day_of_week(topology):
# Bind as Root DN - should fail
#
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
succeeded = True
except ldap.LDAPError as e:
succeeded = False
@@ -255,13 +221,13 @@ def test_rootdn_access_day_of_week(topology):
# Set the allow days
#
try:
- topology.standalone.simple_bind_s(USER1_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER1_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_day_of_week: : failed to bind as user1')
assert False
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed',
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed',
allow_days)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_day_of_week: Failed to set the deny days: error
' +
@@ -269,7 +235,7 @@ def test_rootdn_access_day_of_week(topology):
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_day_of_week: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -279,14 +245,14 @@ def test_rootdn_access_day_of_week(topology):
# Cleanup - undo the changes we made so the next test has a clean slate
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-days-allowed', None)])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-days-allowed', None)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_day_of_week: Failed to set rootDN plugin
config: error ' +
e.message['desc'])
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_day_of_week: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -295,7 +261,7 @@ def test_rootdn_access_day_of_week(topology):
log.info('test_rootdn_access_day_of_week: PASSED')
-def test_rootdn_access_denied_ip(topology):
+def test_rootdn_access_denied_ip(topology_st):
'''
Test denied IP feature - we can just test denying 127.0.01
'''
@@ -303,7 +269,7 @@ def test_rootdn_access_denied_ip(topology):
log.info('Running test_rootdn_access_denied_ip...')
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-ip',
'127.0.0.1'),
(ldap.MOD_ADD,
@@ -318,7 +284,7 @@ def test_rootdn_access_denied_ip(topology):
# Bind as Root DN - should fail
#
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
succeeded = True
except ldap.LDAPError as e:
succeeded = False
@@ -331,20 +297,20 @@ def test_rootdn_access_denied_ip(topology):
# Change the denied IP so root DN succeeds
#
try:
- topology.standalone.simple_bind_s(USER1_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER1_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_ip: : failed to bind as user1')
assert False
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-ip', '255.255.255.255')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-ip', '255.255.255.255')])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_ip: Failed to set rootDN plugin config:
error ' +
e.message['desc'])
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_ip: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -354,14 +320,14 @@ def test_rootdn_access_denied_ip(topology):
# Cleanup - undo the changes we made so the next test has a clean slate
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-deny-ip', None)])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-deny-ip', None)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_ip: Failed to set rootDN plugin config:
error ' +
e.message['desc'])
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_ip: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -370,7 +336,7 @@ def test_rootdn_access_denied_ip(topology):
log.info('test_rootdn_access_denied_ip: PASSED')
-def test_rootdn_access_denied_host(topology):
+def test_rootdn_access_denied_host(topology_st):
'''
Test denied Host feature - we can just test denying localhost
'''
@@ -379,10 +345,10 @@ def test_rootdn_access_denied_host(topology):
hostname = socket.gethostname()
localhost = DirSrvTools.getLocalhost()
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-deny-host',
hostname)])
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-deny-host',
localhost)])
except ldap.LDAPError as e:
@@ -394,7 +360,7 @@ def test_rootdn_access_denied_host(topology):
# Bind as Root DN - should fail
#
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
succeeded = True
except ldap.LDAPError as e:
succeeded = False
@@ -407,20 +373,20 @@ def test_rootdn_access_denied_host(topology):
# Change the denied host so root DN succeeds
#
try:
- topology.standalone.simple_bind_s(USER1_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER1_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_host: : failed to bind as user1')
assert False
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-host', 'i.dont.exist.com')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-host', 'i.dont.exist.com')])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_host: Failed to set rootDN plugin
config: error ' +
e.message['desc'])
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_host: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -430,14 +396,14 @@ def test_rootdn_access_denied_host(topology):
# Cleanup - undo the changes we made so the next test has a clean slate
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-deny-host', None)])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-deny-host', None)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_host: Failed to set rootDN plugin
config: error ' +
e.message['desc'])
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_denied_host: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -446,7 +412,7 @@ def test_rootdn_access_denied_host(topology):
log.info('test_rootdn_access_denied_host: PASSED')
-def test_rootdn_access_allowed_ip(topology):
+def test_rootdn_access_allowed_ip(topology_st):
'''
Test allowed ip feature
'''
@@ -457,7 +423,7 @@ def test_rootdn_access_allowed_ip(topology):
# Set allowed host to an unknown host - blocks the Root DN
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-ip', '255.255.255.255')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-ip', '255.255.255.255')])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_ip: Failed to set allowed host: error
' +
e.message['desc'])
@@ -467,7 +433,7 @@ def test_rootdn_access_allowed_ip(topology):
# Bind as Root DN - should fail
#
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
succeeded = True
except ldap.LDAPError as e:
succeeded = False
@@ -480,13 +446,13 @@ def test_rootdn_access_allowed_ip(topology):
# Allow localhost
#
try:
- topology.standalone.simple_bind_s(USER1_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER1_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_ip: : failed to bind as user1')
assert False
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-ip', '127.0.0.1'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-ip', '127.0.0.1'),
(ldap.MOD_ADD, 'rootdn-allow-ip',
'::1')])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_ip: Failed to set allowed host: error
' +
@@ -494,7 +460,7 @@ def test_rootdn_access_allowed_ip(topology):
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_ip: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -504,14 +470,14 @@ def test_rootdn_access_allowed_ip(topology):
# Cleanup - undo everything we did so the next test has a clean slate
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-allow-ip', None)])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-allow-ip', None)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_ip: Failed to delete(rootdn-allow-ip):
error ' +
e.message['desc'])
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_ip: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -520,7 +486,7 @@ def test_rootdn_access_allowed_ip(topology):
log.info('test_rootdn_access_allowed_ip: PASSED')
-def test_rootdn_access_allowed_host(topology):
+def test_rootdn_access_allowed_host(topology_st):
'''
Test allowed ip feature
'''
@@ -531,7 +497,7 @@ def test_rootdn_access_allowed_host(topology):
# Set allowed host to an unknown host - blocks the Root DN
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-host', 'i.dont.exist.com')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-host', 'i.dont.exist.com')])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_host: Failed to set allowed host: error
' +
e.message['desc'])
@@ -541,7 +507,7 @@ def test_rootdn_access_allowed_host(topology):
# Bind as Root DN - should fail
#
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
succeeded = True
except ldap.LDAPError as e:
succeeded = False
@@ -554,7 +520,7 @@ def test_rootdn_access_allowed_host(topology):
# Allow localhost
#
try:
- topology.standalone.simple_bind_s(USER1_DN, PASSWORD)
+ topology_st.standalone.simple_bind_s(USER1_DN, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_host: : failed to bind as user1')
assert False
@@ -562,10 +528,10 @@ def test_rootdn_access_allowed_host(topology):
hostname = socket.gethostname()
localhost = DirSrvTools.getLocalhost()
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-allow-host',
localhost)])
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-allow-host',
hostname)])
except ldap.LDAPError as e:
@@ -574,7 +540,7 @@ def test_rootdn_access_allowed_host(topology):
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_host: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -584,14 +550,14 @@ def test_rootdn_access_allowed_host(topology):
# Cleanup - undo everything we did so the next test has a clean slate
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-allow-host', None)])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_DELETE,
'rootdn-allow-host', None)])
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_host: Failed to
delete(rootdn-allow-host): error ' +
e.message['desc'])
assert False
try:
- topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
except ldap.LDAPError as e:
log.fatal('test_rootdn_access_allowed_host: Root DN bind failed unexpectedly
failed: error ' +
e.message['desc'])
@@ -600,7 +566,7 @@ def test_rootdn_access_allowed_host(topology):
log.info('test_rootdn_access_allowed_host: PASSED')
-def test_rootdn_config_validate(topology):
+def test_rootdn_config_validate(topology_st):
'''
Test configuration validation
@@ -616,14 +582,14 @@ def test_rootdn_config_validate(topology):
# Test rootdn-open-time
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to just add
"rootdn-open-time" ')
assert False
except ldap.LDAPError:
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-open-time', '0000'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-open-time', '0000'),
(ldap.MOD_ADD, 'rootdn-open-time',
'0001')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add multiple
"rootdn-open-time"')
assert False
@@ -631,7 +597,7 @@ def test_rootdn_config_validate(topology):
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '-1'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '-1'),
(ldap.MOD_REPLACE, 'rootdn-close-time',
'0000')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-open-time: -1"')
assert False
@@ -639,7 +605,7 @@ def test_rootdn_config_validate(topology):
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '2400'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '2400'),
(ldap.MOD_REPLACE, 'rootdn-close-time',
'0000')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-open-time: 2400"')
assert False
@@ -647,7 +613,7 @@ def test_rootdn_config_validate(topology):
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', 'aaaaa'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', 'aaaaa'),
(ldap.MOD_REPLACE, 'rootdn-close-time',
'0000')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-open-time: aaaaa"')
assert False
@@ -658,14 +624,14 @@ def test_rootdn_config_validate(topology):
# Test rootdn-close-time
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-close-time', '0000')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-close-time', '0000')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add just
"rootdn-close-time"')
assert False
except ldap.LDAPError:
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-close-time', '0000'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-close-time', '0000'),
(ldap.MOD_ADD, 'rootdn-close-time',
'0001')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add multiple
"rootdn-open-time"')
assert False
@@ -673,7 +639,7 @@ def test_rootdn_config_validate(topology):
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
(ldap.MOD_REPLACE, 'rootdn-close-time',
'-1')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-close-time: -1"')
assert False
@@ -681,7 +647,7 @@ def test_rootdn_config_validate(topology):
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
(ldap.MOD_REPLACE, 'rootdn-close-time',
'2400')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-close-time: 2400"')
assert False
@@ -689,7 +655,7 @@ def test_rootdn_config_validate(topology):
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-open-time', '0000'),
(ldap.MOD_REPLACE, 'rootdn-close-time',
'aaaaa')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-close-time: aaaaa"')
assert False
@@ -700,7 +666,7 @@ def test_rootdn_config_validate(topology):
# Test days allowed
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-days-allowed', 'Mon'),
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_ADD,
'rootdn-days-allowed', 'Mon'),
(ldap.MOD_ADD, 'rootdn-days-allowed',
'Tue')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add two
"rootdn-days-allowed"')
assert False
@@ -708,28 +674,28 @@ def test_rootdn_config_validate(topology):
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'Mon1')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'Mon1')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-days-allowed: Mon1"')
assert False
except ldap.LDAPError:
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'Tue, Mon1')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'Tue, Mon1')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-days-allowed: Tue, Mon1"')
assert False
except ldap.LDAPError:
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'm111m')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'm111m')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-days-allowed: 111"')
assert False
except ldap.LDAPError:
pass
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'Gur')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-days-allowed', 'Gur')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-days-allowed: Gur"')
assert False
except ldap.LDAPError:
@@ -739,7 +705,7 @@ def test_rootdn_config_validate(topology):
# Test allow ips
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-ip', '12.12.Z.12')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-ip', '12.12.Z.12')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-allow-ip: 12.12.Z.12"')
assert False
except ldap.LDAPError:
@@ -749,7 +715,7 @@ def test_rootdn_config_validate(topology):
# Test deny ips
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-ip', '12.12.Z.12')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-ip', '12.12.Z.12')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-deny-ip: 12.12.Z.12"')
assert False
except ldap.LDAPError:
@@ -759,7 +725,7 @@ def test_rootdn_config_validate(topology):
# Test allow hosts
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-host', 'host._.com')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-allow-host', 'host._.com')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-allow-host: host._.com"')
assert False
except ldap.LDAPError:
@@ -769,7 +735,7 @@ def test_rootdn_config_validate(topology):
# Test deny hosts
#
try:
- topology.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-host', 'host.####.com')])
+ topology_st.standalone.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE,
'rootdn-deny-host', 'host.####.com')])
log.fatal('test_rootdn_config_validate: Incorrectly allowed to add invalid
"rootdn-deny-host: host.####.com"')
assert False
except ldap.LDAPError:
diff --git a/dirsrvtests/tests/suites/sasl/sasl_test.py
b/dirsrvtests/tests/suites/sasl/sasl_test.py
deleted file mode 100644
index 589e960..0000000
--- a/dirsrvtests/tests/suites/sasl/sasl_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_sasl_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_sasl_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/schema/test_schema.py
b/dirsrvtests/tests/suites/schema/test_schema.py
index 6d790d8..ed13d91 100644
--- a/dirsrvtests/tests/suites/schema/test_schema.py
+++ b/dirsrvtests/tests/suites/schema/test_schema.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -24,7 +24,7 @@ from lib389 import DirSrv, Entry, tools
from lib389.tools import DirSrvTools
from lib389._constants import *
from lib389.properties import *
-
+from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
@@ -34,40 +34,6 @@ occlass = ldap.schema.models.ObjectClass
syntax_len_supported = False
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- '''
- This fixture is used to create a DirSrv instance for the 'module'.
- '''
- schemainst = DirSrv(verbose=False)
-
- # Args for the master instance
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- schemainst.allocate(args_instance)
-
- # Remove all the instance
- if schemainst.exists():
- schemainst.delete()
-
- # Create the instance
- schemainst.create()
- schemainst.open()
-
- def fin():
- schemainst.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(schemainst)
-
-
def ochasattr(subschema, oc, mustormay, attr, key):
"""See if the oc and any of its parents and ancestors have the
given attr"""
@@ -156,13 +122,13 @@ def atgetdiffs(ldschema, at1, at2):
return ret
-def test_schema_comparewithfiles(topology):
+def test_schema_comparewithfiles(topology_st):
'''Compare the schema from ldap cn=schema with the schema
files'''
log.info('Running test_schema_comparewithfiles...')
retval = True
- schemainst = topology.standalone
+ schemainst = topology_st.standalone
ldschema = schemainst.schema.get_subschema()
assert ldschema
for fn in schemainst.schema.list_files():
diff --git a/dirsrvtests/tests/suites/schema_reload_plugin/schema_reload_test.py
b/dirsrvtests/tests/suites/schema_reload_plugin/schema_reload_test.py
deleted file mode 100644
index 878c7f9..0000000
--- a/dirsrvtests/tests/suites/schema_reload_plugin/schema_reload_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_schema_reload_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_schema_reload_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/snmp/snmp_test.py
b/dirsrvtests/tests/suites/snmp/snmp_test.py
deleted file mode 100644
index a30b626..0000000
--- a/dirsrvtests/tests/suites/snmp/snmp_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_snmp_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_snmp_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/ssl/ssl_test.py
b/dirsrvtests/tests/suites/ssl/ssl_test.py
deleted file mode 100644
index 42738de..0000000
--- a/dirsrvtests/tests/suites/ssl/ssl_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_ssl_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_ssl_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/syntax_plugin/syntax_test.py
b/dirsrvtests/tests/suites/syntax_plugin/syntax_test.py
deleted file mode 100644
index 91d2e55..0000000
--- a/dirsrvtests/tests/suites/syntax_plugin/syntax_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_syntax_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_syntax_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/usn_plugin/usn_test.py
b/dirsrvtests/tests/suites/usn_plugin/usn_test.py
deleted file mode 100644
index 2e81672..0000000
--- a/dirsrvtests/tests/suites/usn_plugin/usn_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_usn_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_usn_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/views_plugin/views_test.py
b/dirsrvtests/tests/suites/views_plugin/views_test.py
deleted file mode 100644
index 3168a0f..0000000
--- a/dirsrvtests/tests/suites/views_plugin/views_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_views_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_views_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/vlv/vlv_test.py
b/dirsrvtests/tests/suites/vlv/vlv_test.py
deleted file mode 100644
index 57945d7..0000000
--- a/dirsrvtests/tests/suites/vlv/vlv_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_vlv_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_vlv_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/suites/whoami_plugin/whoami_test.py
b/dirsrvtests/tests/suites/whoami_plugin/whoami_test.py
deleted file mode 100644
index e528cc8..0000000
--- a/dirsrvtests/tests/suites/whoami_plugin/whoami_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import os
-import sys
-import time
-import ldap
-import logging
-import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
-from lib389._constants import *
-from lib389.properties import *
-from lib389.tasks import *
-from lib389.utils import *
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-installation1_prefix = None
-
-
-class TopologyStandalone(object):
- def __init__(self, standalone):
- standalone.open()
- self.standalone = standalone
-
-
-(a)pytest.fixture(scope="module")
-def topology(request):
- global installation1_prefix
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
-
- # Creating standalone instance ...
- standalone = DirSrv(verbose=False)
- args_instance[SER_HOST] = HOST_STANDALONE
- args_instance[SER_PORT] = PORT_STANDALONE
- args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
- args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
- args_standalone = args_instance.copy()
- standalone.allocate(args_standalone)
- instance_standalone = standalone.exists()
- if instance_standalone:
- standalone.delete()
- standalone.create()
- standalone.open()
-
- def fin():
- standalone.delete()
- request.addfinalizer(fin)
-
- return TopologyStandalone(standalone)
-
-
-def test_whoami_init(topology):
- '''
- Write any test suite initialization here(if needed)
- '''
-
- return
-
-
-def test_whoami_(topology):
- '''
- Write a single test here...
- '''
-
- return
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
diff --git a/dirsrvtests/tests/tickets/finalizer.py
b/dirsrvtests/tests/tickets/finalizer.py
index f93ea5c..690c76e 100644
--- a/dirsrvtests/tests/tickets/finalizer.py
+++ b/dirsrvtests/tests/tickets/finalizer.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47313_test.py
b/dirsrvtests/tests/tickets/ticket47313_test.py
index 703ea42..5064126 100644
--- a/dirsrvtests/tests/tickets/ticket47313_test.py
+++ b/dirsrvtests/tests/tickets/ticket47313_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47384_test.py
b/dirsrvtests/tests/tickets/ticket47384_test.py
index 17dfbaf..3229751 100644
--- a/dirsrvtests/tests/tickets/ticket47384_test.py
+++ b/dirsrvtests/tests/tickets/ticket47384_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47431_test.py
b/dirsrvtests/tests/tickets/ticket47431_test.py
index 27a52b9..3453776 100644
--- a/dirsrvtests/tests/tickets/ticket47431_test.py
+++ b/dirsrvtests/tests/tickets/ticket47431_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47462_test.py
b/dirsrvtests/tests/tickets/ticket47462_test.py
index 50b867e..66a2385 100644
--- a/dirsrvtests/tests/tickets/ticket47462_test.py
+++ b/dirsrvtests/tests/tickets/ticket47462_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47490_test.py
b/dirsrvtests/tests/tickets/ticket47490_test.py
index a4c2491..0da542e 100644
--- a/dirsrvtests/tests/tickets/ticket47490_test.py
+++ b/dirsrvtests/tests/tickets/ticket47490_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47553_test.py
b/dirsrvtests/tests/tickets/ticket47553_test.py
index 84d462d..01cd08c 100644
--- a/dirsrvtests/tests/tickets/ticket47553_test.py
+++ b/dirsrvtests/tests/tickets/ticket47553_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47560_test.py
b/dirsrvtests/tests/tickets/ticket47560_test.py
index c8424d6..f52926f 100644
--- a/dirsrvtests/tests/tickets/ticket47560_test.py
+++ b/dirsrvtests/tests/tickets/ticket47560_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47573_test.py
b/dirsrvtests/tests/tickets/ticket47573_test.py
index ee47f46..e7e9641 100644
--- a/dirsrvtests/tests/tickets/ticket47573_test.py
+++ b/dirsrvtests/tests/tickets/ticket47573_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47619_test.py
b/dirsrvtests/tests/tickets/ticket47619_test.py
index 05c1b84..988ea04 100644
--- a/dirsrvtests/tests/tickets/ticket47619_test.py
+++ b/dirsrvtests/tests/tickets/ticket47619_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47640_test.py
b/dirsrvtests/tests/tickets/ticket47640_test.py
index 526ac22..09ed691 100644
--- a/dirsrvtests/tests/tickets/ticket47640_test.py
+++ b/dirsrvtests/tests/tickets/ticket47640_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47653MMR_test.py
b/dirsrvtests/tests/tickets/ticket47653MMR_test.py
index 107edac..5cd7118 100644
--- a/dirsrvtests/tests/tickets/ticket47653MMR_test.py
+++ b/dirsrvtests/tests/tickets/ticket47653MMR_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47653_test.py
b/dirsrvtests/tests/tickets/ticket47653_test.py
index 8f42ade..0eda94b 100644
--- a/dirsrvtests/tests/tickets/ticket47653_test.py
+++ b/dirsrvtests/tests/tickets/ticket47653_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47669_test.py
b/dirsrvtests/tests/tickets/ticket47669_test.py
index 021ec15..e26fa05 100644
--- a/dirsrvtests/tests/tickets/ticket47669_test.py
+++ b/dirsrvtests/tests/tickets/ticket47669_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47676_test.py
b/dirsrvtests/tests/tickets/ticket47676_test.py
index cdf4096..3ba29c5 100644
--- a/dirsrvtests/tests/tickets/ticket47676_test.py
+++ b/dirsrvtests/tests/tickets/ticket47676_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47714_test.py
b/dirsrvtests/tests/tickets/ticket47714_test.py
index 83c5bef..08ca98a 100644
--- a/dirsrvtests/tests/tickets/ticket47714_test.py
+++ b/dirsrvtests/tests/tickets/ticket47714_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47721_test.py
b/dirsrvtests/tests/tickets/ticket47721_test.py
index 033fe70..b1606bb 100644
--- a/dirsrvtests/tests/tickets/ticket47721_test.py
+++ b/dirsrvtests/tests/tickets/ticket47721_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47781_test.py
b/dirsrvtests/tests/tickets/ticket47781_test.py
index fe65c89..40de5bb 100644
--- a/dirsrvtests/tests/tickets/ticket47781_test.py
+++ b/dirsrvtests/tests/tickets/ticket47781_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47787_test.py
b/dirsrvtests/tests/tickets/ticket47787_test.py
index 443e223..53e5b00 100644
--- a/dirsrvtests/tests/tickets/ticket47787_test.py
+++ b/dirsrvtests/tests/tickets/ticket47787_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47808_test.py
b/dirsrvtests/tests/tickets/ticket47808_test.py
index 862333a..a92059e 100644
--- a/dirsrvtests/tests/tickets/ticket47808_test.py
+++ b/dirsrvtests/tests/tickets/ticket47808_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47815_test.py
b/dirsrvtests/tests/tickets/ticket47815_test.py
index 04201f1..b00f5e8 100644
--- a/dirsrvtests/tests/tickets/ticket47815_test.py
+++ b/dirsrvtests/tests/tickets/ticket47815_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47819_test.py
b/dirsrvtests/tests/tickets/ticket47819_test.py
index 95c2ba5..2b751c8 100644
--- a/dirsrvtests/tests/tickets/ticket47819_test.py
+++ b/dirsrvtests/tests/tickets/ticket47819_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47823_test.py
b/dirsrvtests/tests/tickets/ticket47823_test.py
index 36bd19a..71b7356 100644
--- a/dirsrvtests/tests/tickets/ticket47823_test.py
+++ b/dirsrvtests/tests/tickets/ticket47823_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47828_test.py
b/dirsrvtests/tests/tickets/ticket47828_test.py
index 4f48440..e3b8306 100644
--- a/dirsrvtests/tests/tickets/ticket47828_test.py
+++ b/dirsrvtests/tests/tickets/ticket47828_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47829_test.py
b/dirsrvtests/tests/tickets/ticket47829_test.py
index 94a3a2e..0e95adc 100644
--- a/dirsrvtests/tests/tickets/ticket47829_test.py
+++ b/dirsrvtests/tests/tickets/ticket47829_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47833_test.py
b/dirsrvtests/tests/tickets/ticket47833_test.py
index 7140f01..419f6eb 100644
--- a/dirsrvtests/tests/tickets/ticket47833_test.py
+++ b/dirsrvtests/tests/tickets/ticket47833_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47838_test.py
b/dirsrvtests/tests/tickets/ticket47838_test.py
index 6a3adb7..9023878 100644
--- a/dirsrvtests/tests/tickets/ticket47838_test.py
+++ b/dirsrvtests/tests/tickets/ticket47838_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47869MMR_test.py
b/dirsrvtests/tests/tickets/ticket47869MMR_test.py
index 95627d2..a52db5e 100644
--- a/dirsrvtests/tests/tickets/ticket47869MMR_test.py
+++ b/dirsrvtests/tests/tickets/ticket47869MMR_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47871_test.py
b/dirsrvtests/tests/tickets/ticket47871_test.py
index 6d19e8e..417a87e 100644
--- a/dirsrvtests/tests/tickets/ticket47871_test.py
+++ b/dirsrvtests/tests/tickets/ticket47871_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47900_test.py
b/dirsrvtests/tests/tickets/ticket47900_test.py
index 404c91e..1265eea 100644
--- a/dirsrvtests/tests/tickets/ticket47900_test.py
+++ b/dirsrvtests/tests/tickets/ticket47900_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47910_test.py
b/dirsrvtests/tests/tickets/ticket47910_test.py
index 0455722..b2986ea 100644
--- a/dirsrvtests/tests/tickets/ticket47910_test.py
+++ b/dirsrvtests/tests/tickets/ticket47910_test.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47920_test.py
b/dirsrvtests/tests/tickets/ticket47920_test.py
index 078cae1..301d6a6 100644
--- a/dirsrvtests/tests/tickets/ticket47920_test.py
+++ b/dirsrvtests/tests/tickets/ticket47920_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47921_test.py
b/dirsrvtests/tests/tickets/ticket47921_test.py
index 537a59b..e46e996 100644
--- a/dirsrvtests/tests/tickets/ticket47921_test.py
+++ b/dirsrvtests/tests/tickets/ticket47921_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47927_test.py
b/dirsrvtests/tests/tickets/ticket47927_test.py
index c425ace..7e19ae0 100644
--- a/dirsrvtests/tests/tickets/ticket47927_test.py
+++ b/dirsrvtests/tests/tickets/ticket47927_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47937_test.py
b/dirsrvtests/tests/tickets/ticket47937_test.py
index 5a0f354..71a6ef1 100644
--- a/dirsrvtests/tests/tickets/ticket47937_test.py
+++ b/dirsrvtests/tests/tickets/ticket47937_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47950_test.py
b/dirsrvtests/tests/tickets/ticket47950_test.py
index 7dc8c60..fc3975b 100644
--- a/dirsrvtests/tests/tickets/ticket47950_test.py
+++ b/dirsrvtests/tests/tickets/ticket47950_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47953_test.py
b/dirsrvtests/tests/tickets/ticket47953_test.py
index bebd76e..69c57e2 100644
--- a/dirsrvtests/tests/tickets/ticket47953_test.py
+++ b/dirsrvtests/tests/tickets/ticket47953_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47963_test.py
b/dirsrvtests/tests/tickets/ticket47963_test.py
index 6ca74fd..0200198 100644
--- a/dirsrvtests/tests/tickets/ticket47963_test.py
+++ b/dirsrvtests/tests/tickets/ticket47963_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47966_test.py
b/dirsrvtests/tests/tickets/ticket47966_test.py
index 75550a6..4748c12 100644
--- a/dirsrvtests/tests/tickets/ticket47966_test.py
+++ b/dirsrvtests/tests/tickets/ticket47966_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47970_test.py
b/dirsrvtests/tests/tickets/ticket47970_test.py
index 6d224ba..5eb426d 100644
--- a/dirsrvtests/tests/tickets/ticket47970_test.py
+++ b/dirsrvtests/tests/tickets/ticket47970_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47973_test.py
b/dirsrvtests/tests/tickets/ticket47973_test.py
index c7048c0..9116246 100644
--- a/dirsrvtests/tests/tickets/ticket47973_test.py
+++ b/dirsrvtests/tests/tickets/ticket47973_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47980_test.py
b/dirsrvtests/tests/tickets/ticket47980_test.py
index a4a49b7..eefc103 100644
--- a/dirsrvtests/tests/tickets/ticket47980_test.py
+++ b/dirsrvtests/tests/tickets/ticket47980_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47981_test.py
b/dirsrvtests/tests/tickets/ticket47981_test.py
index 3920cfd..07761fc 100644
--- a/dirsrvtests/tests/tickets/ticket47981_test.py
+++ b/dirsrvtests/tests/tickets/ticket47981_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket47988_test.py
b/dirsrvtests/tests/tickets/ticket47988_test.py
index c9835c3..0e975e4 100644
--- a/dirsrvtests/tests/tickets/ticket47988_test.py
+++ b/dirsrvtests/tests/tickets/ticket47988_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48005_test.py
b/dirsrvtests/tests/tickets/ticket48005_test.py
index 39d9334..7463a84 100644
--- a/dirsrvtests/tests/tickets/ticket48005_test.py
+++ b/dirsrvtests/tests/tickets/ticket48005_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48026_test.py
b/dirsrvtests/tests/tickets/ticket48026_test.py
index 730e94b..7eae5c8 100644
--- a/dirsrvtests/tests/tickets/ticket48026_test.py
+++ b/dirsrvtests/tests/tickets/ticket48026_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48109_test.py
b/dirsrvtests/tests/tickets/ticket48109_test.py
index 1d7a334..85faefe 100644
--- a/dirsrvtests/tests/tickets/ticket48109_test.py
+++ b/dirsrvtests/tests/tickets/ticket48109_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48170_test.py
b/dirsrvtests/tests/tickets/ticket48170_test.py
index 3ffa964..7cbea4a 100644
--- a/dirsrvtests/tests/tickets/ticket48170_test.py
+++ b/dirsrvtests/tests/tickets/ticket48170_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48226_test.py
b/dirsrvtests/tests/tickets/ticket48226_test.py
index 90f4a21..9812d74 100644
--- a/dirsrvtests/tests/tickets/ticket48226_test.py
+++ b/dirsrvtests/tests/tickets/ticket48226_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48228_test.py
b/dirsrvtests/tests/tickets/ticket48228_test.py
index 851d776..8559bcd 100644
--- a/dirsrvtests/tests/tickets/ticket48228_test.py
+++ b/dirsrvtests/tests/tickets/ticket48228_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48252_test.py
b/dirsrvtests/tests/tickets/ticket48252_test.py
index e4e0cbb..37f2635 100644
--- a/dirsrvtests/tests/tickets/ticket48252_test.py
+++ b/dirsrvtests/tests/tickets/ticket48252_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48265_test.py
b/dirsrvtests/tests/tickets/ticket48265_test.py
index d255f33..8195ea9 100644
--- a/dirsrvtests/tests/tickets/ticket48265_test.py
+++ b/dirsrvtests/tests/tickets/ticket48265_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48294_test.py
b/dirsrvtests/tests/tickets/ticket48294_test.py
index 567d5b8..265533f 100644
--- a/dirsrvtests/tests/tickets/ticket48294_test.py
+++ b/dirsrvtests/tests/tickets/ticket48294_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48295_test.py
b/dirsrvtests/tests/tickets/ticket48295_test.py
index 96ebaf2..42e2d38 100644
--- a/dirsrvtests/tests/tickets/ticket48295_test.py
+++ b/dirsrvtests/tests/tickets/ticket48295_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48366_test.py
b/dirsrvtests/tests/tickets/ticket48366_test.py
index 578d5e9..46ee8ba 100644
--- a/dirsrvtests/tests/tickets/ticket48366_test.py
+++ b/dirsrvtests/tests/tickets/ticket48366_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48759_test.py
b/dirsrvtests/tests/tickets/ticket48759_test.py
index 3d8b026..d007728 100644
--- a/dirsrvtests/tests/tickets/ticket48759_test.py
+++ b/dirsrvtests/tests/tickets/ticket48759_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48891_test.py
b/dirsrvtests/tests/tickets/ticket48891_test.py
index dadd9d5..5c6e57d 100644
--- a/dirsrvtests/tests/tickets/ticket48891_test.py
+++ b/dirsrvtests/tests/tickets/ticket48891_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket48906_test.py
b/dirsrvtests/tests/tickets/ticket48906_test.py
index b462395..393743b 100644
--- a/dirsrvtests/tests/tickets/ticket48906_test.py
+++ b/dirsrvtests/tests/tickets/ticket48906_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
diff --git a/dirsrvtests/tests/tickets/ticket548_test.py
b/dirsrvtests/tests/tickets/ticket548_test.py
index 5171dbb..257213a 100644
--- a/dirsrvtests/tests/tickets/ticket548_test.py
+++ b/dirsrvtests/tests/tickets/ticket548_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).