dirsrvtests/tests ldap/servers
by thierry bordaz
dirsrvtests/tests/tickets/ticket48270_test.py | 2 +-
dirsrvtests/tests/tickets/ticket48362_test.py | 24 +++++-------------------
ldap/servers/slapd/plugin_mr.c | 11 +++++++++++
3 files changed, 17 insertions(+), 20 deletions(-)
New commits:
commit d975431db14711f69d026c40e69c171aa585fc45
Author: Thierry Bordaz <tbordaz(a)redhat.com>
Date: Fri May 20 11:49:29 2016 +0200
Ticket 48745 Matching Rule caseExactIA5Match indexes incorrectly values with upper cases
Bug Description:
For new style MR plugin (majority of them) they do not have indexer_create function
Instead they are assigned (SLAPI_PLUGIN_MR_INDEXER_CREATE_FN) default_mr_indexer_create.
In slapi_mr_indexer_create, for compatibility reason, we first look for old style MR plugin,
that define their indexer_create function. But when a new style MR plugin have been previously
assigned default_mr_indexer_create, this function is called to create the indexer.
It is called with the MR plugin (that will be use to index) and the MR plugin OID, at this
point the function does not check if the MR plugin can handle the MR plugin OID.
Fix Description:
Let default_mr_indexer_create check that the MR plugin is able to handle the OID
(Plus fix for CI tests 48362/48270)
https://fedorahosted.org/389/ticket/48745
Reviewed by: William Brown (thanks William)
Platforms tested: F23
Flag Day: no
Doc impact: no
diff --git a/dirsrvtests/tests/tickets/ticket48270_test.py b/dirsrvtests/tests/tickets/ticket48270_test.py
index 6523379..fb795d5 100644
--- a/dirsrvtests/tests/tickets/ticket48270_test.py
+++ b/dirsrvtests/tests/tickets/ticket48270_test.py
@@ -34,7 +34,7 @@ class TopologyStandalone(object):
self.standalone = standalone
-#(a)pytest.fixture(scope="module")
+(a)pytest.fixture(scope="module")
def topology(request):
global installation1_prefix
if installation1_prefix:
diff --git a/dirsrvtests/tests/tickets/ticket48362_test.py b/dirsrvtests/tests/tickets/ticket48362_test.py
index 1b5651f..0f56c01 100644
--- a/dirsrvtests/tests/tickets/ticket48362_test.py
+++ b/dirsrvtests/tests/tickets/ticket48362_test.py
@@ -14,9 +14,6 @@ from lib389.utils import *
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-installation1_prefix = None
-
-
PEOPLE_OU='people'
PEOPLE_DN = "ou=%s,%s" % (PEOPLE_OU, SUFFIX)
MAX_ACCOUNTS=5
@@ -34,16 +31,11 @@ class TopologyReplication(object):
self.master2 = master2
-#(a)pytest.fixture(scope="module")
+(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)
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
args_instance[SER_HOST] = HOST_MASTER_1
args_instance[SER_PORT] = PORT_MASTER_1
args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
@@ -59,8 +51,6 @@ def topology(request):
# Creating master 2...
master2 = DirSrv(verbose=False)
- if installation1_prefix:
- args_instance[SER_DEPLOYED_DIR] = installation1_prefix
args_instance[SER_HOST] = HOST_MASTER_2
args_instance[SER_PORT] = PORT_MASTER_2
args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
@@ -244,7 +234,7 @@ def test_ticket48362(topology):
assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
- ent = topology.master1.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
+ ent = topology.master2.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
log.info('\n======================== BEFORE RESTART ============================\n')
assert(ent.hasAttr(BINDMETHOD_ATTR) and ent.getValue(BINDMETHOD_ATTR) == BINDMETHOD_VALUE)
assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
@@ -260,7 +250,7 @@ def test_ticket48362(topology):
assert(ent.hasAttr(BINDMETHOD_ATTR) and ent.getValue(BINDMETHOD_ATTR) == BINDMETHOD_VALUE)
assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
- ent = topology.master1.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
+ ent = topology.master2.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
log.info('\n=================== AFTER RESTART =================================\n')
assert(ent.hasAttr(BINDMETHOD_ATTR) and ent.getValue(BINDMETHOD_ATTR) == BINDMETHOD_VALUE)
assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
@@ -270,9 +260,5 @@ def test_ticket48362(topology):
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
- global installation1_prefix
- installation1_prefix='/home/tbordaz/install_1.3.4'
- topo = topology(True)
- test_ticket48362(topo)
-# CURRENT_FILE = os.path.realpath(__file__)
-# pytest.main("-s %s" % CURRENT_FILE)
\ No newline at end of file
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index e0c1a14..22c3f73 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -655,8 +655,19 @@ default_mr_indexer_create(Slapi_PBlock* pb)
{
int rc = -1;
struct slapdplugin *pi = NULL;
+ char* oid = NULL;
slapi_pblock_get(pb, SLAPI_PLUGIN, &pi);
+ slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &oid);
+ /* this default_mr_indexer_create can be common indexer create to several
+ * MR plugin. We need to check the selected plugin handle the expected OID
+ */
+ if ( oid == NULL || !charray_inlist(pi->plg_mr_names, oid)) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "default_mr_indexer_create: warning - plugin [%s] does not handle %s\n",
+ pi->plg_name,
+ oid ? oid : "unknown oid");
+ goto done;
+ }
if (NULL == pi) {
LDAPDebug0Args(LDAP_DEBUG_ANY, "default_mr_indexer_create: error - no plugin specified\n");
goto done;
7 years, 6 months
dirsrvtests/tests ldap/servers
by thierry bordaz
dirsrvtests/tests/tickets/ticket48844_test.py | 175 ++++++++++++++++++++++++++
ldap/servers/slapd/plugin_mr.c | 67 +++++----
2 files changed, 215 insertions(+), 27 deletions(-)
New commits:
commit 7ebc1707275bfd6dbf1e04585d9152ae6a031649
Author: Thierry Bordaz <tbordaz(a)redhat.com>
Date: Thu May 19 15:45:26 2016 +0200
Ticket 48844 Regression introduced in matching rules by DS 48746
Bug Description:
Old style MR plugin (like bitwise, collation) register their own indexer function.
new style MR plugin just use the default_mr_indexer_create.
When looking for a MR plugin that can handle a given OID we must look to old style and
new style MR plugin.
In the fix https://fedorahosted.org/389/ticket/48746, the code looking up into old style
MR plugin has been erronously removed.
Fix Description:
Make sure that plugin_mr_filter_create looks up in old and new style MR
https://fedorahosted.org/389/ticket/48745
Reviewed by: William Brown (thanks William!)
Platforms tested: F23
Flag Day: no
Doc impact: no
diff --git a/dirsrvtests/tests/tickets/ticket48844_test.py b/dirsrvtests/tests/tickets/ticket48844_test.py
new file mode 100644
index 0000000..5b720e3
--- /dev/null
+++ b/dirsrvtests/tests/tickets/ticket48844_test.py
@@ -0,0 +1,175 @@
+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
+
+PLUGIN_BITWISE = 'Bitwise Plugin'
+TESTBASEDN="dc=bitwise,dc=com"
+TESTBACKEND_NAME="TestBitw"
+
+F1 = 'objectclass=testperson'
+BITWISE_F2 = '(&(%s)(testUserAccountControl:1.2.840.113556.1.4.803:=514))' % F1
+BITWISE_F3 = '(&(%s)(testUserAccountControl:1.2.840.113556.1.4.803:=513))' % F1
+BITWISE_F6 = '(&(%s)(testUserAccountControl:1.2.840.113556.1.4.803:=16777216))' % F1
+
+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)
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+ 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 _addBitwiseEntries(topology):
+
+ users = [
+ ('testuser2', '65536' ,'PasswordNeverExpired' ),
+ ('testuser3', '8388608' ,'PasswordExpired'),
+ ('testuser4', '256' ,'TempDuplicateAccount'),
+ ('testuser5', '16777216' ,'TrustedAuthDelegation'),
+ ('testuser6', '528' ,'AccountLocked'),
+ ('testuser7', '513' ,'AccountActive'),
+ ('testuser8', '98536 99512 99528'.split() ,'AccountActive PasswordExxpired AccountLocked'.split()),
+ ('testuser9', '87536 912'.split() ,'AccountActive PasswordNeverExpired'.split()),
+ ('testuser10', '89536 97546 96579'.split() ,'TestVerify1 TestVerify2 TestVerify3'.split() ),
+ ('testuser11', '655236' ,'TestStatus1'),
+ ('testuser12', '665522' ,'TestStatus2'),
+ ('testuser13', '266552' ,'TestStatus3')]
+ try:
+ topology.standalone.add_s(Entry((TESTBASEDN,
+ {'objectclass': "top dcobject".split(),
+ 'dc': 'bitwise',
+ 'aci': '(target =\"ldap:///dc=bitwise,dc=com\")' +\
+ '(targetattr != \"userPassword\")' +\
+ '(version 3.0;acl \"Anonymous read-search access\";' +\
+ 'allow (read, search, compare)(userdn = \"ldap:///anyone\");)'})))
+
+ topology.standalone.add_s(Entry(('uid=btestuser1,%s' % TESTBASEDN,
+ {'objectclass': 'top testperson organizationalPerson inetorgperson'.split(),
+ 'mail': 'btestuser1(a)redhat.com',
+ 'uid': 'btestuser1',
+ 'givenName': 'bit',
+ 'sn': 'testuser1',
+ 'userPassword': 'testuser1',
+ 'testUserAccountControl': '514',
+ 'testUserStatus': 'Disabled',
+ 'cn': 'bit tetsuser1'})))
+ for (userid, accCtl,accStatus) in users:
+ topology.standalone.add_s(Entry(('uid=b%s,%s' % (userid, TESTBASEDN),
+ {'objectclass': 'top testperson organizationalPerson inetorgperson'.split(),
+ 'mail': '%s(a)redhat.com' % userid,
+ 'uid': 'b%s' % userid,
+ 'givenName': 'bit',
+ 'sn': userid,
+ 'userPassword': userid,
+ 'testUserAccountControl': accCtl,
+ 'testUserStatus': accStatus,
+ 'cn': 'bit %s' % userid})))
+ except ValueError:
+ topology.standalone.log.fatal("add_s failed: %s", ValueError)
+
+def test_ticket48844_init(topology):
+ # create a suffix where test entries will be stored
+ BITW_SCHEMA_AT_1 = '( NAME \'testUserAccountControl\' DESC \'Attribute Bitwise filteri-Multi-Valued\' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )'
+ BITW_SCHEMA_AT_2 = '( NAME \'testUserStatus\' DESC \'State of User account active/disabled\' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )'
+ BITW_SCHEMA_OC_1 = '( NAME \'testperson\' SUP top STRUCTURAL MUST ( sn $ cn $ testUserAccountControl $ testUserStatus )' +\
+ ' MAY ( userPassword $ telephoneNumber $ seeAlso $ description ) X-ORIGIN \'BitWise\' )'
+ topology.standalone.schema.add_schema('attributetypes', [BITW_SCHEMA_AT_1, BITW_SCHEMA_AT_2])
+ topology.standalone.schema.add_schema('objectClasses', BITW_SCHEMA_OC_1)
+
+ topology.standalone.backend.create(TESTBASEDN, {BACKEND_NAME: TESTBACKEND_NAME})
+ topology.standalone.mappingtree.create(TESTBASEDN, bename=TESTBACKEND_NAME, parent=None)
+ _addBitwiseEntries(topology)
+
+
+def test_ticket48844_bitwise_on(topology):
+ """
+ Check that bitwise plugin (old style MR plugin) that defines
+ Its own indexer create function, is selected to evaluate the filter
+ """
+
+ topology.standalone.plugins.enable(name=PLUGIN_BITWISE)
+ topology.standalone.restart(timeout=10)
+ ents = topology.standalone.search_s('cn=%s,cn=plugins,cn=config' % PLUGIN_BITWISE, ldap.SCOPE_BASE, 'objectclass=*')
+ assert(ents[0].hasValue('nsslapd-pluginEnabled', 'on'))
+
+ expect = 2
+ ents = topology.standalone.search_s(TESTBASEDN, ldap.SCOPE_SUBTREE, BITWISE_F2)
+ assert (len(ents) == expect)
+
+ expect=1
+ ents = topology.standalone.search_s(TESTBASEDN, ldap.SCOPE_SUBTREE, BITWISE_F3)
+ assert (len(ents) == expect)
+ assert (ents[0].hasAttr('testUserAccountControl'))
+
+ expect=1
+ ents = topology.standalone.search_s(TESTBASEDN, ldap.SCOPE_SUBTREE, BITWISE_F6)
+ assert (len(ents) == expect)
+ assert (ents[0].hasAttr('testUserAccountControl'))
+
+def test_ticket48844_bitwise_off(topology):
+ """
+ Check that when bitwise plugin is not enabled, no plugin
+ is identified to evaluate the filter -> ldap.UNAVAILABLE_CRITICAL_EXTENSION:
+ """
+ topology.standalone.plugins.disable(name=PLUGIN_BITWISE)
+ topology.standalone.restart(timeout=10)
+ ents = topology.standalone.search_s('cn=%s,cn=plugins,cn=config' % PLUGIN_BITWISE, ldap.SCOPE_BASE, 'objectclass=*')
+ assert(ents[0].hasValue('nsslapd-pluginEnabled', 'off'))
+
+ res = 0
+ try:
+ ents = topology.standalone.search_s(TESTBASEDN, ldap.SCOPE_SUBTREE, BITWISE_F2)
+ except ldap.UNAVAILABLE_CRITICAL_EXTENSION:
+ res = 12
+ assert (res == 12)
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index 0ff4b78..e0c1a14 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -165,43 +165,44 @@ slapi_mr_indexer_create (Slapi_PBlock* opb)
}
else
{
- /* look for a new syntax-style mr plugin */
- struct slapdplugin* pi = plugin_mr_find(oid);
- rc = LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
-
- /* register that plugin at the condition it has a createFn/index/indexSvFn */
- if (pi) {
+ /* call each plugin, until one is able to handle this request. */
+ rc = LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
+ for (mrp = get_plugin_list(PLUGIN_LIST_MATCHINGRULE); mrp != NULL; mrp = mrp->plg_next)
+ {
IFP indexFn = NULL;
IFP indexSvFn = NULL;
Slapi_PBlock pb;
- memcpy(&pb, opb, sizeof (Slapi_PBlock));
- slapi_pblock_set(&pb, SLAPI_PLUGIN, pi);
- slapi_pblock_get(&pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN, &createFn);
+ memcpy (&pb, opb, sizeof(Slapi_PBlock));
+ slapi_pblock_set(&pb, SLAPI_PLUGIN, mrp);
+ if (slapi_pblock_get(&pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN, &createFn)) {
+ /* plugin not a matchingrule type */
+ continue;
+ }
if (createFn && !createFn(&pb)) {
- /* we need to call the createFn before testing the indexFn/indexSvFn
- * because it sets the index callbacks
- */
slapi_pblock_get(&pb, SLAPI_PLUGIN_MR_INDEX_FN, &indexFn);
slapi_pblock_get(&pb, SLAPI_PLUGIN_MR_INDEX_SV_FN, &indexSvFn);
if (indexFn || indexSvFn) {
- /* Use the defined indexer_create function if it exists */
+ /* Success: this plugin can handle it. */
memcpy(opb, &pb, sizeof (Slapi_PBlock));
- plugin_mr_bind(oid, pi); /* for future reference */
+ plugin_mr_bind(oid, mrp); /* for future reference */
rc = 0; /* success */
+ break;
}
+
}
- }
- if (pi && (rc != 0)) {
- /* No defined indexer_create or it fails
- * Let's use the default one
- */
- Slapi_PBlock pb;
- memcpy(&pb, opb, sizeof (Slapi_PBlock));
- slapi_pblock_set(&pb, SLAPI_PLUGIN, pi);
- rc = default_mr_indexer_create(&pb);
- if (!rc) {
- memcpy(opb, &pb, sizeof (Slapi_PBlock));
- plugin_mr_bind(oid, pi); /* for future reference */
+ }
+ if (rc != 0) {
+ /* look for a new syntax-style mr plugin */
+ struct slapdplugin *pi = plugin_mr_find(oid);
+ if (pi) {
+ Slapi_PBlock pb;
+ memcpy (&pb, opb, sizeof(Slapi_PBlock));
+ slapi_pblock_set(&pb, SLAPI_PLUGIN, pi);
+ rc = default_mr_indexer_create(&pb);
+ if (!rc) {
+ memcpy (opb, &pb, sizeof(Slapi_PBlock));
+ plugin_mr_bind (oid, pi); /* for future reference */
+ }
}
}
}
@@ -579,7 +580,19 @@ plugin_mr_filter_create (mr_filter_t* f)
{
rc = attempt_mr_filter_create (f, mrp, &pb);
}
- if (!mrp || rc)
+ else
+ {
+ /* call each plugin, until one is able to handle this request. */
+ for (mrp = get_plugin_list(PLUGIN_LIST_MATCHINGRULE); mrp != NULL; mrp = mrp->plg_next)
+ {
+ if (!(rc = attempt_mr_filter_create (f, mrp, &pb)))
+ {
+ plugin_mr_bind (f->mrf_oid, mrp); /* for future reference */
+ break;
+ }
+ }
+ }
+ if (rc)
{
/* look for a new syntax-style mr plugin */
mrp = plugin_mr_find(f->mrf_oid);
7 years, 6 months
dirsrvtests/tests
by Simon Pichugin
dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py | 209 ++++++++++
dirsrvtests/tests/tickets/ticket48363_test.py | 206 ---------
2 files changed, 209 insertions(+), 206 deletions(-)
New commits:
commit 03c1e860a58c07b6c24767178aa3048ea7771c30
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Fri May 20 10:54:51 2016 +0200
Ticket 48363 - CI test - add test suite
Description: Refactor and improve test suite for the requesting
all attributes with '+' feature.
Please see: https://tools.ietf.org/html/rfc3673
https://fedorahosted.org/389/ticket/48363
Review by: wibrown (Thanks!)
diff --git a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
new file mode 100644
index 0000000..efea5a5
--- /dev/null
+++ b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
@@ -0,0 +1,209 @@
+# --- 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
+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__)
+
+DN_PEOPLE = 'ou=people,%s' % DEFAULT_SUFFIX
+DN_ROOT = ''
+TEST_USER_NAME = 'all_attrs_test'
+TEST_USER_DN = 'uid=%s,%s' % (TEST_USER_NAME, DN_PEOPLE)
+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'
+ ]),
+ (DN_ROOT, True, [
+ '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, [
+ 'aci', '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)
+
+
+(a)pytest.fixture(scope="module")
+def test_user(topology):
+ """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
+ })))
+ except ldap.LDAPError as e:
+ log.error('Failed to add user (%s): error (%s)' % (TEST_USER_DN,
+ e.message['desc']))
+ raise e
+
+
+(a)pytest.fixture(scope="module")
+def user_aci(topology):
+ """Deny modifiersName attribute for the test user
+ under whole suffix
+ """
+
+ ACI_TARGET = '(targetattr= "modifiersName")'
+ 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)])
+
+
+def test_supported_features(topology):
+ """Verify that OID 1.3.6.1.4.1.4203.1.5.1 is published
+ in the supportedFeatures [RFC3674] attribute in the rootDSE.
+
+ :Feature: Filter
+
+ :Setup: Standalone instance
+
+ :Steps: 1. Search for 'supportedFeatures' at rootDSE
+
+ :Assert: Value 1.3.6.1.4.1.4203.1.5.1 is presented
+ """
+
+ entries = topology.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']
+
+
+(a)pytest.mark.parametrize('add_attr', ['', '*', 'objectClass'])
+(a)pytest.mark.parametrize('search_suffix,regular_user,oper_attr_list',
+ TEST_PARAMS)
+def test_search_basic(topology, 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.
+ Please see: https://tools.ietf.org/html/rfc3673
+
+ :Feature: Filter
+
+ :Setup: Standalone instance, test user for binding,
+ deny one attribute aci for that user
+
+ :Steps: 1. Bind as regular user or Directory Manager
+ 2. Search with '+' filter and with additionaly
+ 'objectClass' and '*' attrs too
+
+ :Assert: All expected values were returned, not more
+ """
+
+ if regular_user:
+ topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PWD)
+ else:
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ search_filter = ['+']
+ if add_attr:
+ search_filter.append(add_attr)
+ expected_attrs = sorted(oper_attr_list + ['objectClass'])
+ else:
+ expected_attrs = sorted(oper_attr_list)
+
+ entries = topology.standalone.search_s(search_suffix, ldap.SCOPE_BASE,
+ '(objectclass=*)',
+ search_filter)
+ found_attrs = sorted(entries[0].data.keys())
+
+ if add_attr == '*':
+ # Check that found attrs contain both operational
+ # and non-operational attributes
+ assert all(attr in found_attrs
+ for attr in ['objectClass', expected_attrs[0]])
+ else:
+ assert cmp(found_attrs, expected_attrs) == 0
+
+
+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/ticket48363_test.py b/dirsrvtests/tests/tickets/ticket48363_test.py
deleted file mode 100644
index 33245a1..0000000
--- a/dirsrvtests/tests/tickets/ticket48363_test.py
+++ /dev/null
@@ -1,206 +0,0 @@
-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__)
-
-TEST_USER = 'uid=test,%s' % DEFAULT_SUFFIX
-# Well, it's better than "password" or "password1"
-TEST_PASS = 'banana cream pie'
-
-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)
-
-
-def test_ticket48363(topology):
- """
- Test the implementation of rfc3673, '+' for all operational attributes.
-
- Please see: https://tools.ietf.org/html/rfc3673
-
- """
-
- # Test the implementation of the supportFeatures
-
- # Section 2:
- # Servers supporting this feature SHOULD publish the Object Identifier
- # 1.3.6.1.4.1.4203.1.5.1 as a value of the 'supportedFeatures'
- # [RFC3674] attribute in the root DSE.
-
- results = topology.standalone.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['supportedFeatures'] )[0]
- if results.hasAttr('supportedfeatures') is False:
- assert False
- if results.hasValue('supportedfeatures', '1.3.6.1.4.1.4203.1.5.1') is False:
- assert False
-
- # Section 2:
- # The presence of the attribute description "+" (ASCII 43) in the list
- # of attributes in a Search Request [RFC2251] SHALL signify a request
- # for the return of all operational attributes.
-
- # Test the two backends, rootdse, and a real ldbm backend
-
- # Root DSE
- results = topology.standalone.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['+'] )[0]
- # There are a number of obvious ones in rootdse. These are:
-
- rootdse_op_attrs = [
- 'supportedExtension',
- 'supportedControl',
- 'supportedFeatures',
- 'supportedSASLMechanisms',
- 'supportedLDAPVersion',
- 'vendorName',
- 'vendorVersion',
- ]
-
- for opattr in rootdse_op_attrs:
- if results.hasAttr(opattr) is False:
- assert False
-
- # LDBM backend
- # We are going to examine the root of the suffix, as it's a good easy target
- dc_op_attrs = [
- 'nsuniqueid',
- 'entrydn',
- 'entryid',
- 'aci',
- ]
- dc_user_attrs = [
- 'objectClass',
- 'dc',
- ]
-
- # We should show that the following work:
-
- # '+'
- results = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_BASE, 'objectClass=*', ['+'] )[0]
- for opattr in dc_op_attrs:
- if results.hasAttr(opattr) is False:
- assert False
- for userattr in dc_user_attrs:
- if results.hasAttr(userattr) is False:
- assert True
-
- # '+' '*'
- results = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_BASE, 'objectClass=*', ['+', '*'] )[0]
- for opattr in dc_op_attrs:
- if results.hasAttr(opattr) is False:
- assert False
- for userattr in dc_user_attrs:
- if results.hasAttr(userattr) is False:
- assert False
-
- # Section 2:
- # Client implementors should also note
- # that certain operational attributes may be returned only if requested
- # by name even when "+" is present.
-
- # We do not currently have any types that are excluded.
- # However, we should ensure that a search for "+ namedType" returns
- # both all operational and the namedType
-
- # '+' dc
- results = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_BASE, 'objectClass=*', ['+', 'dc'] )[0]
- for opattr in dc_op_attrs:
- if results.hasAttr(opattr) is False:
- assert False
- if results.hasAttr('dc') is False:
- assert False
- if results.hasAttr('objectclass') is False:
- assert True
-
- # '*' nsUniqueId
- results = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_BASE, 'objectClass=*', ['*', 'nsuniqueid'] )[0]
- for userattr in dc_user_attrs:
- if results.hasAttr(userattr) is False:
- assert False
- if results.hasAttr('nsuniqueid') is False:
- assert False
- if results.hasAttr('entrydn') is False:
- assert True
-
- # Section 2:
- # As with all search requests, client implementors should note that
- # results may not include all requested attributes due to access
- # controls or other restrictions.
-
- # Test that with a user with limit read aci, that these are enforced on
- # the + request.
-
- # Create the user
- uentry = Entry(TEST_USER)
- uentry.setValues('objectclass', 'top', 'extensibleobject')
- uentry.setValues('uid', 'test')
- uentry.setValues('userPassword', TEST_PASS)
- topology.standalone.add_s(uentry)
-
- # Give them a limited read aci: We may need to purge other acis
- anonaci = '(targetattr!="userPassword")(version 3.0; acl "Enable anonymous access"; allow (read, search, compare) userdn="ldap:///anyone";)'
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_DELETE, 'aci', anonaci)])
-
- # Now we need to create an aci that allows anon/all read to only a few attrs
- # Lets make one real, and one operational.
-
- anonaci = '(targetattr="objectclass || dc || nsuniqueid")(version 3.0; acl "Enable anonymous access"; allow (read, search, compare) userdn="ldap:///anyone";)'
- topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci', anonaci)])
-
- # bind as them, and test.
- topology.standalone.simple_bind_s(TEST_USER, TEST_PASS)
- results = topology.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_BASE, 'objectClass=*', ['*', '+'] )[0]
-
- if results.hasAttr('dc') is False:
- assert False
- if results.hasAttr('nsuniqueid') is False:
- assert False
- if results.hasAttr('entrydn') is False:
- assert True
-
- log.info('Test complete')
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
7 years, 6 months
Branch '389-ds-base-1.3.3' - dirsrvtests/create_test.py
by Mark Reynolds
dirsrvtests/create_test.py | 171 ++++++++++++++++++++++++++++-----------------
1 file changed, 108 insertions(+), 63 deletions(-)
New commits:
commit 0b98840714e39b6d31d672271537e28645c82c6a
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri May 20 17:22:01 2016 -0400
Ticket 48795 - Make various improvements to create_test.py
Description: Made the following improvements to the create_test.py script:
- Added a new line at the end of the generated script (pep8)
- Fixed the way replication agreement names were generated
- Added docstrings where needed (sphinx documentation)
- Added a new DEBUGGING flag that if set stops instances
instead of removing them, sets "verbose=True" for Dirsrv
objects, and adds an area where debugging steps can be set.
https://fedorahosted.org/389/ticket/48795
Reviewed by: spichugi(Thanks!)
(cherry picked from commit 17f30c60cfdbd6b4f7a68f93ad0f9b6f0d8c52f5)
(cherry picked from commit b69db2aba462fa504724f933b7f70104be0e019b)
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index 4a8dca3..eab9776 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
#
# --- 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 @@ non-interesting parts of a test script:
def displayUsage():
+ """Display the usage"""
print ('\nUsage:\ncreate_ticket.py -t|--ticket <ticket number> ' +
'-s|--suite <suite name> ' +
'[ i|--instances <number of standalone instances> ' +
@@ -36,29 +37,43 @@ def displayUsage():
def writeFinalizer():
- """Write the finalizer function - delete each instance"""
+ """Write the finalizer function - delete/stop each instance"""
+
+ def writeInstanceOp(action):
+ """Write instance finializer action"""
+ if repl_deployment:
+ for idx in range(masters):
+ idx += 1
+ TEST.write(' master' + str(idx) + '.' + action +
+ '()\n')
+ for idx in range(hubs):
+ idx += 1
+ TEST.write(' hub' + str(idx) + '.' + action +
+ '()\n')
+ for idx in range(consumers):
+ idx += 1
+ TEST.write(' consumer' + str(idx) + '.' + action +
+ '()\n')
+ else:
+ for idx in range(instances):
+ idx += 1
+ if idx == 1:
+ idx = ''
+ else:
+ idx = str(idx)
+ TEST.write(' standalone' + idx + '.' + action +
+ '()\n')
- TEST.write(' # Delete each instance in the end\n')
TEST.write(' def fin():\n')
- if repl_deployment:
- for idx in range(masters):
- idx += 1
- TEST.write(' master' + str(idx) + '.delete()\n')
- for idx in range(hubs):
- idx += 1
- TEST.write(' hub' + str(idx) + '.delete()\n')
- for idx in range(consumers):
- idx += 1
- TEST.write(' consumer' + str(idx) + '.delete()\n')
- else:
- for idx in range(instances):
- idx += 1
- if idx == 1:
- idx = ''
- else:
- idx = str(idx)
- TEST.write(' standalone' + idx + '.delete()\n')
- TEST.write(' request.addfinalizer(fin)')
+ TEST.write(' """')
+ TEST.write('If we are debugging just stop the instances, ' +
+ 'otherwise remove\n them\n')
+ TEST.write(' """\n')
+ TEST.write(' if DEBUGGING:\n')
+ writeInstanceOp('stop')
+ TEST.write(' else:\n')
+ writeInstanceOp('delete')
+ TEST.write('\n request.addfinalizer(fin)')
TEST.write('\n\n')
@@ -170,11 +185,14 @@ if len(sys.argv) > 0:
'from lib389.tasks import *\nfrom lib389.utils import *\n\n')
#
- # Set the logger and installation prefix
+ # Set the logger and other settings
#
- TEST.write('logging.getLogger(__name__).setLevel(logging.DEBUG)\n')
- TEST.write('log = logging.getLogger(__name__)\n\n')
- TEST.write('installation1_prefix = None\n\n\n')
+ 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\n\n')
+ TEST.write('log = logging.getLogger(__name__)\n\n\n')
#
# Write the replication or standalone classes
@@ -187,6 +205,7 @@ if len(sys.argv) > 0:
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))
@@ -195,6 +214,7 @@ if len(sys.argv) > 0:
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')
@@ -214,6 +234,7 @@ if len(sys.argv) > 0:
# 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
@@ -223,7 +244,7 @@ if len(sys.argv) > 0:
idx = str(idx)
TEST.write(', standalone' + idx)
TEST.write('):\n')
-
+ TEST.write(' """Init"""\n')
for idx in range(instances):
idx += 1
if idx == 1:
@@ -240,19 +261,19 @@ if len(sys.argv) > 0:
#
TEST.write('@pytest.fixture(scope="module")\n')
TEST.write('def topology(request):\n')
- TEST.write(' global installation1_prefix\n')
- TEST.write(' if installation1_prefix:\n')
- TEST.write(' args_instance[SER_DEPLOYED_DIR] = ' +
- 'installation1_prefix\n\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(' master' + idx + ' = DirSrv(verbose=False)\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 +
@@ -276,7 +297,10 @@ if len(sys.argv) > 0:
for idx in range(hubs):
idx = str(idx + 1)
TEST.write(' # Creating hub ' + idx + '...\n')
- TEST.write(' hub' + idx + ' = DirSrv(verbose=False)\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_' +
@@ -298,7 +322,10 @@ if len(sys.argv) > 0:
for idx in range(consumers):
idx = str(idx + 1)
TEST.write(' # Creating consumer ' + idx + '...\n')
- TEST.write(' consumer' + idx + ' = DirSrv(verbose=False)\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 +
@@ -338,13 +365,15 @@ if len(sys.argv) > 0:
continue
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to master ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -369,13 +398,15 @@ if len(sys.argv) > 0:
#
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to hub ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -408,13 +439,15 @@ if len(sys.argv) > 0:
#
TEST.write(' # Creating agreement from hub ' + str(hub_idx)
+ ' to consumer ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -449,13 +482,15 @@ if len(sys.argv) > 0:
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to consumer ' + str(idx) +
'\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -573,6 +608,7 @@ if len(sys.argv) > 0:
#
# Args for the standalone instance
+ TEST.write(' """Create DS Deployment"""\n\n')
for idx in range(instances):
idx += 1
if idx == 1:
@@ -580,7 +616,12 @@ if len(sys.argv) > 0:
else:
idx = str(idx)
TEST.write(' # Creating standalone instance ' + idx + '...\n')
- TEST.write(' standalone' + idx + ' = DirSrv(verbose=False)\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' +
@@ -628,7 +669,7 @@ if len(sys.argv) > 0:
if ticket:
TEST.write('def test_ticket' + ticket + '(topology):\n')
if repl_deployment:
- TEST.write(' """Write your replication testcase here.\n\n')
+ TEST.write(' """Write your replication test here.\n\n')
TEST.write(' To access each DirSrv instance use: ' +
'topology.master1, topology.master2,\n' +
' ..., topology.hub1, ..., topology.consumer1' +
@@ -641,17 +682,21 @@ 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')
- TEST.write(" log.info('Test complete')\n")
- TEST.write('\n\n')
+ TEST.write('\n """\n\n')
+
else:
# Write the first initial empty test function
- TEST.write('def test_' + suite + '_#####(topology):\n')
+ TEST.write('def test_' + suite + '(topology):\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')
- TEST.write(' """\n\n return\n\n\n')
+ 'finalizer).\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')
#
# Write the main function
@@ -660,7 +705,7 @@ if len(sys.argv) > 0:
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')
+ TEST.write(' pytest.main("-s %s" % CURRENT_FILE)\n\n')
#
# Done, close things up
7 years, 6 months
Branch '389-ds-base-1.3.4' - dirsrvtests/create_test.py
by Mark Reynolds
dirsrvtests/create_test.py | 171 ++++++++++++++++++++++++++++-----------------
1 file changed, 108 insertions(+), 63 deletions(-)
New commits:
commit b69db2aba462fa504724f933b7f70104be0e019b
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri May 20 17:22:01 2016 -0400
Ticket 48795 - Make various improvements to create_test.py
Description: Made the following improvements to the create_test.py script:
- Added a new line at the end of the generated script (pep8)
- Fixed the way replication agreement names were generated
- Added docstrings where needed (sphinx documentation)
- Added a new DEBUGGING flag that if set stops instances
instead of removing them, sets "verbose=True" for Dirsrv
objects, and adds an area where debugging steps can be set.
https://fedorahosted.org/389/ticket/48795
Reviewed by: spichugi(Thanks!)
(cherry picked from commit 17f30c60cfdbd6b4f7a68f93ad0f9b6f0d8c52f5)
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index e3b89aa..46c8217 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
#
# --- 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 @@ non-interesting parts of a test script:
def displayUsage():
+ """Display the usage"""
print ('\nUsage:\ncreate_ticket.py -t|--ticket <ticket number> ' +
'-s|--suite <suite name> ' +
'[ i|--instances <number of standalone instances> ' +
@@ -36,29 +37,43 @@ def displayUsage():
def writeFinalizer():
- """Write the finalizer function - delete each instance"""
+ """Write the finalizer function - delete/stop each instance"""
+
+ def writeInstanceOp(action):
+ """Write instance finializer action"""
+ if repl_deployment:
+ for idx in range(masters):
+ idx += 1
+ TEST.write(' master' + str(idx) + '.' + action +
+ '()\n')
+ for idx in range(hubs):
+ idx += 1
+ TEST.write(' hub' + str(idx) + '.' + action +
+ '()\n')
+ for idx in range(consumers):
+ idx += 1
+ TEST.write(' consumer' + str(idx) + '.' + action +
+ '()\n')
+ else:
+ for idx in range(instances):
+ idx += 1
+ if idx == 1:
+ idx = ''
+ else:
+ idx = str(idx)
+ TEST.write(' standalone' + idx + '.' + action +
+ '()\n')
- TEST.write(' # Delete each instance in the end\n')
TEST.write(' def fin():\n')
- if repl_deployment:
- for idx in range(masters):
- idx += 1
- TEST.write(' master' + str(idx) + '.delete()\n')
- for idx in range(hubs):
- idx += 1
- TEST.write(' hub' + str(idx) + '.delete()\n')
- for idx in range(consumers):
- idx += 1
- TEST.write(' consumer' + str(idx) + '.delete()\n')
- else:
- for idx in range(instances):
- idx += 1
- if idx == 1:
- idx = ''
- else:
- idx = str(idx)
- TEST.write(' standalone' + idx + '.delete()\n')
- TEST.write(' request.addfinalizer(fin)')
+ TEST.write(' """')
+ TEST.write('If we are debugging just stop the instances, ' +
+ 'otherwise remove\n them\n')
+ TEST.write(' """\n')
+ TEST.write(' if DEBUGGING:\n')
+ writeInstanceOp('stop')
+ TEST.write(' else:\n')
+ writeInstanceOp('delete')
+ TEST.write('\n request.addfinalizer(fin)')
TEST.write('\n\n')
@@ -170,11 +185,14 @@ if len(sys.argv) > 0:
'from lib389.tasks import *\nfrom lib389.utils import *\n\n')
#
- # Set the logger and installation prefix
+ # Set the logger and other settings
#
- TEST.write('logging.getLogger(__name__).setLevel(logging.DEBUG)\n')
- TEST.write('log = logging.getLogger(__name__)\n\n')
- TEST.write('installation1_prefix = None\n\n\n')
+ 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\n\n')
+ TEST.write('log = logging.getLogger(__name__)\n\n\n')
#
# Write the replication or standalone classes
@@ -187,6 +205,7 @@ if len(sys.argv) > 0:
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))
@@ -195,6 +214,7 @@ if len(sys.argv) > 0:
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')
@@ -214,6 +234,7 @@ if len(sys.argv) > 0:
# 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
@@ -223,7 +244,7 @@ if len(sys.argv) > 0:
idx = str(idx)
TEST.write(', standalone' + idx)
TEST.write('):\n')
-
+ TEST.write(' """Init"""\n')
for idx in range(instances):
idx += 1
if idx == 1:
@@ -240,19 +261,19 @@ if len(sys.argv) > 0:
#
TEST.write('@pytest.fixture(scope="module")\n')
TEST.write('def topology(request):\n')
- TEST.write(' global installation1_prefix\n')
- TEST.write(' if installation1_prefix:\n')
- TEST.write(' args_instance[SER_DEPLOYED_DIR] = ' +
- 'installation1_prefix\n\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(' master' + idx + ' = DirSrv(verbose=False)\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 +
@@ -276,7 +297,10 @@ if len(sys.argv) > 0:
for idx in range(hubs):
idx = str(idx + 1)
TEST.write(' # Creating hub ' + idx + '...\n')
- TEST.write(' hub' + idx + ' = DirSrv(verbose=False)\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_' +
@@ -298,7 +322,10 @@ if len(sys.argv) > 0:
for idx in range(consumers):
idx = str(idx + 1)
TEST.write(' # Creating consumer ' + idx + '...\n')
- TEST.write(' consumer' + idx + ' = DirSrv(verbose=False)\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 +
@@ -338,13 +365,15 @@ if len(sys.argv) > 0:
continue
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to master ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -369,13 +398,15 @@ if len(sys.argv) > 0:
#
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to hub ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -408,13 +439,15 @@ if len(sys.argv) > 0:
#
TEST.write(' # Creating agreement from hub ' + str(hub_idx)
+ ' to consumer ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -449,13 +482,15 @@ if len(sys.argv) > 0:
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to consumer ' + str(idx) +
'\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -573,6 +608,7 @@ if len(sys.argv) > 0:
#
# Args for the standalone instance
+ TEST.write(' """Create DS Deployment"""\n\n')
for idx in range(instances):
idx += 1
if idx == 1:
@@ -580,7 +616,12 @@ if len(sys.argv) > 0:
else:
idx = str(idx)
TEST.write(' # Creating standalone instance ' + idx + '...\n')
- TEST.write(' standalone' + idx + ' = DirSrv(verbose=False)\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' +
@@ -628,7 +669,7 @@ if len(sys.argv) > 0:
if ticket:
TEST.write('def test_ticket' + ticket + '(topology):\n')
if repl_deployment:
- TEST.write(' """Write your replication testcase here.\n\n')
+ TEST.write(' """Write your replication test here.\n\n')
TEST.write(' To access each DirSrv instance use: ' +
'topology.master1, topology.master2,\n' +
' ..., topology.hub1, ..., topology.consumer1' +
@@ -641,17 +682,21 @@ 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')
- TEST.write(" log.info('Test complete')\n")
- TEST.write('\n\n')
+ TEST.write('\n """\n\n')
+
else:
# Write the first initial empty test function
- TEST.write('def test_' + suite + '_#####(topology):\n')
+ TEST.write('def test_' + suite + '(topology):\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')
- TEST.write(' """\n\n return\n\n\n')
+ 'finalizer).\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')
#
# Write the main function
@@ -660,7 +705,7 @@ if len(sys.argv) > 0:
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')
+ TEST.write(' pytest.main("-s %s" % CURRENT_FILE)\n\n')
#
# Done, close things up
7 years, 6 months
dirsrvtests/create_test.py
by Mark Reynolds
dirsrvtests/create_test.py | 173 ++++++++++++++++++++++++++++-----------------
1 file changed, 108 insertions(+), 65 deletions(-)
New commits:
commit 17f30c60cfdbd6b4f7a68f93ad0f9b6f0d8c52f5
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri May 20 17:22:01 2016 -0400
Ticket 48795 - Make various improvements to create_test.py
Description: Made the following improvements to the create_test.py script:
- Added a new line at the end of the generated script (pep8)
- Fixed the way replication agreement names were generated
- Added docstrings where needed (sphinx documentation)
- Added a new DEBUGGING flag that if set stops instances
instead of removing them, sets "verbose=True" for Dirsrv
objects, and adds an area where debugging steps can be set.
https://fedorahosted.org/389/ticket/48795
Reviewed by: spichugi(Thanks!)
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index 7b06fdb..46c8217 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
#
# --- 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 @@ non-interesting parts of a test script:
def displayUsage():
+ """Display the usage"""
print ('\nUsage:\ncreate_ticket.py -t|--ticket <ticket number> ' +
'-s|--suite <suite name> ' +
'[ i|--instances <number of standalone instances> ' +
@@ -36,29 +37,43 @@ def displayUsage():
def writeFinalizer():
- """Write the finalizer function - delete each instance"""
+ """Write the finalizer function - delete/stop each instance"""
+
+ def writeInstanceOp(action):
+ """Write instance finializer action"""
+ if repl_deployment:
+ for idx in range(masters):
+ idx += 1
+ TEST.write(' master' + str(idx) + '.' + action +
+ '()\n')
+ for idx in range(hubs):
+ idx += 1
+ TEST.write(' hub' + str(idx) + '.' + action +
+ '()\n')
+ for idx in range(consumers):
+ idx += 1
+ TEST.write(' consumer' + str(idx) + '.' + action +
+ '()\n')
+ else:
+ for idx in range(instances):
+ idx += 1
+ if idx == 1:
+ idx = ''
+ else:
+ idx = str(idx)
+ TEST.write(' standalone' + idx + '.' + action +
+ '()\n')
- TEST.write(' # Delete each instance in the end\n')
TEST.write(' def fin():\n')
- if repl_deployment:
- for idx in range(masters):
- idx += 1
- TEST.write(' master' + str(idx) + '.delete()\n')
- for idx in range(hubs):
- idx += 1
- TEST.write(' hub' + str(idx) + '.delete()\n')
- for idx in range(consumers):
- idx += 1
- TEST.write(' consumer' + str(idx) + '.delete()\n')
- else:
- for idx in range(instances):
- idx += 1
- if idx == 1:
- idx = ''
- else:
- idx = str(idx)
- TEST.write(' standalone' + idx + '.delete()\n')
- TEST.write(' request.addfinalizer(fin)')
+ TEST.write(' """')
+ TEST.write('If we are debugging just stop the instances, ' +
+ 'otherwise remove\n them\n')
+ TEST.write(' """\n')
+ TEST.write(' if DEBUGGING:\n')
+ writeInstanceOp('stop')
+ TEST.write(' else:\n')
+ writeInstanceOp('delete')
+ TEST.write('\n request.addfinalizer(fin)')
TEST.write('\n\n')
@@ -170,13 +185,14 @@ if len(sys.argv) > 0:
'from lib389.tasks import *\nfrom lib389.utils import *\n\n')
#
- # Set the logger and installation prefix
+ # Set the logger and other settings
#
- TEST.write('logging.getLogger(__name__).setLevel(logging.DEBUG)\n')
- TEST.write('log = logging.getLogger(__name__)\n\n')
-
- # We don't need the prefix anymore, it's worked out in lib389
- # TEST.write('installation1_prefix = None\n\n\n')
+ 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\n\n')
+ TEST.write('log = logging.getLogger(__name__)\n\n\n')
#
# Write the replication or standalone classes
@@ -189,6 +205,7 @@ if len(sys.argv) > 0:
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))
@@ -197,6 +214,7 @@ if len(sys.argv) > 0:
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')
@@ -216,6 +234,7 @@ if len(sys.argv) > 0:
# 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
@@ -225,7 +244,7 @@ if len(sys.argv) > 0:
idx = str(idx)
TEST.write(', standalone' + idx)
TEST.write('):\n')
-
+ TEST.write(' """Init"""\n')
for idx in range(instances):
idx += 1
if idx == 1:
@@ -242,19 +261,19 @@ if len(sys.argv) > 0:
#
TEST.write('@pytest.fixture(scope="module")\n')
TEST.write('def topology(request):\n')
- #TEST.write(' global installation1_prefix\n')
- #TEST.write(' if installation1_prefix:\n')
- #TEST.write(' args_instance[SER_DEPLOYED_DIR] = ' +
- # 'installation1_prefix\n\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(' master' + idx + ' = DirSrv(verbose=False)\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 +
@@ -278,7 +297,10 @@ if len(sys.argv) > 0:
for idx in range(hubs):
idx = str(idx + 1)
TEST.write(' # Creating hub ' + idx + '...\n')
- TEST.write(' hub' + idx + ' = DirSrv(verbose=False)\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_' +
@@ -300,7 +322,10 @@ if len(sys.argv) > 0:
for idx in range(consumers):
idx = str(idx + 1)
TEST.write(' # Creating consumer ' + idx + '...\n')
- TEST.write(' consumer' + idx + ' = DirSrv(verbose=False)\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 +
@@ -340,13 +365,15 @@ if len(sys.argv) > 0:
continue
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to master ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -371,13 +398,15 @@ if len(sys.argv) > 0:
#
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to hub ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -410,13 +439,15 @@ if len(sys.argv) > 0:
#
TEST.write(' # Creating agreement from hub ' + str(hub_idx)
+ ' to consumer ' + str(idx) + '\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -451,13 +482,15 @@ if len(sys.argv) > 0:
TEST.write(' # Creating agreement from master ' +
str(master_idx) + ' to consumer ' + str(idx) +
'\n')
- TEST.write(" properties = {RA_NAME: " +
- "r'meTo_$host:$port',\n")
- TEST.write(" RA_BINDDN: " +
+ 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: " +
+ TEST.write(" RA_BINDPW: " +
"defaultProperties[REPLICATION_BIND_PW],\n")
- TEST.write(" RA_METHOD: " +
+ TEST.write(" RA_METHOD: " +
"defaultProperties[REPLICATION_BIND_METHOD],\n")
TEST.write(" RA_TRANSPORT_PROT: " +
"defaultProperties[REPLICATION_TRANSPORT]}\n")
@@ -575,6 +608,7 @@ if len(sys.argv) > 0:
#
# Args for the standalone instance
+ TEST.write(' """Create DS Deployment"""\n\n')
for idx in range(instances):
idx += 1
if idx == 1:
@@ -582,7 +616,12 @@ if len(sys.argv) > 0:
else:
idx = str(idx)
TEST.write(' # Creating standalone instance ' + idx + '...\n')
- TEST.write(' standalone' + idx + ' = DirSrv(verbose=False)\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' +
@@ -630,7 +669,7 @@ if len(sys.argv) > 0:
if ticket:
TEST.write('def test_ticket' + ticket + '(topology):\n')
if repl_deployment:
- TEST.write(' """Write your replication testcase here.\n\n')
+ TEST.write(' """Write your replication test here.\n\n')
TEST.write(' To access each DirSrv instance use: ' +
'topology.master1, topology.master2,\n' +
' ..., topology.hub1, ..., topology.consumer1' +
@@ -643,17 +682,21 @@ 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')
- TEST.write(" log.info('Test complete')\n")
- TEST.write('\n\n')
+ TEST.write('\n """\n\n')
+
else:
# Write the first initial empty test function
- TEST.write('def test_' + suite + '_#####(topology):\n')
+ TEST.write('def test_' + suite + '(topology):\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')
- TEST.write(' """\n\n return\n\n\n')
+ 'finalizer).\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')
#
# Write the main function
@@ -662,7 +705,7 @@ if len(sys.argv) > 0:
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')
+ TEST.write(' pytest.main("-s %s" % CURRENT_FILE)\n\n')
#
# Done, close things up
7 years, 6 months
ldap/servers
by William Brown
ldap/servers/slapd/auditlog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 5601fe46a98a7c9318b94c34fed75320f118957e
Author: William Brown <firstyear(a)redhat.com>
Date: Thu May 19 13:52:24 2016 +1000
Ticket 48834 - Fix jenkins: discared qualifier on auditlog.c
Bug Description: ldap/servers/slapd/auditlog.c:87:31: warning: assignment
discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
ldap/servers/slapd/auditlog.c:155:31: warning: assignment discards 'const'
qualifier from pointer target type [-Wdiscarded-qualifiers]
Fix Description: Add the const char type to the array.
https://fedorahosted.org/389/ticket/48834
Author: wibrown
Review by: One line fix
diff --git a/ldap/servers/slapd/auditlog.c b/ldap/servers/slapd/auditlog.c
index 9a1b502..0f4cc94 100644
--- a/ldap/servers/slapd/auditlog.c
+++ b/ldap/servers/slapd/auditlog.c
@@ -35,7 +35,7 @@ static int auditfail_hide_unhashed_pw = 1;
/* Forward Declarations */
static void write_audit_file(int logtype, int optype, const char *dn, void *change, int flag, time_t curtime, int rc );
-static char *modrdn_changes[4];
+static const char *modrdn_changes[4];
void
write_audit_log_entry( Slapi_PBlock *pb )
7 years, 6 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/auditlog.c | 56 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 53 insertions(+), 3 deletions(-)
New commits:
commit e965c748db19f4dc3fa3e96be9ccefb75dc920b5
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed May 18 14:46:58 2016 -0700
Ticket #48834 - Modifier's name is not recorded in the audit log with modrdn and moddn operations
Description: Audit log had no support on modifier's name and newsuperior,
which is now appended to the log:
time: 20160518144610
dn: uid=tuser1,ou=People,dc=example,dc=com
result: 0
changetype: modrdn
newrdn: uid=tuser10
deleteoldrdn: 1
newsuperior: ou=OU0,ou=People,dc=example,dc=com
modifiersname: cn=directory manager
https://fedorahosted.org/389/ticket/48834
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
diff --git a/ldap/servers/slapd/auditlog.c b/ldap/servers/slapd/auditlog.c
index 1461fee..9a1b502 100644
--- a/ldap/servers/slapd/auditlog.c
+++ b/ldap/servers/slapd/auditlog.c
@@ -21,10 +21,12 @@
#define ATTR_CHANGETYPE "changetype"
#define ATTR_NEWRDN "newrdn"
#define ATTR_DELETEOLDRDN "deleteoldrdn"
+#define ATTR_NEWSUPERIOR "newsuperior"
#define ATTR_MODIFIERSNAME "modifiersname"
char *attr_changetype = ATTR_CHANGETYPE;
char *attr_newrdn = ATTR_NEWRDN;
char *attr_deleteoldrdn = ATTR_DELETEOLDRDN;
+char *attr_newsuperior = ATTR_NEWSUPERIOR;
char *attr_modifiersname = ATTR_MODIFIERSNAME;
static int audit_hide_unhashed_pw = 1;
@@ -33,6 +35,8 @@ static int auditfail_hide_unhashed_pw = 1;
/* Forward Declarations */
static void write_audit_file(int logtype, int optype, const char *dn, void *change, int flag, time_t curtime, int rc );
+static char *modrdn_changes[4];
+
void
write_audit_log_entry( Slapi_PBlock *pb )
{
@@ -68,10 +72,26 @@ write_audit_log_entry( Slapi_PBlock *pb )
break;
case SLAPI_OPERATION_MODDN:
+ {
+ char *rdn = NULL;
+ Slapi_DN *snewsuperior = NULL;
+ char *requestor = NULL;
/* newrdn: change is just for logging -- case does not matter. */
- slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &change );
+ slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &rdn );
slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, &flag );
+ slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &snewsuperior );
+ slapi_pblock_get( pb, SLAPI_REQUESTOR_DN, &requestor );
+ modrdn_changes[0] = rdn;
+ modrdn_changes[1] = requestor;
+ if (snewsuperior && slapi_sdn_get_dn(snewsuperior)) {
+ modrdn_changes[2] = slapi_sdn_get_dn(snewsuperior);
+ modrdn_changes[3] = NULL;
+ } else {
+ modrdn_changes[2] = NULL;
+ }
+ change = (void *)modrdn_changes;
break;
+ }
default:
return; /* Unsupported operation type. */
}
@@ -120,10 +140,26 @@ write_auditfail_log_entry( Slapi_PBlock *pb )
}
break;
case SLAPI_OPERATION_MODDN:
+ {
+ char *rdn = NULL;
+ Slapi_DN *snewsuperior = NULL;
+ char *requestor = NULL;
/* newrdn: change is just for logging -- case does not matter. */
- slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &change );
+ slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &rdn );
slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, &flag );
+ slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &snewsuperior );
+ slapi_pblock_get( pb, SLAPI_REQUESTOR_DN, &requestor );
+ modrdn_changes[0] = rdn;
+ modrdn_changes[1] = requestor;
+ if (snewsuperior && slapi_sdn_get_dn(snewsuperior)) {
+ modrdn_changes[2] = slapi_sdn_get_dn(snewsuperior);
+ modrdn_changes[3] = NULL;
+ } else {
+ modrdn_changes[2] = NULL;
+ }
+ change = (void *)modrdn_changes;
break;
+ }
default:
return; /* Unsupported operation type. */
}
@@ -292,7 +328,7 @@ write_audit_file(
break;
case SLAPI_OPERATION_MODDN:
- newrdn = change;
+ newrdn = ((char **)change)[0];
addlenstr( l, attr_changetype );
addlenstr( l, ": modrdn\n" );
addlenstr( l, attr_newrdn );
@@ -303,6 +339,20 @@ write_audit_file(
addlenstr( l, ": " );
addlenstr( l, flag ? "1" : "0" );
addlenstr( l, "\n" );
+ if (((char **)change)[2]) {
+ char *newsuperior = ((char **)change)[2];
+ addlenstr( l, attr_newsuperior );
+ addlenstr( l, ": " );
+ addlenstr( l, newsuperior );
+ addlenstr( l, "\n" );
+ }
+ if (((char **)change)[1]) {
+ char *modifier = ((char **)change)[1];
+ addlenstr( l, attr_modifiersname );
+ addlenstr( l, ": " );
+ addlenstr( l, modifier );
+ addlenstr( l, "\n" );
+ }
}
addlenstr( l, "\n" );
7 years, 6 months
ldap/servers man/man1
by William Brown
ldap/servers/slapd/tools/ldclt/ldapfct.c | 10 +++++++---
ldap/servers/slapd/tools/ldclt/ldclt.c | 18 ++++++++++++++----
ldap/servers/slapd/tools/ldclt/ldclt.h | 1 +
ldap/servers/slapd/tools/ldclt/ldcltU.c | 2 ++
man/man1/ldclt.1 | 3 +++
5 files changed, 27 insertions(+), 7 deletions(-)
New commits:
commit d13057ebf14b50c9b6701424da4c6c88427857f8
Author: William Brown <firstyear(a)redhat.com>
Date: Wed May 18 17:29:01 2016 +1000
Ticket 48754 - ldclt should support -H
Bug Description: Most ldap tools are using the ldap url format of
ldap://hostname:port rather than -h hostname -p port. We should support this.
Fix Description: Add support for -H to ldclt.
https://fedorahosted.org/389/ticket/48754
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index 13e66b8..e13983d 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -489,9 +489,13 @@ connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPass
}
#if defined(USE_OPENLDAP)
- ldapurl = PR_smprintf("ldap%s://%s:%d/",
- (mode & SSL) ? "s" : "",
- mctx.hostname, mctx.port);
+ if (mctx.ldapurl != NULL) {
+ ldapurl = PL_strdup(mctx.ldapurl);
+ } else {
+ ldapurl = PR_smprintf("ldap%s://%s:%d/",
+ (mode & SSL) ? "s" : "",
+ mctx.hostname, mctx.port);
+ }
if (PR_SUCCESS != PR_CallOnce(&ol_init_callOnce, internal_ol_init_init)) {
printf("Could not perform internal ol_init init\n");
goto done;
diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.c b/ldap/servers/slapd/tools/ldclt/ldclt.c
index 7296439..67b34ff 100644
--- a/ldap/servers/slapd/tools/ldclt/ldclt.c
+++ b/ldap/servers/slapd/tools/ldclt/ldclt.c
@@ -2363,6 +2363,7 @@ main (
mctx.filter = NULL;
mctx.globStatsCnt = DEF_GLOBAL_NB; /*JLS 08-08-00*/
mctx.hostname = "localhost";
+ mctx.ldapurl = NULL; /* Default url to none. */
mctx.ignErrNb = 0;
mctx.images = NULL; /*JLS 17-11-00*/
mctx.imagesDir = DEF_IMAGES_PATH; /*JLS 16-11-00*/
@@ -2412,7 +2413,7 @@ main (
* Get options
*/
while ((opt_ret = getopt (argc, argv,
- "a:b:D:e:E:f:h:i:I:n:N:o:p:qQr:R:s:S:t:T:vVw:W:Z:H")) != EOF)
+ "a:b:D:e:E:f:h:H:i:I:n:N:o:p:qQr:R:s:S:t:T:vVw:W:Z:H")) != EOF)
switch (opt_ret)
{
case 'a':
@@ -2439,6 +2440,9 @@ main (
case 'h':
mctx.hostname = optarg;
break;
+ case 'H':
+ mctx.ldapurl = optarg;
+ break;
case 'i':
mctx.inactivMax = atoi (optarg);
break;
@@ -2517,10 +2521,12 @@ main (
mctx.mode |= SSL;
mctx.certfile = optarg;
break;
+ /*
case 'H':
usage ();
- ldcltExit (EXIT_OK); /*JLS 18-12-00*/
+ ldcltExit (EXIT_OK);
break;
+ */
case '?':
usage ();
ldcltExit (EXIT_PARAMS); /*JLS 13-11-00*/
@@ -2818,8 +2824,12 @@ main (
{
printf ("%s\n", argvList); /*JLS 07-12-00*/
printf ("Process ID = %d\n", mctx.pid);
- printf ("Host to connect = %s\n", mctx.hostname);
- printf ("Port number = %d\n", mctx.port);
+ if (mctx.ldapurl != NULL) {
+ printf ("Ldap url = %s\n", mctx.ldapurl);
+ } else {
+ printf ("Host to connect = %s\n", mctx.hostname);
+ printf ("Port number = %d\n", mctx.port);
+ }
if (mctx.bindDN == NULL)
printf ("Bind DN = NULL\n");
else
diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.h b/ldap/servers/slapd/tools/ldclt/ldclt.h
index 4f8f485..b5da93a 100644
--- a/ldap/servers/slapd/tools/ldclt/ldclt.h
+++ b/ldap/servers/slapd/tools/ldclt/ldclt.h
@@ -521,6 +521,7 @@ typedef struct main_context {
char *genldifName; /* Where to put ldif */ /*JLS 19-03-01*/
int genldifFile; /* Where to put ldif */ /*JLS 19-03-01*/
char *hostname; /* Host to connect */
+ char *ldapurl; /* Url to connect to */
int globStatsCnt; /* Global stats loop */ /*JLS 08-08-00*/
int ignErr[MAX_IGN_ERRORS]; /* Err ignor */
int ignErrNb; /* Nb err ignored */
diff --git a/ldap/servers/slapd/tools/ldclt/ldcltU.c b/ldap/servers/slapd/tools/ldclt/ldcltU.c
index 4597a03..e1fb4f4 100644
--- a/ldap/servers/slapd/tools/ldclt/ldcltU.c
+++ b/ldap/servers/slapd/tools/ldclt/ldcltU.c
@@ -94,6 +94,7 @@
* withnewparent : rename with newparent specified as argument.
* -f Filter for searches.
* -h Host to connect. Default "localhost".
+ * -H Ldap URL to connect to. Overrides -h -p. Default "None".
* -i Number of times inactivity allowed. Default 3 (30 seconds)
* -I Ignore errors (cf. -E). Default none.
* -n Number of threads. Default 10.
@@ -200,6 +201,7 @@ void usage ()
(void) printf (" randomauthidhigh=value : high value for random SASL Authid.\n");
(void) printf (" -f Filter for searches.\n");
(void) printf (" -h Host to connect. Default \"localhost\".\n");
+ (void) printf (" -H Ldap URL to connect to. Overrides -h -p. Default \"None\".\n");
(void) printf (" -i Number of times inactivity allowed. Default 3 (30 seconds)\n");
(void) printf (" -I Ignore errors (cf. -E). Default none.\n");
(void) printf (" -n Number of threads. Default 10.\n");
diff --git a/man/man1/ldclt.1 b/man/man1/ldclt.1
index 87bc6b4..206bacf 100644
--- a/man/man1/ldclt.1
+++ b/man/man1/ldclt.1
@@ -55,6 +55,9 @@ Filter for searches.
.B \fB\-h\fR
Host to connect. Default "localhost".
.TP
+.B \fB\-H\fR
+Ldap URL to connect to. Example, ldap://localhost:389. This takes precedence over -h and -p.
+.TP
.B \fB\-i\fR
Number of times inactivity allowed. Default 3 (30 seconds)
.TP
7 years, 6 months
VERSION.sh
by Noriko Hosoi
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 962116b2bc3c7cb0a8b5007f950fc59a23fb501d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed May 18 10:35:32 2016 -0700
bump version to 1.3.5.4
diff --git a/VERSION.sh b/VERSION.sh
index 75bac70..1393b8a 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -10,7 +10,7 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=3
-VERSION_MAINT=5.3
+VERSION_MAINT=5.4
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=`date -u +%Y%m%d%H%M%S`
7 years, 6 months