From 031907a33530447cab05323a8e1827da0f660dc4 Mon Sep 17 00:00:00 2001 From: William Brown Date: Mon, 20 Nov 2017 17:46:01 +0100 Subject: [PATCH 4/4] Ticket 49445 - Improve regression test to detect memory leak. Bug Description: Memory leak in ldif2db of the instance name selected for the import Fix Description: Update the test case to work on python 3, which involves changes to tot_init test, and improvements to dbgen to create the correct objects. https://pagure.io/389-ds-base/issue/49445 Author: wibrown Review by: ??? --- .../mapping_tree/referral_during_tot_init.py | 57 ---------------------- src/lib389/lib389/dbgen.py | 10 ++++ 2 files changed, 10 insertions(+), 57 deletions(-) delete mode 100644 dirsrvtests/tests/suites/mapping_tree/referral_during_tot_init.py diff --git a/dirsrvtests/tests/suites/mapping_tree/referral_during_tot_init.py b/dirsrvtests/tests/suites/mapping_tree/referral_during_tot_init.py deleted file mode 100644 index e5aee7d..0000000 --- a/dirsrvtests/tests/suites/mapping_tree/referral_during_tot_init.py +++ /dev/null @@ -1,57 +0,0 @@ -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2017 Red Hat, Inc. -# All rights reserved. -# -# License: GPL (version 3 or any later version). -# See LICENSE for details. -# --- END COPYRIGHT BLOCK --- -# -import ldap -import pytest -from lib389.topologies import topology_m2 -from lib389._constants import (DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2, TASK_WAIT) - -from lib389.idm.user import (TEST_USER_PROPERTIES, UserAccounts) - -def test_referral_during_tot(topology_m2): - - master1 = topology_m2.ms["master1"] - master2 = topology_m2.ms["master2"] - - # Create a bunch of entries on master1 - ldif_dir = master1.get_ldif_dir() - import_ldif = ldif_dir + '/ref_during_tot_import.ldif' - master1.buildLDIF(10000, import_ldif) - - master1.stop() - try: - master1.ldif2db(bename=None, excludeSuffixes=None, encrypt=False, suffixes=[DEFAULT_SUFFIX], import_file=import_ldif) - except: - pass - # master1.tasks.importLDIF(suffix=DEFAULT_SUFFIX, input_file=import_ldif, args={TASK_WAIT: True}) - master1.start() - users = UserAccounts(master1, DEFAULT_SUFFIX, rdn='ou=Accounting') - - u = users.create(properties=TEST_USER_PROPERTIES) - u.set('userPassword', 'password') - - binddn = u.dn - bindpw = 'password' - - # Now export them to master2 - master1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2) - - # While that's happening try to bind as a user to master 2 - # This should trigger the referral code. - for i in range(0, 100): - conn = ldap.initialize(master2.toLDAPURL()) - conn.set_option(ldap.OPT_REFERRALS, False) - try: - conn.simple_bind_s(binddn, bindpw) - conn.unbind_s() - except ldap.REFERRAL: - pass - - # Done. - - diff --git a/src/lib389/lib389/dbgen.py b/src/lib389/lib389/dbgen.py index a0cda94..447c697 100644 --- a/src/lib389/lib389/dbgen.py +++ b/src/lib389/lib389/dbgen.py @@ -143,6 +143,16 @@ objectClass: top objectClass: organizationalUnit ou: Payroll +dn: ou=People,{SUFFIX} +objectClass: top +objectClass: organizationalUnit +ou: People + +dn: ou=Groups,{SUFFIX} +objectClass: top +objectClass: organizationalUnit +ou: Groups + """ def dbgen(instance, number, ldif_file, suffix): -- 1.8.3.1