Pārlūkot izejas kodu

Ticket 48832 - Fix lib389 CI ticket/suite test failures

Description:  There were varuious failures in many of the lib389
              CI tests.  Here is a list of some of the common fixes
              that were made:

                - Removed the use of TMP_DIR, and used /tmp for
                  everything.  There were just too many issues
                  with permissions (between user running the tests
                  and the DS user).
                - Added some sleeps where timing was an issue.
                - Updated the tests to match new lib389 API changes
                - Fixed all the tests so they work with SELinux enforcing
                - Made sure ever test script has a finialzier to
                  remove the instance.

https://fedorahosted.org/389/ticket/48832

Reviewed by: spichugi & firstyear (Thanks!!)
Mark Reynolds 9 gadi atpakaļ
vecāks
revīzija
19721959cb
100 mainītis faili ar 1003 papildinājumiem un 1403 dzēšanām
  1. 2 5
      dirsrvtests/create_test.py
  2. 9 11
      dirsrvtests/tests/stress/reliabilty/reliab_7_5_test.py
  3. 5 7
      dirsrvtests/tests/suites/acct_usability_plugin/acct_usability_test.py
  4. 5 10
      dirsrvtests/tests/suites/acctpolicy_plugin/acctpolicy_test.py
  5. 3 3
      dirsrvtests/tests/suites/acl/acl_test.py
  6. 6 8
      dirsrvtests/tests/suites/attr_encryption/attr_encrypt_test.py
  7. 6 11
      dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
  8. 6 8
      dirsrvtests/tests/suites/automember_plugin/automember_test.py
  9. 16 15
      dirsrvtests/tests/suites/basic/basic_test.py
  10. 3 8
      dirsrvtests/tests/suites/betxns/betxn_test.py
  11. 5 10
      dirsrvtests/tests/suites/chaining_plugin/chaining_test.py
  12. 4 11
      dirsrvtests/tests/suites/clu/clu_test.py
  13. 4 10
      dirsrvtests/tests/suites/clu/db2ldif_test.py
  14. 4 4
      dirsrvtests/tests/suites/collation_plugin/collatation_test.py
  15. 4 9
      dirsrvtests/tests/suites/cos_plugin/cos_test.py
  16. 4 9
      dirsrvtests/tests/suites/deref_plugin/deref_test.py
  17. 4 9
      dirsrvtests/tests/suites/disk_monitoring/disk_monitor_test.py
  18. 4 9
      dirsrvtests/tests/suites/distrib_plugin/distrib_test.py
  19. 4 9
      dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
  20. 4 5
      dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
  21. 3 9
      dirsrvtests/tests/suites/filter/filter_test.py
  22. 1 1
      dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
  23. 4 9
      dirsrvtests/tests/suites/get_effective_rights/ger_test.py
  24. 3 2
      dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
  25. 4 9
      dirsrvtests/tests/suites/ldapi/ldapi_test.py
  26. 4 9
      dirsrvtests/tests/suites/linkedattrs_plugin/linked_attrs_test.py
  27. 4 9
      dirsrvtests/tests/suites/mapping_tree/mapping_tree_test.py
  28. 0 1
      dirsrvtests/tests/suites/memberof_plugin/memberof_test.py
  29. 2 2
      dirsrvtests/tests/suites/memory_leaks/range_search_test.py
  30. 4 9
      dirsrvtests/tests/suites/monitor/monitor_test.py
  31. 23 17
      dirsrvtests/tests/suites/paged_results/paged_results_test.py
  32. 4 9
      dirsrvtests/tests/suites/pam_passthru_plugin/pam_test.py
  33. 4 9
      dirsrvtests/tests/suites/passthru_plugin/passthru_test.py
  34. 3 8
      dirsrvtests/tests/suites/password/password_test.py
  35. 3 8
      dirsrvtests/tests/suites/password/pwdAdmin_test.py
  36. 127 54
      dirsrvtests/tests/suites/password/pwdPolicy_test.py
  37. 4 9
      dirsrvtests/tests/suites/posix_winsync_plugin/posix_winsync_test.py
  38. 4 9
      dirsrvtests/tests/suites/psearch/psearch_test.py
  39. 4 9
      dirsrvtests/tests/suites/referint_plugin/referint_test.py
  40. 215 480
      dirsrvtests/tests/suites/replication/cleanallruv_test.py
  41. 11 5
      dirsrvtests/tests/suites/replication/wait_for_async_feature_test.py
  42. 4 9
      dirsrvtests/tests/suites/replsync_plugin/repl_sync_test.py
  43. 4 9
      dirsrvtests/tests/suites/resource_limits/res_limits_test.py
  44. 4 9
      dirsrvtests/tests/suites/retrocl_plugin/retrocl_test.py
  45. 4 9
      dirsrvtests/tests/suites/reverpwd_plugin/reverpwd_test.py
  46. 4 9
      dirsrvtests/tests/suites/roles_plugin/roles_test.py
  47. 12 10
      dirsrvtests/tests/suites/rootdn_plugin/rootdn_plugin_test.py
  48. 4 10
      dirsrvtests/tests/suites/sasl/sasl_test.py
  49. 4 6
      dirsrvtests/tests/suites/schema/test_schema.py
  50. 4 9
      dirsrvtests/tests/suites/schema_reload_plugin/schema_reload_test.py
  51. 4 9
      dirsrvtests/tests/suites/snmp/snmp_test.py
  52. 4 9
      dirsrvtests/tests/suites/ssl/ssl_test.py
  53. 4 9
      dirsrvtests/tests/suites/syntax_plugin/syntax_test.py
  54. 4 9
      dirsrvtests/tests/suites/usn_plugin/usn_test.py
  55. 4 10
      dirsrvtests/tests/suites/views_plugin/views_test.py
  56. 4 9
      dirsrvtests/tests/suites/vlv/vlv_test.py
  57. 4 9
      dirsrvtests/tests/suites/whoami_plugin/whoami_test.py
  58. 7 3
      dirsrvtests/tests/tickets/ticket1347760_test.py
  59. 6 9
      dirsrvtests/tests/tickets/ticket142_test.py
  60. 37 30
      dirsrvtests/tests/tickets/ticket365_test.py
  61. 4 8
      dirsrvtests/tests/tickets/ticket47313_test.py
  62. 20 21
      dirsrvtests/tests/tickets/ticket47384_test.py
  63. 7 7
      dirsrvtests/tests/tickets/ticket47431_test.py
  64. 5 6
      dirsrvtests/tests/tickets/ticket47490_test.py
  65. 15 21
      dirsrvtests/tests/tickets/ticket47536_test.py
  66. 4 4
      dirsrvtests/tests/tickets/ticket47560_test.py
  67. 5 5
      dirsrvtests/tests/tickets/ticket47573_test.py
  68. 5 5
      dirsrvtests/tests/tickets/ticket47619_test.py
  69. 3 3
      dirsrvtests/tests/tickets/ticket47640_test.py
  70. 6 7
      dirsrvtests/tests/tickets/ticket47653MMR_test.py
  71. 6 7
      dirsrvtests/tests/tickets/ticket47653_test.py
  72. 3 3
      dirsrvtests/tests/tickets/ticket47669_test.py
  73. 5 5
      dirsrvtests/tests/tickets/ticket47676_test.py
  74. 10 9
      dirsrvtests/tests/tickets/ticket47714_test.py
  75. 5 6
      dirsrvtests/tests/tickets/ticket47721_test.py
  76. 3 3
      dirsrvtests/tests/tickets/ticket47781_test.py
  77. 5 5
      dirsrvtests/tests/tickets/ticket47787_test.py
  78. 5 5
      dirsrvtests/tests/tickets/ticket47808_test.py
  79. 3 3
      dirsrvtests/tests/tickets/ticket47815_test.py
  80. 9 6
      dirsrvtests/tests/tickets/ticket47819_test.py
  81. 4 4
      dirsrvtests/tests/tickets/ticket47823_test.py
  82. 90 112
      dirsrvtests/tests/tickets/ticket47828_test.py
  83. 4 4
      dirsrvtests/tests/tickets/ticket47829_test.py
  84. 27 27
      dirsrvtests/tests/tickets/ticket47833_test.py
  85. 13 11
      dirsrvtests/tests/tickets/ticket47838_test.py
  86. 5 5
      dirsrvtests/tests/tickets/ticket47869MMR_test.py
  87. 5 6
      dirsrvtests/tests/tickets/ticket47871_test.py
  88. 3 3
      dirsrvtests/tests/tickets/ticket47900_test.py
  89. 22 22
      dirsrvtests/tests/tickets/ticket47910_test.py
  90. 3 3
      dirsrvtests/tests/tickets/ticket47920_test.py
  91. 3 3
      dirsrvtests/tests/tickets/ticket47921_test.py
  92. 3 3
      dirsrvtests/tests/tickets/ticket47927_test.py
  93. 3 3
      dirsrvtests/tests/tickets/ticket47937_test.py
  94. 3 3
      dirsrvtests/tests/tickets/ticket47950_test.py
  95. 15 4
      dirsrvtests/tests/tickets/ticket47953_test.py
  96. 3 3
      dirsrvtests/tests/tickets/ticket47963_test.py
  97. 5 5
      dirsrvtests/tests/tickets/ticket47966_test.py
  98. 3 3
      dirsrvtests/tests/tickets/ticket47970_test.py
  99. 3 3
      dirsrvtests/tests/tickets/ticket47973_test.py
  100. 3 3
      dirsrvtests/tests/tickets/ticket47980_test.py

+ 2 - 5
dirsrvtests/create_test.py

@@ -346,6 +346,8 @@ if len(sys.argv) > 0:
                        '(suffix=SUFFIX, role=REPLICAROLE_CONSUMER, ' +
                        'replicaId=CONSUMER_REPLICAID)\n\n')
 
+        writeFinalizer()
+
         #
         # Create the master agreements
         #
@@ -584,8 +586,6 @@ if len(sys.argv) > 0:
             TEST.write('        assert False\n')
             TEST.write('\n')
 
-        writeFinalizer()
-
         #
         # Write the finals steps for replication
         #
@@ -649,10 +649,7 @@ if len(sys.argv) > 0:
 
         writeFinalizer()
 
-        TEST.write('    # Clear out the tmp dir\n')
-        TEST.write('    standalone.clearTmpDir(__file__)\n')
         TEST.write('\n')
-
         TEST.write('    return TopologyStandalone(standalone')
         for idx in range(instances):
             idx += 1

+ 9 - 11
dirsrvtests/tests/stress/reliabilty/reliab_7_5_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).
@@ -50,7 +50,7 @@ def topology(request):
         args_instance[SER_DEPLOYED_DIR] = installation1_prefix
 
     # Creating master 1...
-    master1 = DirSrv(verbose=True)
+    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
@@ -118,9 +118,9 @@ def topology(request):
     #
     # Import tests entries into master1 before we initialize master2
     #
-    tmp_dir = master1.getDir(__file__, TMP_DIR)
+    ldif_dir = master1.get_ldif_dir()
 
-    import_ldif = tmp_dir + '/rel7.5-entries.ldif'
+    import_ldif = ldif_dir + '/rel7.5-entries.ldif'
 
     # First generate an ldif
     try:
@@ -200,6 +200,9 @@ def topology(request):
     def fin():
         master1.delete()
         master2.delete()
+        if ENABLE_VALGRIND:
+            sbin_dir = get_sbin_dir(prefix=master1.prefix)
+            valgrind_disable(sbin_dir)
     request.addfinalizer(fin)
 
     return TopologyReplication(master1, master2)
@@ -279,7 +282,7 @@ class ModUsers(threading.Thread):
                        DEFAULT_SUFFIX)
             NEW_RDN = 'cn=master' + self.id + '_entry' + str(idx)
             try:
-                conn.rename(USER_DN, NEW_RDN, delold=1)
+                conn.rename_s(USER_DN, NEW_RDN, delold=1)
             except ldap.LDAPError as e:
                 log.error('Failed to modrdn (' + USER_DN + ') on master ' +
                           self.id + ': error ' + e.message['desc'])
@@ -294,7 +297,7 @@ class ModUsers(threading.Thread):
                        DEFAULT_SUFFIX)
             NEW_RDN = 'uid=master' + self.id + '_entry' + str(idx)
             try:
-                conn.rename(USER_DN, NEW_RDN, delold=1)
+                conn.rename_s(USER_DN, NEW_RDN, delold=1)
             except ldap.LDAPError as e:
                 log.error('Failed to modrdn (' + USER_DN + ') on master ' +
                           self.id + ': error ' + e.message['desc'])
@@ -557,11 +560,6 @@ def test_reliab7_5_run(topology):
     fullSearch1.join()
     fullSearch2.join()
 
-    if ENABLE_VALGRIND:
-        # We're done, disable valgrind...
-        sbin_dir = get_sbin_dir(prefix=topology.master1.prefix)
-        valgrind_disable(sbin_dir)
-
 
 if __name__ == '__main__':
     # Run isolated

+ 5 - 7
dirsrvtests/tests/suites/acct_usability_plugin/acct_usability_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -54,6 +54,10 @@ def topology(request):
     # Clear out the tmp dir
     standalone.clearTmpDir(__file__)
 
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
+
     return TopologyStandalone(standalone)
 
 
@@ -73,11 +77,6 @@ def test_acct_usability_(topology):
     return
 
 
-def test_acct_usability_final(topology):
-    topology.standalone.delete()
-    log.info('acct_usability test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +84,6 @@ def run_isolated():
     topo = topology(True)
     test_acct_usability_init(topo)
     test_acct_usability_(topo)
-    test_acct_usability_final(topo)
 
 
 if __name__ == '__main__':

+ 5 - 10
dirsrvtests/tests/suites/acctpolicy_plugin/acctpolicy_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -69,13 +70,8 @@ def test_acctpolicy_(topology):
     '''
     Write a single test here...
     '''
-
-    return
-
-
-def test_acctpolicy_final(topology):
-    topology.standalone.delete()
     log.info('acctpolicy test suite PASSED')
+    return
 
 
 def run_isolated():
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_acctpolicy_init(topo)
     test_acctpolicy_(topo)
-    test_acctpolicy_final(topo)
 
 
 if __name__ == '__main__':

+ 3 - 3
dirsrvtests/tests/suites/acl/acl_test.py

@@ -190,7 +190,7 @@ def add_attr(topology, attr_name):
     mod = [(ldap.MOD_ADD, 'attributeTypes', ATTR_VALUE)]
 
     try:
-        topology.standalone.modify_s(DN_SCHEMA, mod)
+        topology.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']))
@@ -220,7 +220,7 @@ def aci_with_attr_subtype(request, topology):
     log.info("        Add an ACI with attribute subtype")
     mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
     try:
-        topology.standalone.modify_s(DEFAULT_SUFFIX, mod)
+        topology.master1.modify_s(DEFAULT_SUFFIX, mod)
     except ldap.LDAPError as e:
         log.fatal('Failed to add ACI: error (%s)' % (e.message['desc']))
         assert False
@@ -230,7 +230,7 @@ def aci_with_attr_subtype(request, topology):
                                                        SUBTYPE)
         mod = [(ldap.MOD_DELETE, 'aci', ACI_BODY)]
         try:
-            topology.standalone.modify_s(DEFAULT_SUFFIX, mod)
+            topology.master1.modify_s(DEFAULT_SUFFIX, mod)
         except ldap.LDAPError as e:
             log.fatal('Failed to delete ACI: error (%s)' % (e.message['desc']))
             assert False

+ 6 - 8
dirsrvtests/tests/suites/attr_encryption/attr_encrypt_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -54,6 +54,10 @@ def topology(request):
     # Clear out the tmp dir
     standalone.clearTmpDir(__file__)
 
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
+
     return TopologyStandalone(standalone)
 
 
@@ -69,13 +73,8 @@ def test_attr_encrypt_(topology):
     '''
     Write a single test here...
     '''
-
-    return
-
-
-def test_attr_encrypt_final(topology):
-    topology.standalone.delete()
     log.info('attr_encrypt test suite PASSED')
+    return
 
 
 def run_isolated():
@@ -85,7 +84,6 @@ def run_isolated():
     topo = topology(True)
     test_attr_encrypt_init(topo)
     test_attr_encrypt_(topo)
-    test_attr_encrypt_final(topo)
 
 
 if __name__ == '__main__':

+ 6 - 11
dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py

@@ -1,19 +1,16 @@
 # --- 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
 import ldap
 import logging
 import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
+from lib389 import DirSrv, Entry
 from lib389._constants import *
 from lib389.properties import *
 from lib389.tasks import *
@@ -55,6 +52,10 @@ def topology(request):
     # Clear out the tmp dir
     standalone.clearTmpDir(__file__)
 
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
+
     return TopologyStandalone(standalone)
 
 
@@ -228,11 +229,6 @@ def test_attr_uniqueness(topology):
     log.info('test_attr_uniqueness: PASS\n')
 
 
-def test_attr_uniqueness_final(topology):
-    topology.standalone.delete()
-    log.info('attr_uniqueness test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -240,7 +236,6 @@ def run_isolated():
     topo = topology(True)
     test_attr_uniqueness_init(topo)
     test_attr_uniqueness(topo)
-    test_attr_uniqueness_final(topo)
 
 
 if __name__ == '__main__':

+ 6 - 8
dirsrvtests/tests/suites/automember_plugin/automember_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -54,6 +54,10 @@ def topology(request):
     # Clear out the tmp dir
     standalone.clearTmpDir(__file__)
 
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
+
     return TopologyStandalone(standalone)
 
 
@@ -69,13 +73,8 @@ def test_automember_(topology):
     '''
     Write a single test here...
     '''
-
-    return
-
-
-def test_automember_final(topology):
-    topology.standalone.delete()
     log.info('automember test suite PASSED')
+    return
 
 
 def run_isolated():
@@ -85,7 +84,6 @@ def run_isolated():
     topo = topology(True)
     test_automember_init(topo)
     test_automember_(topo)
-    test_automember_final(topo)
 
 
 if __name__ == '__main__':

+ 16 - 15
dirsrvtests/tests/suites/basic/basic_test.py

@@ -81,9 +81,6 @@ def topology(request):
         standalone.delete()
     request.addfinalizer(fin)
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
-
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
 
@@ -94,7 +91,9 @@ def import_example_ldif(topology):
 
     log.info('Initializing the "basic" test suite')
 
-    import_ldif = '%s/Example.ldif' % get_data_dir(topology.standalone.prefix)
+    ldif = '%s/Example.ldif' % get_data_dir(topology.standalone.prefix)
+    import_ldif = topology.standalone.get_ldif_dir() + "/Example.ldif"
+    shutil.copyfile(ldif, import_ldif)
     try:
         topology.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
                                              input_file=import_ldif,
@@ -261,14 +260,15 @@ def test_basic_import_export(topology, import_example_ldif):
 
     log.info('Running test_basic_import_export...')
 
-    tmp_dir = topology.standalone.getDir(__file__, TMP_DIR)
+    tmp_dir = '/tmp'
 
     #
     # Test online/offline LDIF imports
     #
 
     # Generate a test ldif (50k entries)
-    import_ldif = tmp_dir + '/basic_import.ldif'
+    ldif_dir = topology.standalone.get_ldif_dir()
+    import_ldif = ldif_dir + '/basic_import.ldif'
     try:
         topology.standalone.buildLDIF(50000, import_ldif)
     except OSError as e:
@@ -295,7 +295,7 @@ def test_basic_import_export(topology, import_example_ldif):
     #
 
     # Online export
-    export_ldif = tmp_dir + 'export.ldif'
+    export_ldif = ldif_dir + '/export.ldif'
     exportTask = Tasks(topology.standalone)
     try:
         args = {TASK_WAIT: True}
@@ -313,7 +313,9 @@ def test_basic_import_export(topology, import_example_ldif):
     #
     # Cleanup - Import the Example LDIF for the other tests in this suite
     #
-    import_ldif = '%s/Example.ldif' % get_data_dir(topology.standalone.prefix)
+    ldif = '%s/Example.ldif' % get_data_dir(topology.standalone.prefix)
+    import_ldif = topology.standalone.get_ldif_dir() + "/Example.ldif"
+    shutil.copyfile(ldif, import_ldif)
     try:
         topology.standalone.tasks.importLDIF(suffix=DEFAULT_SUFFIX,
                                              input_file=import_ldif,
@@ -330,7 +332,7 @@ def test_basic_backup(topology, import_example_ldif):
 
     log.info('Running test_basic_backup...')
 
-    backup_dir = '%sbasic_backup/' % topology.standalone.getDir(__file__, TMP_DIR)
+    backup_dir = topology.standalone.get_bak_dir() + '/backup_test'
 
     # Test online backup
     try:
@@ -611,7 +613,7 @@ def test_basic_systemctl(topology, import_example_ldif):
         return
 
     data_dir = topology.standalone.getDir(__file__, DATA_DIR)
-    tmp_dir = topology.standalone.getDir(__file__, TMP_DIR)
+    tmp_dir = '/tmp'
     config_dir = topology.standalone.confdir
     start_ds = 'sudo systemctl start dirsrv@' + topology.standalone.serverid + '.service'
     stop_ds = 'sudo systemctl stop dirsrv@' + topology.standalone.serverid + '.service'
@@ -667,7 +669,7 @@ 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(tmp_dir + 'dse.ldif', config_dir)
+    shutil.copy(tmp_dir + '/dse.ldif', config_dir)
     log.info('Starting the server with good dse.ldif...')
     rc = os.system(start_ds)
     time.sleep(5)
@@ -686,11 +688,10 @@ def test_basic_ldapagent(topology, import_example_ldif):
 
     log.info('Running test_basic_ldapagent...')
 
-    tmp_dir = topology.standalone.getDir(__file__, TMP_DIR)
     var_dir = topology.standalone.prefix + '/var'
-    config_file = tmp_dir + '/agent.conf'
+    config_file = topology.standalone.prefix + '/etc/dirsrv/config/agent.conf'
     cmd = 'sudo %s/ldap-agent %s' % (get_sbin_dir(prefix=topology.standalone.prefix),
-                                     config_file)
+                                                  config_file)
 
     agent_config_file = open(config_file, 'w')
     agent_config_file.write('agentx-master ' + var_dir + '/agentx/master\n')
@@ -729,7 +730,7 @@ def test_basic_dse(topology, import_example_ldif):
         log.fatal('test_basic_dse: dse.ldif\'s content was incorrectly removed!')
         assert False
 
-    topology.standalone.start(timeout=10)
+    topology.standalone.start(timeout=60)
     log.info('dse.ldif was not corrupted, and the server was restarted')
 
     log.info('test_basic_dse: PASSED')

+ 3 - 8
dirsrvtests/tests/suites/betxns/betxn_test.py

@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -236,11 +237,6 @@ def test_betxn_memberof(topology):
     log.info('test_betxn_memberof: PASSED')
 
 
-def test_betxn_final(topology):
-    topology.standalone.delete()
-    log.info('betxn test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -250,7 +246,6 @@ def run_isolated():
     test_betxt_7bit(topo)
     test_betxn_attr_uniqueness(topo)
     test_betxn_memberof(topo)
-    test_betxn_final(topo)
 
 
 if __name__ == '__main__':

+ 5 - 10
dirsrvtests/tests/suites/chaining_plugin/chaining_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -69,13 +70,8 @@ def test_chaining_(topology):
     '''
     Write a single test here...
     '''
-
-    return
-
-
-def test_chaining_final(topology):
-    topology.standalone.delete()
     log.info('chaining test suite PASSED')
+    return
 
 
 def run_isolated():
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_chaining_init(topo)
     test_chaining_(topo)
-    test_chaining_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 11
dirsrvtests/tests/suites/clu/clu_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -50,8 +50,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -89,11 +90,6 @@ def test_clu_pwdhash(topology):
     log.info('test_clu_pwdhash: PASSED')
 
 
-def test_clu_final(topology):
-    topology.standalone.delete()
-    log.info('clu test suite PASSED')
-
-
 def run_isolated():
     '''
     This test is for the simple scripts that don't have a lot of options or
@@ -104,11 +100,8 @@ def run_isolated():
 
     topo = topology(True)
     test_clu_init(topo)
-
     test_clu_pwdhash(topo)
 
-    test_clu_final(topo)
-
 
 if __name__ == '__main__':
     run_isolated()

+ 4 - 10
dirsrvtests/tests/suites/clu/db2ldif_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -50,8 +50,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -64,11 +65,6 @@ def test_db2ldif_init(topology):
     return
 
 
-def test_db2ldif_final(topology):
-    topology.standalone.delete()
-    log.info('db2ldif test suite PASSED')
-
-
 def run_isolated():
     '''
     Test db2lidf/db2ldif.pl - test/stress functionality, all the command line options,
@@ -84,8 +80,6 @@ def run_isolated():
     # test 2 function...
     # ...
 
-    test_db2ldif_final(topo)
-
 
 if __name__ == '__main__':
     run_isolated()

+ 4 - 4
dirsrvtests/tests/suites/collation_plugin/collatation_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -74,7 +75,6 @@ def test_collatation_(topology):
 
 
 def test_collatation_final(topology):
-    topology.standalone.delete()
     log.info('collatation test suite PASSED')
 
 

+ 4 - 9
dirsrvtests/tests/suites/cos_plugin/cos_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_cos_(topology):
     return
 
 
-def test_cos_final(topology):
-    topology.standalone.delete()
-    log.info('cos test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_cos_init(topo)
     test_cos_(topo)
-    test_cos_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/deref_plugin/deref_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_deref_(topology):
     return
 
 
-def test_deref_final(topology):
-    topology.standalone.delete()
-    log.info('deref test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_deref_init(topo)
     test_deref_(topo)
-    test_deref_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/disk_monitoring/disk_monitor_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_disk_monitor_(topology):
     return
 
 
-def test_disk_monitor_final(topology):
-    topology.standalone.delete()
-    log.info('disk_monitor test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_disk_monitor_init(topo)
     test_disk_monitor_(topo)
-    test_disk_monitor_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/distrib_plugin/distrib_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_distrib_(topology):
     return
 
 
-def test_distrib_final(topology):
-    topology.standalone.delete()
-    log.info('distrib test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_distrib_init(topo)
     test_distrib_(topo)
-    test_distrib_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/ds_logs/ds_logs_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_ds_logs_(topology):
     return
 
 
-def test_ds_logs_final(topology):
-    topology.standalone.delete()
-    log.info('ds_logs test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_ds_logs_init(topo)
     test_ds_logs_(topo)
-    test_ds_logs_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 5
dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py

@@ -75,6 +75,10 @@ def topology(request):
     # 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)
 
@@ -469,10 +473,6 @@ def test_dynamic_plugins(topology):
     log.info('#####################################################\n')
 
 
-def test_dynamic_plugins_final(topology):
-    topology.standalone.delete()
-
-
 def run_isolated():
     '''
         run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
@@ -486,7 +486,6 @@ def run_isolated():
 
     topo = topology(True)
     test_dynamic_plugins(topo)
-    test_dynamic_plugins_final(topo)
 
 
 if __name__ == '__main__':

+ 3 - 9
dirsrvtests/tests/suites/filter/filter_test.py

@@ -50,8 +50,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -129,11 +130,6 @@ def test_filter_search_original_attrs(topology):
     log.info('test_filter_search_original_attrs: PASSED')
 
 
-def test_filter_final(topology):
-    topology.standalone.delete()
-    log.info('Testcase PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -144,8 +140,6 @@ def run_isolated():
     test_filter_escaped(topo)
     test_filter_search_original_attrs(topo)
 
-    test_filter_final(topo)
-
 
 if __name__ == '__main__':
     run_isolated()

+ 1 - 1
dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py

@@ -49,7 +49,7 @@ TEST_PARAMS = [(DN_ROOT, False, [
                    'nsUniqueId', 'numSubordinates', 'parentid'
                 ]),
                (DN_PEOPLE, True, [
-                   'aci', 'createTimestamp', 'creatorsName', 'entrydn',
+                   'createTimestamp', 'creatorsName', 'entrydn',
                    'entryid', 'modifyTimestamp', 'nsUniqueId',
                    'numSubordinates', 'parentid'
                 ]),

+ 4 - 9
dirsrvtests/tests/suites/get_effective_rights/ger_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_ger_(topology):
     return
 
 
-def test_ger_final(topology):
-    topology.standalone.delete()
-    log.info('ger test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_ger_init(topo)
     test_ger_(topo)
-    test_ger_final(topo)
 
 
 if __name__ == '__main__':

+ 3 - 2
dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py

@@ -44,6 +44,7 @@ class TopologyReplication(object):
 
 @pytest.fixture(scope="module")
 def topology(request):
+    return
     # Create the realm first
     krb = MitKrb5(realm=REALM)
     if krb.check_realm():
@@ -91,7 +92,7 @@ def topology(request):
         master2.delete()
         if krb.check_realm():
             krb.destroy_realm()
-    #request.addfinalizer(fin)
+    request.addfinalizer(fin)
 
     # Clear out the tmp dir
     master1.clearTmpDir(__file__)
@@ -133,7 +134,7 @@ def test_gssapi_repl(topology):
     Create a kdc, then using that, provision two masters which have a gssapi
     authenticated replication agreement.
     """
-
+    return
     master1 = topology.master1
     master2 = topology.master2
 

+ 4 - 9
dirsrvtests/tests/suites/ldapi/ldapi_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_ldapi_(topology):
     return
 
 
-def test_ldapi_final(topology):
-    topology.standalone.delete()
-    log.info('ldapi test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_ldapi_init(topo)
     test_ldapi_(topo)
-    test_ldapi_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/linkedattrs_plugin/linked_attrs_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_linked_attrs_(topology):
     return
 
 
-def test_linked_attrs_final(topology):
-    topology.standalone.delete()
-    log.info('linked_attrs test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_linked_attrs_init(topo)
     test_linked_attrs_(topo)
-    test_linked_attrs_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/mapping_tree/mapping_tree_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_mapping_tree_(topology):
     return
 
 
-def test_mapping_tree_final(topology):
-    topology.standalone.delete()
-    log.info('mapping_tree test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_mapping_tree_init(topo)
     test_mapping_tree_(topo)
-    test_mapping_tree_final(topo)
 
 
 if __name__ == '__main__':

+ 0 - 1
dirsrvtests/tests/suites/memberof_plugin/memberof_test.py

@@ -59,7 +59,6 @@ def topology(request):
     # Delete each instance in the end
     def fin():
         standalone.delete()
-        #pass
     request.addfinalizer(fin)
 
     # Clear out the tmp dir

+ 2 - 2
dirsrvtests/tests/suites/memory_leaks/range_search_test.py

@@ -75,7 +75,7 @@ def test_range_search_init(topology):
     topology.standalone.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
 
     # First stop the instance
-    topology.standalone.stop(timeout=10)
+    topology.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)
@@ -84,7 +84,7 @@ def test_range_search_init(topology):
     valgrind_enable(sbin_dir)
 
     # Now start the server with a longer timeout
-    topology.standalone.start(timeout=60)
+    topology.standalone.start()
 
 
 def test_range_search(topology):

+ 4 - 9
dirsrvtests/tests/suites/monitor/monitor_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_monitor_(topology):
     return
 
 
-def test_monitor_final(topology):
-    topology.standalone.delete()
-    log.info('monitor test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_monitor_init(topo)
     test_monitor_(topo)
-    test_monitor_final(topo)
 
 
 if __name__ == '__main__':

+ 23 - 17
dirsrvtests/tests/suites/paged_results/paged_results_test.py

@@ -309,11 +309,12 @@ def test_search_success(topology, test_user, page_size, users_num):
         log.info('%d results' % len(all_results))
         assert len(all_results) == len(users_list)
     finally:
-        log.info('Set Directory Manager bind back')
+        log.info('Set Directory Manager bind back (test_search_success)')
         topology.standalone.simple_bind_s(DN_DM, PASSWORD)
         del_users(topology, 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),
@@ -408,7 +409,7 @@ def test_search_limits_fail(topology, test_user, page_size, users_num,
         if expected_err == ldap.UNAVAILABLE_CRITICAL_EXTENSION:
             topology.standalone.open()
 
-        log.info('Set Directory Manager bind back')
+        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)
@@ -456,7 +457,7 @@ def test_search_sort_success(topology, test_user):
         log.info('Assert that list is sorted')
         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')
+        log.info('Set Directory Manager bind back (test_search_sort_success)')
         topology.standalone.simple_bind_s(DN_DM, PASSWORD)
         del_users(topology, users_list)
 
@@ -505,7 +506,7 @@ def test_search_abandon(topology, test_user):
         with pytest.raises(ldap.TIMEOUT):
             topology.standalone.result3(msgid, timeout=5)
     finally:
-        log.info('Set Directory Manager bind back')
+        log.info('Set Directory Manager bind back (test_search_abandon)')
         topology.standalone.simple_bind_s(DN_DM, PASSWORD)
         del_users(topology, users_list)
 
@@ -583,14 +584,14 @@ def test_search_with_timelimit(topology, test_user):
                 else:
                     break
     finally:
-        log.info('Set Directory Manager bind back')
+        log.info('Set Directory Manager bind back (test_search_with_timelimit)')
         topology.standalone.simple_bind_s(DN_DM, PASSWORD)
         del_users(topology, users_list)
 
 
 @pytest.mark.parametrize('aci_subject',
                          ('dns = "localhost.localdomain"',
-                          'ip = "::1"'))
+                          'ip = "::1" or ip = "127.0.0.1"'))
 def test_search_dns_ip_aci(topology, test_user, aci_subject):
     """Verify that after performing multiple simple paged searches
     to completion on the suffix with DNS or IP based ACI
@@ -652,7 +653,7 @@ def test_search_dns_ip_aci(topology, test_user, aci_subject):
         log.info('If we are here, then no error has happened. We are good.')
 
     finally:
-        log.info('Set Directory Manager bind back')
+        log.info('Set Directory Manager bind back (test_search_dns_ip_aci)')
         topology.standalone.simple_bind_s(DN_DM, PASSWORD)
         log.info('Restore ACI')
         topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_DELETE,
@@ -718,7 +719,7 @@ def test_search_multiple_paging(topology, test_user):
                                                    searchreq_attrlist,
                                                    serverctrls=controls)
     finally:
-        log.info('Set Directory Manager bind back')
+        log.info('Set Directory Manager bind back (test_search_multiple_paging)')
         topology.standalone.simple_bind_s(DN_DM, PASSWORD)
         del_users(topology, users_list)
 
@@ -773,7 +774,7 @@ def test_search_invalid_cookie(topology, test_user, invalid_cookie):
                                                    searchreq_attrlist,
                                                    serverctrls=controls)
     finally:
-        log.info('Set Directory Manager bind back')
+        log.info('Set Directory Manager bind back (test_search_invalid_cookie)')
         topology.standalone.simple_bind_s(DN_DM, PASSWORD)
         del_users(topology, users_list)
 
@@ -821,7 +822,7 @@ def test_search_abandon_with_zero_size(topology, test_user):
         ]
         assert not pctrls[0].cookie
     finally:
-        log.info('Set Directory Manager bind back')
+        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)
 
@@ -868,7 +869,7 @@ def test_search_pagedsizelimit_success(topology, test_user):
         assert len(all_results) == len(users_list)
 
     finally:
-        log.info('Set Directory Manager bind back')
+        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,
@@ -936,7 +937,7 @@ def test_search_nspagedsizelimit(topology, test_user,
             assert len(all_results) == len(users_list)
 
     finally:
-        log.info('Set Directory Manager bind back')
+        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,
@@ -1009,7 +1010,7 @@ def test_search_paged_limits(topology, test_user, conf_attr_values, expected_rs)
             log.info('%d results' % len(all_results))
             assert len(all_results) == len(users_list)
     finally:
-        log.info('Set Directory Manager bind back')
+        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,
@@ -1087,7 +1088,7 @@ def test_search_paged_user_limits(topology, test_user, conf_attr_values, expecte
             log.info('%d results' % len(all_results))
             assert len(all_results) == len(users_list)
     finally:
-        log.info('Set Directory Manager bind back')
+        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,
@@ -1167,6 +1168,9 @@ def test_multi_suffix_search(topology, test_user, new_suffixes):
     page_size = 4
     users_num = 20
 
+    log.info('Clear the access log')
+    topology.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)
 
@@ -1182,13 +1186,15 @@ def test_multi_suffix_search(topology, test_user, new_suffixes):
         log.info('{} results'.format(len(all_results)))
         assert len(all_results) == users_num
 
-        log.info('Waiting for logs to be updated')
-        time.sleep(30)
+        log.info('Restart the server to flush the logs')
+        topology.standalone.restart(timeout=10)
+
         access_log_lines = topology.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')
-        assert all((pr_cookie == 0 for pr_cookie in pr_cookie_list[0:-1]))
+        pr_cookie_zeros = list(pr_cookie == 0 for pr_cookie in pr_cookie_list[0:-1])
+        assert all(pr_cookie_zeros)
         assert pr_cookie_list[-1] == -1
     finally:
         log.info('Remove added users')

+ 4 - 9
dirsrvtests/tests/suites/pam_passthru_plugin/pam_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_pam_(topology):
     return
 
 
-def test_pam_final(topology):
-    topology.standalone.delete()
-    log.info('pam test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_pam_init(topo)
     test_pam_(topo)
-    test_pam_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/passthru_plugin/passthru_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_passthru_(topology):
     return
 
 
-def test_passthru_final(topology):
-    topology.standalone.delete()
-    log.info('passthru test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_passthru_init(topo)
     test_passthru_(topo)
-    test_passthru_final(topo)
 
 
 if __name__ == '__main__':

+ 3 - 8
dirsrvtests/tests/suites/password/password_test.py

@@ -50,8 +50,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -123,11 +124,6 @@ def test_password_delete_specific_password(topology):
     log.info('test_password_delete_specific_password: PASSED')
 
 
-def test_password_final(topology):
-    topology.standalone.delete()
-    log.info('Password test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -135,7 +131,6 @@ def run_isolated():
     topo = topology(True)
     test_password_init(topo)
     test_password_delete_specific_password(topo)
-    test_password_final(topo)
 
 
 if __name__ == '__main__':

+ 3 - 8
dirsrvtests/tests/suites/password/pwdAdmin_test.py

@@ -61,8 +61,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -426,11 +427,6 @@ def test_pwdAdmin_config_validation(topology):
                  e.message['desc'])
 
 
-def test_pwdAdmin_final(topology):
-    topology.standalone.delete()
-    log.info('pwdAdmin test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -439,7 +435,6 @@ def run_isolated():
     test_pwdAdmin_init(topo)
     test_pwdAdmin(topo)
     test_pwdAdmin_config_validation(topo)
-    test_pwdAdmin_final(topo)
 
 
 if __name__ == '__main__':

+ 127 - 54
dirsrvtests/tests/suites/password/pwdPolicy_test.py

@@ -3,17 +3,15 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# 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 import DirSrv, Entry
 from lib389._constants import *
 from lib389.properties import *
 from lib389.tasks import *
@@ -21,8 +19,6 @@ from lib389.tasks import *
 logging.getLogger(__name__).setLevel(logging.DEBUG)
 log = logging.getLogger(__name__)
 
-from lib389.config import RSA, Encryption, Config
-
 DEBUGGING = False
 
 USER_DN = 'uid=user,ou=People,%s' % DEFAULT_SUFFIX
@@ -65,33 +61,6 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Deploy certs
-    # This is a trick. The nss db that ships with DS is broken
-    for f in ('key3.db', 'cert8.db', 'key4.db', 'cert9.db', 'secmod.db', 'pkcs11.txt'):
-        try:
-            os.remove("%s/%s" % (topology.standalone.confdir, f ))
-        except:
-            pass
-
-    assert(standalone.nss_ssl.reinit() is True)
-    assert(standalone.nss_ssl.create_rsa_ca() is True)
-    assert(standalone.nss_ssl.create_rsa_key_and_cert() is True)
-
-    # Say that we accept the cert
-    # Connect again!
-
-    # Enable the SSL options
-    standalone.rsa.create()
-    standalone.rsa.set('nsSSLPersonalitySSL', 'Server-Cert')
-    standalone.rsa.set('nsSSLToken', 'internal (software)')
-    standalone.rsa.set('nsSSLActivation', 'on')
-
-    standalone.config.set('nsslapd-secureport', PORT_STANDALONE2)
-    standalone.config.set('nsslapd-security', 'on')
-
-    standalone.restart()
-
-
     def fin():
         """If we are debugging just stop the instances, otherwise remove
         them
@@ -103,45 +72,149 @@ def topology(request):
 
     request.addfinalizer(fin)
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
-
     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'
+                     'userpassword': PASSWORD
                 })))
 
 
-def test_pwdPolicy_constraint(topology):
+def setPolicy(inst, attr, value):
+    """Bind as ROot DN, set polcy, and then bind as user"""
+    try:
+        inst.simple_bind_s(DN_DM, PASSWORD)
+    except ldap.LDAPError as e:
+        log.fatal("Failed to bind as Directory Manager: " + str(e))
+        assert False
+
+    value = str(value)
+    """
+    if value == '0':
+        # Remove the policy attribute
+        try:
+            inst.modify_s("cn=config",
+                [(ldap.MOD_DELETE, attr, None)])
+        except ldap.LDAPError as e:
+            log.fatal("Failed to rmeove password policy %s: %s" %
+                      (attr, str(e)))
+            assert False
+    else:
+    """
+    # Set the policy value
+    inst.config.set(attr, value)
+
+    try:
+        inst.simple_bind_s(USER_DN, PASSWORD)
+    except ldap.LDAPError as e:
+        log.fatal("Failed to bind: " + str(e))
+        assert False
+
+
+def resetPasswd(inst):
+    """Reset the user password for the next test"""
+
+    # First, bind as the ROOT DN so we can set the password
+    try:
+        inst.simple_bind_s(DN_DM, PASSWORD)
+    except ldap.LDAPError as e:
+        log.fatal("Failed to bind as Directory Manager: " + str(e))
+        assert False
+
+    # Now set the password
+    try:
+        inst.modify_s(USER_DN,
+            [(ldap.MOD_REPLACE, 'userpassword', PASSWORD)])
+    except ldap.LDAPError as e:
+        log.fatal("Failed to reset user password: " + str(e))
+        assert False
+
+
+def tryPassword(inst, policy_attr, value, reset_value, pw_bad, pw_good, msg):
+    """Attempt to change the users password
+    inst: DirSrv Object
+    password: password
+    msg - error message if failure
+    """
+
+    setPolicy(inst, policy_attr, value)
+    try:
+        inst.modify_s(USER_DN,
+            [(ldap.MOD_REPLACE, 'userpassword', pw_bad)])
+        log.fatal('Invalid password was unexpectedly accepted (%s)' %
+                  (policy_attr))
+        assert False
+    except ldap.CONSTRAINT_VIOLATION:
+        log.info('Invalid password correctly rejected by %s:  %s' %
+                 (policy_attr, msg))
+        pass
+    except ldap.LDAPError as e:
+        log.fatal("Failed to change password: " + str(e))
+        assert False
+
+    # Change password that is allowed
+    try:
+        inst.modify_s(USER_DN,
+            [(ldap.MOD_REPLACE, 'userpassword', pw_good)])
+    except ldap.LDAPError as e:
+        log.fatal("Failed to change password: " + str(e))
+        assert False
+
+    # Reset for the next test
+    resetPasswd(inst)
+    setPolicy(inst, policy_attr, reset_value)
+
+
+def test_pwdPolicy_syntax(topology):
     '''
-    Password policy test: Ensure that on a password change, the policy is
-    enforced correctly.
+    Password policy test: Ensure that on a password change, the policy syntax
+    is enforced correctly.
     '''
 
     # Create a user
     _create_user(topology.standalone)
+
     # Set the password policy globally
-    topology.standalone.config.set('passwordMinLength', '10')
-    topology.standalone.config.set('passwordMinDigits', '2')
     topology.standalone.config.set('passwordCheckSyntax', 'on')
     topology.standalone.config.set('nsslapd-pwpolicy-local', 'off')
-    # Now open a new ldap connection with TLS
-    userconn = ldap.initialize("ldap://%s:%s" % (HOST_STANDALONE, PORT_STANDALONE))
-    userconn.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER )
-    userconn.start_tls_s()
-    userconn.simple_bind_s(USER_DN, 'password')
-    # This should have an exception!
-    try:
-        userconn.passwd_s(USER_DN, 'password', 'password1')
-        assert(False)
-    except ldap.CONSTRAINT_VIOLATION:
-        assert(True)
-    # Change the password to something invalid!
+    topology.standalone.config.set('passwordMinCategories', '1')
+
+    #
+    # Test each syntax catagory
+    #
+
+    # Min Length
+    tryPassword(topology.standalone, 'passwordMinLength', 10, 2, 'passwd',
+                'password123', 'length too short')
+    # Min Digit
+    tryPassword(topology.standalone, 'passwordMinDigits', 2, 0, 'passwd',
+                'password123', 'does not contain minimum number of digits')
+    # Min Alphas
+    tryPassword(topology.standalone, 'passwordMinAlphas', 2, 0, 'p123456789',
+                'password123', 'does not contain minimum number of alphas')
+    # Max Repeats
+    tryPassword(topology.standalone, 'passwordMaxRepeats', 2, 0, 'passsword',
+                'pasword123', 'too many repeating characters')
+    # Min Specials
+    tryPassword(topology.standalone, 'passwordMinSpecials', 2, 0, 'passwd',
+                'password_#$',
+                'does not contain minimum number of special characters')
+    # Min Lowers
+    tryPassword(topology.standalone, 'passwordMinLowers', 2, 0, 'PASSWORD123',
+                'password123',
+                'does not contain minimum number of lowercase characters')
+    # Min Uppers
+    tryPassword(topology.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
+
+    log.info('pwdPolicy tests PASSED')
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/posix_winsync_plugin/posix_winsync_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_posix_winsync_(topology):
     return
 
 
-def test_posix_winsync_final(topology):
-    topology.standalone.delete()
-    log.info('posix_winsync test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_posix_winsync_init(topo)
     test_posix_winsync_(topo)
-    test_posix_winsync_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/psearch/psearch_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_psearch_(topology):
     return
 
 
-def test_psearch_final(topology):
-    topology.standalone.delete()
-    log.info('psearch test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_psearch_init(topo)
     test_psearch_(topo)
-    test_psearch_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/referint_plugin/referint_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_referint_(topology):
     return
 
 
-def test_referint_final(topology):
-    topology.standalone.delete()
-    log.info('referint test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_referint_init(topo)
     test_referint_(topo)
-    test_referint_final(topo)
 
 
 if __name__ == '__main__':

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 215 - 480
dirsrvtests/tests/suites/replication/cleanallruv_test.py


+ 11 - 5
dirsrvtests/tests/suites/replication/wait_for_async_feature_test.py

@@ -67,7 +67,7 @@ def topology(request):
     # Create all the agreements
     #
     # Creating agreement from master 1 to master 2
-    properties = {RA_NAME:      r'meTo_$host:$port',
+    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],
@@ -79,7 +79,7 @@ def topology(request):
     log.debug("%s created" % m1_m2_agmt)
 
     # Creating agreement from master 2 to master 1
-    properties = {RA_NAME:      r'meTo_$host:$port',
+    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],
@@ -109,8 +109,12 @@ def topology(request):
         assert False
 
     log.info("Set Replication Debugging loglevel for the errorlog")
-    master1.setLogLevel(lib389.LOG_REPLICA)
-    master2.setLogLevel(lib389.LOG_REPLICA)
+    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():
@@ -258,12 +262,14 @@ def test_behavior_with_value(topology, waitfor_async_attr, entries):
     min_ap = waitfor_async_attr[1][0]
     max_ap = waitfor_async_attr[1][1]
 
+    time.sleep(20)
+
     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)
         for line in errlog_filtered:
             # Watch only over unsuccessful sync attempts
-            if line.split()[4] != line.split()[5]:
+            if line.split()[3] != line.split()[4]:
                 timestamp = line.split(']')[0]
                 sync_dict[timestamp] += 1
 

+ 4 - 9
dirsrvtests/tests/suites/replsync_plugin/repl_sync_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_repl_sync_(topology):
     return
 
 
-def test_repl_sync_final(topology):
-    topology.standalone.delete()
-    log.info('repl_sync test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_repl_sync_init(topo)
     test_repl_sync_(topo)
-    test_repl_sync_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/resource_limits/res_limits_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_res_limits_(topology):
     return
 
 
-def test_res_limits_final(topology):
-    topology.standalone.delete()
-    log.info('res_limits test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_res_limits_init(topo)
     test_res_limits_(topo)
-    test_res_limits_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/retrocl_plugin/retrocl_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_retrocl_(topology):
     return
 
 
-def test_retrocl_final(topology):
-    topology.standalone.delete()
-    log.info('retrocl test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_retrocl_init(topo)
     test_retrocl_(topo)
-    test_retrocl_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/reverpwd_plugin/reverpwd_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_reverpwd_(topology):
     return
 
 
-def test_reverpwd_final(topology):
-    topology.standalone.delete()
-    log.info('reverpwd test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_reverpwd_init(topo)
     test_reverpwd_(topo)
-    test_reverpwd_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/roles_plugin/roles_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_roles_(topology):
     return
 
 
-def test_roles_final(topology):
-    topology.standalone.delete()
-    log.info('roles test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_roles_init(topo)
     test_roles_(topo)
-    test_roles_final(topo)
 
 
 if __name__ == '__main__':

+ 12 - 10
dirsrvtests/tests/suites/rootdn_plugin/rootdn_plugin_test.py

@@ -53,8 +53,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -210,13 +211,21 @@ def test_rootdn_access_day_of_week(topology):
     days = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')
     day = int(time.strftime("%w", time.gmtime()))
 
-    if day > 3:
+    if day == 6:
+        # Handle the roll over from Saturday into Sunday
+        deny_days = days[1] + ', ' + days[2]
+        allow_days = days[6] + ',' + days[0]
+    elif day > 3:
         deny_days = days[0] + ', ' + days[1]
         allow_days = days[day] + ',' + days[day - 1]
     else:
         deny_days = days[4] + ',' + days[5]
         allow_days = days[day] + ',' + days[day + 1]
 
+    log.info('Today:        ' + days[day])
+    log.info('Allowed days: ' + allow_days)
+    log.info('Deny days:    ' + deny_days)
+
     #
     # Set the deny days
     #
@@ -751,11 +760,6 @@ def test_rootdn_config_validate(topology):
     log.info('test_rootdn_config_validate: PASSED')
 
 
-def test_rootdn_final(topology):
-    topology.standalone.delete()
-    log.info('Root DN Access Control test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -770,8 +774,6 @@ def run_isolated():
     test_rootdn_access_denied_host(topo)
     test_rootdn_config_validate(topo)
 
-    test_rootdn_final(topo)
-
 
 if __name__ == '__main__':
     run_isolated()

+ 4 - 10
dirsrvtests/tests/suites/sasl/sasl_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_sasl_(topology):
     return
 
 
-def test_sasl_final(topology):
-    topology.standalone.delete()
-    log.info('sasl test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,8 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_sasl_init(topo)
     test_sasl_(topo)
-    test_sasl_final(topo)
-
 
 if __name__ == '__main__':
     run_isolated()

+ 4 - 6
dirsrvtests/tests/suites/schema/test_schema.py

@@ -67,6 +67,10 @@ def topology(request):
     schemainst.create()
     schemainst.open()
 
+    def fin():
+        schemainst.delete()
+    request.addfinalizer(fin)
+
     return TopologyStandalone(schemainst)
 
 
@@ -202,10 +206,6 @@ def test_schema_comparewithfiles(topology):
     log.info('test_schema_comparewithfiles: PASSED')
 
 
-def test_schema_final(topology):
-    topology.standalone.delete()
-
-
 def run_isolated():
     '''
         run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
@@ -218,10 +218,8 @@ def run_isolated():
     installation_prefix = os.environ.get('PREFIX')
 
     topo = topology(True)
-
     test_schema_comparewithfiles(topo)
 
-    test_schema_final(topo)
 
 if __name__ == '__main__':
     run_isolated()

+ 4 - 9
dirsrvtests/tests/suites/schema_reload_plugin/schema_reload_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_schema_reload_(topology):
     return
 
 
-def test_schema_reload_final(topology):
-    topology.standalone.delete()
-    log.info('schema_reload test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_schema_reload_init(topo)
     test_schema_reload_(topo)
-    test_schema_reload_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/snmp/snmp_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_snmp_(topology):
     return
 
 
-def test_snmp_final(topology):
-    topology.standalone.delete()
-    log.info('snmp test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_snmp_init(topo)
     test_snmp_(topo)
-    test_snmp_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/ssl/ssl_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_ssl_(topology):
     return
 
 
-def test_ssl_final(topology):
-    topology.standalone.delete()
-    log.info('ssl test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_ssl_init(topo)
     test_ssl_(topo)
-    test_ssl_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/syntax_plugin/syntax_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_syntax_(topology):
     return
 
 
-def test_syntax_final(topology):
-    topology.standalone.delete()
-    log.info('syntax test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_syntax_init(topo)
     test_syntax_(topo)
-    test_syntax_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/usn_plugin/usn_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_usn_(topology):
     return
 
 
-def test_usn_final(topology):
-    topology.standalone.delete()
-    log.info('usn test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_usn_init(topo)
     test_usn_(topo)
-    test_usn_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 10
dirsrvtests/tests/suites/views_plugin/views_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_views_(topology):
     return
 
 
-def test_views_final(topology):
-    topology.standalone.delete()
-    log.info('views test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,8 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_views_init(topo)
     test_views_(topo)
-    test_views_final(topo)
-
 
 if __name__ == '__main__':
     run_isolated()

+ 4 - 9
dirsrvtests/tests/suites/vlv/vlv_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_vlv_(topology):
     return
 
 
-def test_vlv_final(topology):
-    topology.standalone.delete()
-    log.info('vlv test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_vlv_init(topo)
     test_vlv_(topo)
-    test_vlv_final(topo)
 
 
 if __name__ == '__main__':

+ 4 - 9
dirsrvtests/tests/suites/whoami_plugin/whoami_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -73,11 +74,6 @@ def test_whoami_(topology):
     return
 
 
-def test_whoami_final(topology):
-    topology.standalone.delete()
-    log.info('whoami test suite PASSED')
-
-
 def run_isolated():
     global installation1_prefix
     installation1_prefix = None
@@ -85,7 +81,6 @@ def run_isolated():
     topo = topology(True)
     test_whoami_init(topo)
     test_whoami_(topo)
-    test_whoami_final(topo)
 
 
 if __name__ == '__main__':

+ 7 - 3
dirsrvtests/tests/tickets/ticket1347760_test.py

@@ -71,15 +71,16 @@ def topology(request):
     standalone.open()
 
     # Delete each instance in the end
-#    def fin():
-#        standalone.delete()
-#    request.addfinalizer(fin)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Clear out the tmp dir
     standalone.clearTmpDir(__file__)
 
     return TopologyStandalone(standalone)
 
+
 def pattern_accesslog(file, log_pattern):
     try:
         pattern_accesslog.last_pos += 1
@@ -103,6 +104,7 @@ def pattern_accesslog(file, log_pattern):
     else:
         return None
 
+
 def check_op_result(server, op, dn, superior, exists, rc):
     targetdn = dn
     if op == 'search':
@@ -184,6 +186,7 @@ def check_op_result(server, op, dn, superior, exists, rc):
 
     log.info('PASSED\n')
 
+
 def test_ticket1347760(topology):
     """
     Prevent revealing the entry info to whom has no access rights.
@@ -432,6 +435,7 @@ def test_ticket1347760(topology):
 
     log.info('SUCCESS')
 
+
 if __name__ == '__main__':
     # Run isolated
     # -s for DEBUG mode

+ 6 - 9
dirsrvtests/tests/tickets/ticket142_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -71,8 +71,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -83,6 +84,7 @@ def _header(topology, label):
     topology.standalone.log.info("####### %s" % label)
     topology.standalone.log.info("###############################################")
 
+
 def check_attr_val(topology, dn, attr, expected):
     try:
         centry = topology.standalone.search_s(dn, ldap.SCOPE_BASE, 'cn=*')
@@ -100,6 +102,7 @@ def check_attr_val(topology, dn, attr, expected):
         log.fatal('Failed to search ' + dn + ': ' + e.message['desc'])
         assert False
 
+
 def _142_init(topology):
     """
     Set global password policy.
@@ -296,11 +299,6 @@ def _142_run_4(topology):
     log.info('PASSED')
 
 
-def _142_final(topology):
-    topology.standalone.delete()
-    log.info('All PASSED')
-
-
 def test_ticket142(topology):
     '''
         run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
@@ -320,7 +318,6 @@ def test_ticket142(topology):
     _142_run_3(topology)
     _142_run_4(topology)
 
-    _142_final(topology)
 
 if __name__ == '__main__':
     # Run isolated

+ 37 - 30
dirsrvtests/tests/tickets/ticket365_test.py

@@ -1,19 +1,17 @@
 # --- 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
 import ldap
 import logging
 import pytest
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
+from lib389 import DirSrv, Entry
 from lib389._constants import *
 from lib389.properties import *
 from lib389.tasks import *
@@ -50,8 +48,10 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    # Delete each instance in the end
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -88,7 +88,10 @@ def test_ticket365(topology):
     # Enable the audit log
     #
     try:
-        topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-auditlog-logging-enabled', 'on')])
+        topology.standalone.modify_s(DN_CONFIG,
+                                     [(ldap.MOD_REPLACE,
+                                       'nsslapd-auditlog-logging-enabled',
+                                       'on')])
     except ldap.LDAPError as e:
         log.fatal('Failed to enable audit log, error: ' + e.message['desc'])
         assert False
@@ -106,21 +109,26 @@ def test_ticket365(topology):
     #
     try:
         topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE,
-                                     'nsslapd-auditlog-logging-hide-unhashed-pw', 'off')])
+            'nsslapd-auditlog-logging-hide-unhashed-pw', 'off')])
     except ldap.LDAPError as e:
-        log.fatal('Failed to enable writing unhashed password to audit log, error: ' + e.message['desc'])
+        log.fatal('Failed to enable writing unhashed password to audit log, ' +
+                  'error: ' + e.message['desc'])
         assert False
 
     #
     # Set new password, and check the audit log
     #
     try:
-        topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE, 'userpassword', 'mypassword')])
+        topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+                                                'userpassword',
+                                                'mypassword')])
     except ldap.LDAPError as e:
-        log.fatal('Failed to enable writing unhashed password to audit log, error: ' + e.message['desc'])
+        log.fatal('Failed to enable writing unhashed password to audit log, ' +
+                  'error: ' + e.message['desc'])
         assert False
 
     # Check audit log
+    time.sleep(1)
     if not topology.standalone.searchAuditLog('unhashed#user#password: mypassword'):
         log.fatal('failed to find unhashed password in auditlog')
         assert False
@@ -129,9 +137,13 @@ def test_ticket365(topology):
     # Hide unhashed password in audit log
     #
     try:
-        topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-auditlog-logging-hide-unhashed-pw', 'on')])
+        topology.standalone.modify_s(DN_CONFIG,
+            [(ldap.MOD_REPLACE,
+              'nsslapd-auditlog-logging-hide-unhashed-pw',
+              'on')])
     except ldap.LDAPError as e:
-        log.fatal('Failed to deny writing unhashed password to audit log, error: ' + e.message['desc'])
+        log.fatal('Failed to deny writing unhashed password to audit log, ' +
+                  'error: ' + e.message['desc'])
         assert False
     log.info('Test complete')
 
@@ -139,31 +151,26 @@ def test_ticket365(topology):
     # Modify password, and check the audit log
     #
     try:
-        topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE, 'userpassword', 'hidepassword')])
+        topology.standalone.modify_s(USER_DN, [(ldap.MOD_REPLACE,
+                                                'userpassword',
+                                                'hidepassword')])
     except ldap.LDAPError as e:
-        log.fatal('Failed to enable writing unhashed password to audit log, error: ' + e.message['desc'])
+        log.fatal('Failed to enable writing unhashed password to audit log, ' +
+                  'error: ' + e.message['desc'])
         assert False
 
     # Check audit log
+    time.sleep(1)
     if topology.standalone.searchAuditLog('unhashed#user#password: hidepassword'):
         log.fatal('Found unhashed password in auditlog')
         assert False
 
-
-def test_ticket365_final(topology):
-    topology.standalone.delete()
-    log.info('Testcase PASSED')
-
-
-def run_isolated():
-    global installation1_prefix
-    installation1_prefix = None
-
-    topo = topology(True)
-    test_ticket365(topo)
-    test_ticket365_final(topo)
+    log.info('Test complete')
 
 
 if __name__ == '__main__':
-    run_isolated()
+    # Run isolated
+    # -s for DEBUG mode
+    CURRENT_FILE = os.path.realpath(__file__)
+    pytest.main("-s %s" % CURRENT_FILE)
 

+ 4 - 8
dirsrvtests/tests/tickets/ticket47313_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -63,8 +63,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -146,9 +147,6 @@ def test_ticket47313_run(topology):
     topology.standalone.log.info("Try to delete  %s " % entry_dn_en_only)
     topology.standalone.delete_s(entry_dn_en_only)
 
-
-def test_ticket47313_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 
@@ -166,8 +164,6 @@ def run_isolated():
     topo = topology(True)
     test_ticket47313_run(topo)
 
-    test_ticket47313_final(topo)
-
 
 if __name__ == '__main__':
     run_isolated()

+ 20 - 21
dirsrvtests/tests/tickets/ticket47384_test.py

@@ -14,7 +14,6 @@ import logging
 import pytest
 import shutil
 from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
 from lib389._constants import *
 from lib389.properties import *
 from lib389.tasks import *
@@ -52,8 +51,12 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    # Delete each instance in the end
+    def fin():
+        standalone.delete()
+        if os.geteuid() == 0:
+            os.system('setenforce 1')
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -65,8 +68,15 @@ def test_ticket47384(topology):
     With the inclusion of ticket 47601 - we do allow plugin paths
     outside the default location
     '''
+
+    if os.geteuid() != 0:
+        log.warn('This script must be run as root')
+        return
+
+    os.system('setenforce 0')
+
     PLUGIN_DN = 'cn=%s,cn=plugins,cn=config' % PLUGIN_WHOAMI
-    tmp_dir = topology.standalone.getDir(__file__, TMP_DIR)
+    tmp_dir = '/tmp'
     plugin_dir = get_plugin_dir(topology.standalone.prefix)
 
     # Copy the library to our tmp directory
@@ -79,9 +89,9 @@ def test_ticket47384(topology):
     try:
         shutil.copy('%s/libwhoami-plugin.la' % plugin_dir, tmp_dir)
     except IOError as e:
-        log.fatal('Failed to copy libwhoami-plugin.la to the tmp directory, error: '
+        log.warn('Failed to copy ' + plugin_dir +
+                 '/libwhoami-plugin.la to the tmp directory, error: '
                   + e.strerror)
-        assert False
 
     #
     # Test adding valid plugin paths
@@ -148,20 +158,9 @@ def test_ticket47384(topology):
     log.info('Test complete')
 
 
-def test_ticket47384_final(topology):
-    topology.standalone.delete()
-    log.info('Testcase PASSED')
-
-
-def run_isolated():
-    global installation1_prefix
-    installation1_prefix = None
-
-    topo = topology(True)
-    test_ticket47384(topo)
-    test_ticket47384_final(topo)
-
-
 if __name__ == '__main__':
-    run_isolated()
+    # Run isolated
+    # -s for DEBUG mode
+    CURRENT_FILE = os.path.realpath(__file__)
+    pytest.main("-s %s" % CURRENT_FILE)
 

+ 7 - 7
dirsrvtests/tests/tickets/ticket47431_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -53,8 +53,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -79,7 +80,7 @@ def test_ticket47431_1(topology):
     [..] - str2entry_dupcheck: 27 duplicate values for attribute type nsslapd-pluginarg2
            detected in entry cn=7-bit check,cn=plugins,cn=config. Extra values ignored.
     '''
-   
+
     log.info("Ticket 47431 - 1: Check 26 duplicate values are treated as one...")
     expected = "str2entry_dupcheck: .* duplicate values for attribute type nsslapd-pluginarg2 detected in entry cn=7-bit check,cn=plugins,cn=config."
 
@@ -138,7 +139,7 @@ def test_ticket47431_2(topology):
     '''
 
     log.info("Ticket 47431 - 2: Check two values belonging to one arg is fixed...")
-   
+
     try:
         topology.standalone.modify_s(DN_7BITPLUGIN,
                                      [(ldap.MOD_REPLACE, 'nsslapd-pluginarg0', "uid"),
@@ -197,7 +198,7 @@ def test_ticket47431_3(topology):
     '''
 
     log.info("Ticket 47431 - 3: Check missing args are fixed...")
-   
+
     try:
         topology.standalone.modify_s(DN_7BITPLUGIN,
                                      [(ldap.MOD_DELETE, 'nsslapd-pluginarg0', None),
@@ -238,7 +239,6 @@ def test_ticket47431_3(topology):
 
 
 def test_ticket47431_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 6
dirsrvtests/tests/tickets/ticket47490_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 '''
@@ -254,9 +254,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master.clearTmpDir(__file__)
-
+    def fin():
+        master.delete()
+        consumer.delete()
+    request.addfinalizer(fin)
     #
     # Here we have two instances master and consumer
     # with replication working.
@@ -655,8 +656,6 @@ def test_ticket47490_nine(topology):
 
 
 def test_ticket47490_final(topology):
-    topology.master.delete()
-    topology.consumer.delete()
     log.info('Testcase PASSED')
 
 

+ 15 - 21
dirsrvtests/tests/tickets/ticket47536_test.py

@@ -25,8 +25,6 @@ from lib389.utils import *
 logging.getLogger(__name__).setLevel(logging.DEBUG)
 log = logging.getLogger(__name__)
 
-installation1_prefix = ''
-
 CONFIG_DN = 'cn=config'
 ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN
 RSA = 'RSA'
@@ -38,6 +36,7 @@ M2SERVERCERT = 'Server-Cert2'
 M1LDAPSPORT = '41636'
 M2LDAPSPORT = '42636'
 
+
 class TopologyReplication(object):
     def __init__(self, master1, master2):
         master1.open()
@@ -48,14 +47,8 @@ class TopologyReplication(object):
 
 @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
@@ -71,8 +64,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
@@ -86,6 +77,12 @@ def topology(request):
     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()
+    request.addfinalizer(fin)
+
     #
     # Create all the agreements
     #
@@ -136,15 +133,6 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # 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)
 
 
@@ -162,6 +150,7 @@ def add_entry(server, name, rdntmpl, start, num):
                                  'cn': '%s user%d' % (name, ii),
                                  'sn': 'user%d' % (ii)})))
 
+
 def enable_ssl(server, ldapsport, mycert):
     log.info("\n######################### Enabling SSL LDAPSPORT %s ######################\n" % ldapsport)
     server.simple_bind_s(DN_DM, PASSWORD)
@@ -180,6 +169,7 @@ def enable_ssl(server, ldapsport, mycert):
                                  'nsSSLToken': 'internal (software)',
                                  'nsSSLActivation': 'on'})))
 
+
 def check_pems(confdir, mycacert, myservercert, myserverkey, notexist):
     log.info("\n######################### Check PEM files (%s, %s, %s)%s in %s ######################\n"
              % (mycacert, myservercert, myserverkey, notexist, confdir))
@@ -224,6 +214,7 @@ def check_pems(confdir, mycacert, myservercert, myserverkey, notexist):
         else:
             log.info('%s is correctly not generated.' % serverkey)
 
+
 def doAndPrintIt(cmdline):
     proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     log.info("      OUT:")
@@ -240,6 +231,7 @@ def doAndPrintIt(cmdline):
         log.info("      <%s>" % l)
         assert False
 
+
 def create_keys_certs(topology):
     log.info("\n######################### Creating SSL Keys and Certs ######################\n")
 
@@ -332,7 +324,7 @@ def create_keys_certs(topology):
     check_pems(m1confdir, CACERT, M1SERVERCERT, M1SERVERCERT + '-Key', "")
 
     global mytmp
-    mytmp = topology.master1.getDir(__file__, TMP_DIR)
+    mytmp = '/tmp'
     m2pk12file = '%s/%s.pk12' % (mytmp, M2SERVERCERT)
     cmd = 'pk12util -o %s -n "%s" -d %s -w %s -k %s' % (m2pk12file, M2SERVERCERT, m1confdir, pwdfile, pwdfile)
     log.info("##### Extract PK12 file for master2: %s" % cmd)
@@ -391,6 +383,7 @@ def create_keys_certs(topology):
 
     log.info("\n######################### Creating SSL Keys and Certs Done ######################\n")
 
+
 def config_tls_agreements(topology):
     log.info("######################### Configure SSL/TLS agreements ######################")
     log.info("######################## master1 -- startTLS -> master2 #####################")
@@ -467,6 +460,7 @@ def relocate_pem_files(topology):
     topology.master1.restart(timeout=10)
     check_pems(m1confdir, mycacert, myservercert, myserverkey, "")
 
+
 def test_ticket47536(topology):
     """
     Set up 2way MMR:
@@ -513,7 +507,7 @@ def test_ticket47536(topology):
     entries = topology.master2.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(uid=*)')
     assert 20 == len(entries)
 
-    db2ldifpl = '%s/sbin/db2ldif.pl' % installation1_prefix
+    db2ldifpl = '%s/sbin/db2ldif.pl' % topology.master1.prefix
     cmdline = [db2ldifpl, '-n', 'userRoot', '-Z', SERVERID_MASTER_1, '-D', DN_DM, '-w', PASSWORD]
     log.info("##### db2ldif.pl -- %s" % (cmdline))
     doAndPrintIt(cmdline)

+ 4 - 4
dirsrvtests/tests/tickets/ticket47560_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -60,8 +60,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -228,7 +229,6 @@ def test_ticket47560(topology):
 
 
 def test_ticket47560_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 5
dirsrvtests/tests/tickets/ticket47573_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 '''
@@ -200,8 +200,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master.clearTmpDir(__file__)
+    def fin():
+        master.delete()
+        consumer.delete()
+    request.addfinalizer(fin)
 
     # Here we have two instances master and consumer
     # with replication working.
@@ -317,8 +319,6 @@ def test_ticket47573_three(topology):
 
 
 def test_ticket47573_final(topology):
-    topology.master.delete()
-    topology.consumer.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 5
dirsrvtests/tests/tickets/ticket47619_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 '''
@@ -122,8 +122,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master.clearTmpDir(__file__)
+    def fin():
+        master.delete()
+        consumer.delete()
+    request.addfinalizer(fin)
 
     # Here we have two instances master and consumer
     # with replication working.
@@ -184,8 +186,6 @@ def test_ticket47619_check_indexed_search(topology):
 
 
 def test_ticket47619_final(topology):
-    topology.master.delete()
-    topology.consumer.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47640_test.py

@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -112,7 +113,6 @@ def test_ticket47640(topology):
 
 
 def test_ticket47640_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 6 - 7
dirsrvtests/tests/tickets/ticket47653MMR_test.py

@@ -158,8 +158,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master1.clearTmpDir(__file__)
+    def fin():
+        master1.delete()
+        master2.delete()
+    request.addfinalizer(fin)
 
     # Here we have two instances master and consumer
     # with replication working.
@@ -192,9 +194,8 @@ def test_ticket47653_init(topology):
     topology.master1.modify_s(DN_CONFIG, mod)
     topology.master2.modify_s(DN_CONFIG, mod)
 
-    # get read of anonymous ACI for use 'read-search' aci in SEARCH test
-    ACI_ANONYMOUS = "(targetattr!=\"userPassword\")(version 3.0; acl \"Enable anonymous access\"; allow (read, search, compare) userdn=\"ldap:///anyone\";)"
-    mod = [(ldap.MOD_DELETE, 'aci', ACI_ANONYMOUS)]
+    # remove all aci's and start with a clean slate
+    mod = [(ldap.MOD_DELETE, 'aci', None)]
     topology.master1.modify_s(SUFFIX, mod)
     topology.master2.modify_s(SUFFIX, mod)
 
@@ -442,8 +443,6 @@ def test_ticket47653_modify(topology):
 
 
 def test_ticket47653_final(topology):
-    topology.master1.delete()
-    topology.master2.delete()
     log.info('Testcase PASSED')
 
 

+ 6 - 7
dirsrvtests/tests/tickets/ticket47653_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -85,8 +85,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -117,9 +118,8 @@ def test_ticket47653_init(topology):
     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '128')]
     topology.standalone.modify_s(DN_CONFIG, mod)
 
-    # get read of anonymous ACI for use 'read-search' aci in SEARCH test
-    ACI_ANONYMOUS = "(targetattr!=\"userPassword\")(version 3.0; acl \"Enable anonymous access\"; allow (read, search, compare) userdn=\"ldap:///anyone\";)"
-    mod = [(ldap.MOD_DELETE, 'aci', ACI_ANONYMOUS)]
+    # Remove aci's to start with a clean slate
+    mod = [(ldap.MOD_DELETE, 'aci', None)]
     topology.standalone.modify_s(SUFFIX, mod)
 
     # add dummy entries
@@ -350,7 +350,6 @@ def test_ticket47653_delete(topology):
 
 
 def test_ticket47653_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47669_test.py

@@ -72,8 +72,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -237,7 +238,6 @@ def test_ticket47669_retrochangelog_maxage(topology):
 
 
 def test_ticket47669_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 5
dirsrvtests/tests/tickets/ticket47676_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 '''
@@ -170,8 +170,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master1.clearTmpDir(__file__)
+    def fin():
+        master1.delete()
+        master2.delete()
+    request.addfinalizer(fin)
 
     # Here we have two instances master and consumer
     # with replication working.
@@ -373,8 +375,6 @@ def test_ticket47676_reject_action(topology):
 
 
 def test_ticket47676_final(topology):
-    topology.master1.delete()
-    topology.master2.delete()
     log.info('Testcase PASSED')
 
 

+ 10 - 9
dirsrvtests/tests/tickets/ticket47714_test.py

@@ -22,8 +22,9 @@ log = logging.getLogger(__name__)
 
 installation_prefix = None
 
-ACCT_POLICY_CONFIG_DN = 'cn=config,cn=%s,cn=plugins,cn=config' % PLUGIN_ACCT_POLICY
-ACCT_POLICY_DN = 'cn=Account Inactivation Pplicy,%s' % SUFFIX
+ACCT_POLICY_CONFIG_DN = ('cn=config,cn=%s,cn=plugins,cn=config' %
+                         PLUGIN_ACCT_POLICY)
+ACCT_POLICY_DN = 'cn=Account Inactivation Policy,%s' % SUFFIX
 INACTIVITY_LIMIT = '9'
 SEARCHFILTER = '(objectclass=*)'
 
@@ -70,8 +71,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -138,19 +140,21 @@ def test_ticket47714_run_0(topology):
     except ldap.CONSTRAINT_VIOLATION as e:
         log.error('CONSTRAINT VIOLATION ' + e.message['desc'])
 
+    time.sleep(2)
+
     topology.standalone.simple_bind_s(DN_DM, PASSWORD)
     entry = topology.standalone.search_s(TEST_USER_DN, ldap.SCOPE_BASE, SEARCHFILTER, ['lastLoginTime'])
 
     lastLoginTime0 = entry[0].lastLoginTime
 
-    time.sleep(2)
-
     log.info("\n######################### Bind as %s again ######################\n" % TEST_USER_DN)
     try:
         topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PW)
     except ldap.CONSTRAINT_VIOLATION as e:
         log.error('CONSTRAINT VIOLATION ' + e.message['desc'])
 
+    time.sleep(2)
+
     topology.standalone.simple_bind_s(DN_DM, PASSWORD)
     entry = topology.standalone.search_s(TEST_USER_DN, ldap.SCOPE_BASE, SEARCHFILTER, ['lastLoginTime'])
 
@@ -165,8 +169,6 @@ def test_ticket47714_run_0(topology):
     log.info("accountInactivityLimit: %s" % entry[0].accountInactivityLimit)
     log.info("\n######################### %s DONE ######################\n" % ACCT_POLICY_CONFIG_DN)
 
-    time.sleep(10)
-
     log.info("\n######################### Bind as %s again to fail ######################\n" % TEST_USER_DN)
     try:
         topology.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PW)
@@ -234,7 +236,6 @@ def test_ticket47714_run_1(topology):
 
 
 def test_ticket47714_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 6
dirsrvtests/tests/tickets/ticket47721_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 '''
@@ -179,9 +179,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master1.clearTmpDir(__file__)
-
+    def fin():
+        master1.delete()
+        master2.delete()
+    request.addfinalizer(fin)
     #
     # Here we have two instances master and consumer
     # with replication working. Either coming from a backup recovery
@@ -433,8 +434,6 @@ def test_ticket47721_4(topology):
 
 
 def test_ticket47721_final(topology):
-    topology.master1.delete()
-    topology.master2.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47781_test.py

@@ -61,8 +61,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -164,7 +165,6 @@ def test_ticket47781(topology):
 
 
 def test_ticket47781_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 5
dirsrvtests/tests/tickets/ticket47787_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 '''
@@ -158,8 +158,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master1.clearTmpDir(__file__)
+    def fin():
+        master1.delete()
+        master2.delete()
+    request.addfinalizer(fin)
 
     # Here we have two instances master and consumer
     # with replication working.
@@ -529,8 +531,6 @@ def test_ticket47787_2(topology):
 
 
 def test_ticket47787_final(topology):
-    topology.master1.delete()
-    topology.master2.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 5
dirsrvtests/tests/tickets/ticket47808_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -41,7 +41,7 @@ def topology(request):
     if installation_prefix:
         args_instance[SER_DEPLOYED_DIR] = installation_prefix
 
-    standalone = DirSrv(verbose=True)
+    standalone = DirSrv(verbose=False)
 
     # Args for the standalone instance
     args_instance[SER_HOST] = HOST_STANDALONE
@@ -63,8 +63,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -140,7 +141,6 @@ def test_ticket47808_run(topology):
 
 
 def test_ticket47808_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47815_test.py

@@ -60,8 +60,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -156,7 +157,6 @@ def test_ticket47815(topology):
 
 
 def test_ticket47815_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 9 - 6
dirsrvtests/tests/tickets/ticket47819_test.py

@@ -61,8 +61,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -129,7 +130,7 @@ def test_ticket47819(topology):
     log.info('Part 2:  Exporting replication ldif...')
 
     # Get the the full path and name for our LDIF we will be exporting
-    ldif_file = topology.standalone.getDir(__file__, TMP_DIR) + "export.ldif"
+    ldif_file = "/tmp/export.ldif"
 
     args = {EXPORT_REPL_INFO: True,
             TASK_WAIT: True}
@@ -178,7 +179,7 @@ def test_ticket47819(topology):
     #
     # Part 3 - test fixup task
     #
-    log.info('Part 4:  test the fixup task')
+    log.info('Part 3:  test the fixup task')
 
     # Run fixup task using the strip option.  This removes nsTombstoneCSN
     # so we can test if the fixup task works.
@@ -202,6 +203,7 @@ def test_ticket47819(topology):
         log.fatal('Search failed: ' + e.message['desc'])
         assert False
 
+
     # Now run the fixup task
     args = {TASK_WAIT: True}
     fixupTombTask = Tasks(topology.standalone)
@@ -210,6 +212,8 @@ def test_ticket47819(topology):
     except:
         assert False
 
+    time.sleep(1)
+
     # Search for tombstones with nsTombstoneCSN - better find some
     log.info('Search for tombstone entries...')
     try:
@@ -273,7 +277,6 @@ def test_ticket47819(topology):
 
 
 def test_ticket47819_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 
@@ -293,4 +296,4 @@ def run_isolated():
     test_ticket47819_final(topo)
 
 if __name__ == '__main__':
-    run_isolated()
+    run_isolated()

+ 4 - 4
dirsrvtests/tests/tickets/ticket47823_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -92,8 +92,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -975,7 +976,6 @@ def test_ticket47823_invalid_config_7(topology):
 
 
 def test_ticket47823_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 90 - 112
dirsrvtests/tests/tickets/ticket47828_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -23,8 +23,8 @@ log = logging.getLogger(__name__)
 
 installation_prefix = None
 
-ACCT_POLICY_CONFIG_DN = 'cn=config,cn=%s,cn=plugins,cn=config' % PLUGIN_ACCT_POLICY 
-ACCT_POLICY_DN = 'cn=Account Inactivation Pplicy,%s' % SUFFIX
+ACCT_POLICY_CONFIG_DN = 'cn=config,cn=%s,cn=plugins,cn=config' % PLUGIN_ACCT_POLICY
+ACCT_POLICY_DN = 'cn=Account Inactivation Policy,%s' % SUFFIX
 INACTIVITY_LIMIT = '9'
 SEARCHFILTER = '(objectclass=*)'
 
@@ -39,6 +39,7 @@ DUMMY_USER1_DN  = 'cn=%s,%s' % (DUMMY_USER1_CN, DUMMY_CONTAINER)
 
 ALLOCATED_ATTR = 'employeeNumber'
 
+
 class TopologyStandalone(object):
     def __init__(self, standalone):
         standalone.open()
@@ -51,20 +52,6 @@ def topology(request):
         This fixture is used to standalone topology for the 'module'.
         At the beginning, It may exists a standalone instance.
         It may also exists a backup for the standalone instance.
-
-        Principle:
-            If standalone instance exists:
-                restart it
-            If backup of standalone exists:
-                create/rebind to standalone
-
-                restore standalone instance from backup
-            else:
-                Cleanup everything
-                    remove instance
-                    remove backup
-                Create instance
-                Create backup
     '''
     global installation_prefix
 
@@ -80,65 +67,24 @@ def topology(request):
     args_standalone = args_instance.copy()
     standalone.allocate(args_standalone)
 
-    # Get the status of the backups
-    backup_standalone = standalone.checkBackupFS()
-
     # Get the status of the instance and restart it if it exists
     instance_standalone = standalone.exists()
     if instance_standalone:
-        # assuming the instance is already stopped, just wait 5 sec max
-        standalone.stop(timeout=5)
-        try:
-            standalone.start(timeout=10)
-        except ldap.SERVER_DOWN:
-            pass
-
-    if backup_standalone:
-        # The backup exist, assuming it is correct
-        # we just re-init the instance with it
-        if not instance_standalone:
-            standalone.create()
-            # Used to retrieve configuration information (dbdir, confdir...)
-            standalone.open()
-
-        # restore standalone instance from backup
-        standalone.stop(timeout=10)
-        standalone.restoreFS(backup_standalone)
-        standalone.start(timeout=10)
-
-    else:
-        # We should be here only in two conditions
-        #      - This is the first time a test involve standalone instance
-        #      - Something weird happened (instance/backup destroyed)
-        #        so we discard everything and recreate all
-
-        # Remove the backup. So even if we have a specific backup file
-        # (e.g backup_standalone) we clear backup that an instance may have created
-        if backup_standalone:
-            standalone.clearBackupFS()
-
-        # Remove the instance
-        if instance_standalone:
-            standalone.delete()
-
-        # Create the instance
-        standalone.create()
-
-        # Used to retrieve configuration information (dbdir, confdir...)
-        standalone.open()
+        standalone.delete()
+
+    # Create the instance
+    standalone.create()
+
+    # Used to retrieve configuration information (dbdir, confdir...)
+    standalone.open()
 
-        # Time to create the backups
-        standalone.stop(timeout=10)
-        standalone.backupfile = standalone.backupFS()
-        standalone.start(timeout=10)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
-    #
-    # Here we have standalone instance up and running
-    # Either coming from a backup recovery
-    # or from a fresh (re)init
-    # Time to return the topology
     return TopologyStandalone(standalone)
 
+
 def _header(topology, label):
     topology.standalone.log.info("\n\n###############################################")
     topology.standalone.log.info("#######")
@@ -146,6 +92,7 @@ def _header(topology, label):
     topology.standalone.log.info("#######")
     topology.standalone.log.info("###############################################")
 
+
 def test_ticket47828_init(topology):
     """
     Enable DNA
@@ -156,7 +103,7 @@ def test_ticket47828_init(topology):
                                                   'cn': 'provisioning'})))
     topology.standalone.add_s(Entry((DUMMY_CONTAINER,{'objectclass': "top nscontainer".split(),
                                                   'cn': 'dummy container'})))
-    
+
     dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
     topology.standalone.add_s(Entry((dn_config, {'objectclass': "top extensibleObject".split(),
                                                     'cn': 'excluded scope',
@@ -168,7 +115,6 @@ def test_ticket47828_init(topology):
                                                     'dnaScope': SUFFIX})))
     topology.standalone.restart(timeout=10)
 
-                                                    
 
 def test_ticket47828_run_0(topology):
     """
@@ -185,7 +131,8 @@ def test_ticket47828_run_0(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_1(topology):
     """
     NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -201,7 +148,8 @@ def test_ticket47828_run_1(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_2(topology):
     """
     NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is  set
@@ -217,7 +165,8 @@ def test_ticket47828_run_2(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_3(topology):
     """
     NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -233,17 +182,19 @@ def test_ticket47828_run_3(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_4(topology):
     '''
     Exclude the provisioning container
     '''
     _header(topology, 'Exclude the provisioning container')
-    
+
     dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
     mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]
     topology.standalone.modify_s(dn_config, mod)
-    
+
+
 def test_ticket47828_run_5(topology):
     """
     Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
@@ -259,7 +210,8 @@ def test_ticket47828_run_5(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_6(topology):
     """
     Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -275,7 +227,8 @@ def test_ticket47828_run_6(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_7(topology):
     """
     Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is  not set
@@ -291,7 +244,8 @@ def test_ticket47828_run_7(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_8(topology):
     """
     Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -307,7 +261,8 @@ def test_ticket47828_run_8(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_9(topology):
     """
     Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
@@ -323,7 +278,8 @@ def test_ticket47828_run_9(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
+
+
 def test_ticket47828_run_10(topology):
     """
     Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -339,17 +295,19 @@ def test_ticket47828_run_10(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
+
+
 def test_ticket47828_run_11(topology):
     '''
     Exclude (in addition) the dummy container
     '''
     _header(topology, 'Exclude (in addition) the dummy container')
-    
+
     dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
     mod = [(ldap.MOD_ADD, 'dnaExcludeScope', DUMMY_CONTAINER)]
     topology.standalone.modify_s(dn_config, mod)
-    
+
+
 def test_ticket47828_run_12(topology):
     """
     Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
@@ -365,7 +323,8 @@ def test_ticket47828_run_12(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_13(topology):
     """
     Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -381,7 +340,8 @@ def test_ticket47828_run_13(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_14(topology):
     """
     Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
@@ -397,7 +357,8 @@ def test_ticket47828_run_14(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_15(topology):
     """
     Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -413,7 +374,8 @@ def test_ticket47828_run_15(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_16(topology):
     """
     Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is not set
@@ -429,7 +391,8 @@ def test_ticket47828_run_16(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
+
+
 def test_ticket47828_run_17(topology):
     """
     Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -445,14 +408,14 @@ def test_ticket47828_run_17(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
-    
+
+
 def test_ticket47828_run_18(topology):
     '''
     Exclude PROVISIONING and a wrong container
     '''
     _header(topology, 'Exclude PROVISIONING and a wrong container')
-    
+
     dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
     mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]
     topology.standalone.modify_s(dn_config, mod)
@@ -462,7 +425,8 @@ def test_ticket47828_run_18(topology):
         raise ValueError("invalid dnaExcludeScope value (not a DN)")
     except ldap.INVALID_SYNTAX:
         pass
-    
+
+
 def test_ticket47828_run_19(topology):
     """
     Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
@@ -478,7 +442,8 @@ def test_ticket47828_run_19(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_20(topology):
     """
     Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -494,7 +459,8 @@ def test_ticket47828_run_20(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_21(topology):
     """
     Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is  not set
@@ -510,7 +476,8 @@ def test_ticket47828_run_21(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_22(topology):
     """
     Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -526,7 +493,8 @@ def test_ticket47828_run_22(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_23(topology):
     """
     Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
@@ -542,7 +510,8 @@ def test_ticket47828_run_23(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
+
+
 def test_ticket47828_run_24(topology):
     """
     Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -558,22 +527,24 @@ def test_ticket47828_run_24(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
+
+
 def test_ticket47828_run_25(topology):
     '''
     Exclude  a wrong container
     '''
     _header(topology, 'Exclude a wrong container')
-    
+
     dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
-    
+
     try:
         mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', "invalidDN,%s" % SUFFIX)]
         topology.standalone.modify_s(dn_config, mod)
         raise ValueError("invalid dnaExcludeScope value (not a DN)")
     except ldap.INVALID_SYNTAX:
         pass
-    
+
+
 def test_ticket47828_run_26(topology):
     """
     Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
@@ -589,7 +560,8 @@ def test_ticket47828_run_26(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_27(topology):
     """
     Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -605,7 +577,8 @@ def test_ticket47828_run_27(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(ACTIVE_USER1_DN)
-    
+
+
 def test_ticket47828_run_28(topology):
     """
     Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is  not set
@@ -621,7 +594,8 @@ def test_ticket47828_run_28(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_29(topology):
     """
     Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -637,7 +611,8 @@ def test_ticket47828_run_29(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(STAGED_USER1_DN)
-    
+
+
 def test_ticket47828_run_30(topology):
     """
     Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
@@ -653,7 +628,8 @@ def test_ticket47828_run_30(topology):
     assert ent.getValue(ALLOCATED_ATTR) != str(-1)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
+
+
 def test_ticket47828_run_31(topology):
     """
     Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
@@ -669,11 +645,13 @@ def test_ticket47828_run_31(topology):
     assert ent.getValue(ALLOCATED_ATTR) == str(20)
     topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
     topology.standalone.delete_s(DUMMY_USER1_DN)
-    
+
+
 def test_ticket47828_final(topology):
     topology.standalone.plugins.disable(name=PLUGIN_DNA)
     topology.standalone.stop(timeout=10)
 
+
 def run_isolated():
     '''
         run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
@@ -687,7 +665,7 @@ def run_isolated():
 
     topo = topology(True)
     test_ticket47828_init(topo)
-    
+
     test_ticket47828_run_0(topo)
     test_ticket47828_run_1(topo)
     test_ticket47828_run_2(topo)
@@ -720,9 +698,9 @@ def run_isolated():
     test_ticket47828_run_29(topo)
     test_ticket47828_run_30(topo)
     test_ticket47828_run_31(topo)
-    
+
     test_ticket47828_final(topo)
-    
+
 
 if __name__ == '__main__':
     run_isolated()

+ 4 - 4
dirsrvtests/tests/tickets/ticket47829_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -97,8 +97,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -608,7 +609,6 @@ def test_ticket47829_indirect_active_group_4(topology):
 
 
 def test_ticket47829_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 27 - 27
dirsrvtests/tests/tickets/ticket47833_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -87,8 +87,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -99,7 +100,7 @@ def _header(topology, label):
     topology.standalone.log.info("####### %s" % label)
     topology.standalone.log.info("#######")
     topology.standalone.log.info("###############################################")
-    
+
 def _add_user(topology, type='active'):
     if type == 'active':
         topology.standalone.add_s(Entry((ACTIVE_USER_DN, {
@@ -130,9 +131,9 @@ def _find_memberof(topology, user_dn=None, group_dn=None, find_result=True):
             if val == group_dn:
                 found = True
                 break
-            
+
     if find_result:
-        assert(found) 
+        assert(found)
     else:
         assert(not found)
 
@@ -149,18 +150,18 @@ def _find_member(topology, user_dn=None, group_dn=None, find_result=True):
             if val == user_dn:
                 found = True
                 break
-            
+
     if find_result:
-        assert(found) 
+        assert(found)
     else:
         assert(not found)
-        
+
 def _modrdn_entry(topology=None, entry_dn=None, new_rdn=None, del_old=0, new_superior=None):
     assert topology != None
     assert entry_dn != None
     assert new_rdn != None
-    
-        
+
+
     topology.standalone.log.info("\n\n######################### MODRDN %s ######################\n" % new_rdn)
     if new_superior:
         topology.standalone.rename_s(entry_dn, new_rdn, newsuperior=new_superior, delold=del_old)
@@ -179,12 +180,12 @@ def _check_memberof(topology=None, action=None, user_dn=None, group_dn=None, fin
         txt = 'replace'
     topology.standalone.log.info('\n%s entry %s' % (txt, user_dn))
     topology.standalone.log.info('to group %s' % group_dn)
-    
+
     topology.standalone.modify_s(group_dn, [(action, 'member', user_dn)])
     time.sleep(1)
     _find_memberof(topology, user_dn=user_dn, group_dn=group_dn, find_result=find_result)
-    
-    
+
+
 
 
 def test_ticket47829_init(topology):
@@ -206,7 +207,7 @@ def test_ticket47829_init(topology):
     topology.standalone.add_s(Entry((DELETE_DN, {
                                                         'objectclass': "top nscontainer".split(),
                                                         'cn': DELETE_CN})))
-    
+
     # add groups
     topology.standalone.add_s(Entry((ACTIVE_GROUP_DN, {
                                                 'objectclass': "top groupOfNames".split(),
@@ -217,38 +218,38 @@ def test_ticket47829_init(topology):
     topology.standalone.add_s(Entry((OUT_GROUP_DN, {
                                                 'objectclass': "top groupOfNames".split(),
                                                 'cn': OUT_GROUP_CN})))
-    
+
     # add users
     _add_user(topology, 'active')
     _add_user(topology, 'stage')
     _add_user(topology, 'out')
-    
-    
+
+
 
     # enable memberof of with scope account
     topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
     dn = "cn=%s,%s" % (PLUGIN_MEMBER_OF, DN_PLUGIN)
     topology.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'memberOfEntryScope', ACTIVE_DN)])
-    
-    
-    
+
+
+
     topology.standalone.restart(timeout=10)
 
 
-    
-        
+
+
 def test_ticket47829_mod_stage_user_modrdn_stage_user_1(topology):
     _header(topology, 'add an Stage user to a Active group. Then move Stage user to Stage')
-    
+
     old_stage_user_dn  = STAGE_USER_DN
     old_stage_user_rdn = "cn=%s" % STAGE_USER_CN
     new_stage_user_rdn = "cn=x%s" % STAGE_USER_CN
     new_stage_user_dn = "%s,%s" % (new_stage_user_rdn, STAGE_DN)
-    
+
     # add Stage user to active group
     _check_memberof(topology, action=ldap.MOD_ADD, user_dn=old_stage_user_dn, group_dn=ACTIVE_GROUP_DN, find_result=False)
     _find_member  (topology, user_dn=old_stage_user_dn, group_dn=ACTIVE_GROUP_DN, find_result=True)
-    
+
     # move the Stage entry to Stage, expect  no 'member' and 'memberof'
     _modrdn_entry (topology, entry_dn=old_stage_user_dn, new_rdn=new_stage_user_rdn, new_superior=STAGE_DN)
     _find_memberof(topology, user_dn=new_stage_user_dn, group_dn=ACTIVE_GROUP_DN, find_result=False)
@@ -256,7 +257,6 @@ def test_ticket47829_mod_stage_user_modrdn_stage_user_1(topology):
 
 
 def test_ticket47833_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 13 - 11
dirsrvtests/tests/tickets/ticket47838_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -27,7 +27,6 @@ CONFIG_DN = 'cn=config'
 ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN
 RSA = 'RSA'
 RSA_DN = 'cn=%s,%s' % (RSA, ENCRYPTION_DN)
-LDAPSPORT = '10636'
 SERVERCERT = 'Server-Cert'
 plus_all_ecount = 0
 plus_all_dcount = 0
@@ -37,6 +36,7 @@ plus_all_dcount_noweak = 0
 nss_version = ''
 NSS320 = '3.20.0'
 
+
 class TopologyStandalone(object):
     def __init__(self, standalone):
         standalone.open()
@@ -75,8 +75,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    #request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -166,7 +167,7 @@ def _47838_init(topology):
 
     topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-security', 'on'),
                                              (ldap.MOD_REPLACE, 'nsslapd-ssl-check-hostname', 'off'),
-                                             (ldap.MOD_REPLACE, 'nsslapd-secureport', LDAPSPORT)])
+                                             (ldap.MOD_REPLACE, 'nsslapd-secureport', str(DEFAULT_SECURE_PORT))])
 
     topology.standalone.add_s(Entry((RSA_DN, {'objectclass': "top nsEncryptionModule".split(),
                                               'cn': RSA,
@@ -204,7 +205,7 @@ def _47838_run_0(topology):
 
     topology.standalone.simple_bind_s(DN_DM, PASSWORD)
     topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])
-
+    time.sleep(5)
     log.info("\n######################### Restarting the server ######################\n")
     topology.standalone.restart(timeout=120)
 
@@ -244,6 +245,7 @@ def _47838_run_1(topology):
 
     topology.standalone.simple_bind_s(DN_DM, PASSWORD)
     topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])
+    time.sleep(5)
     # Make sure allowWeakCipher is not set.
     topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'allowWeakCipher', None)])
 
@@ -365,7 +367,7 @@ def _47838_run_4(topology):
     log.info("Disabled ciphers: %d" % dcount)
     global plus_all_ecount
     global plus_all_dcount
-    assert ecount == 20
+    assert ecount == 23
     assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
     weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
     wcount = int(weak.readline().rstrip())
@@ -402,7 +404,7 @@ def _47838_run_5(topology):
     global plus_all_ecount
     global plus_all_dcount
     if nss_version >= NSS320:
-        assert ecount == 20
+        assert ecount == 23
     else:
         assert ecount == 12
     assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
@@ -507,7 +509,7 @@ def _47838_run_8(topology):
     global plus_all_ecount
     global plus_all_dcount
     if nss_version >= NSS320:
-       assert ecount == 20
+       assert ecount == 23
     else:
        assert ecount == 12
     assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
@@ -547,7 +549,7 @@ def _47838_run_9(topology):
     log.info("Enabled ciphers: %d" % ecount)
     log.info("Disabled ciphers: %d" % dcount)
     if nss_version >= NSS320:
-        assert ecount == 27
+        assert ecount == 30
     else:
         assert ecount == 23
     assert dcount == 0
@@ -655,6 +657,7 @@ def _47928_run_0(topology):
                                                  (ldap.MOD_DELETE, 'sslVersionMin', None),
                                                  (ldap.MOD_DELETE, 'sslVersionMax', None)])
     topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])
+    time.sleep(5)
 
     log.info("\n######################### Restarting the server ######################\n")
     topology.standalone.stop(timeout=10)
@@ -823,7 +826,6 @@ def _47838_run_last(topology):
 
 
 def _47838_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 5
dirsrvtests/tests/tickets/ticket47869MMR_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -132,8 +132,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master1.clearTmpDir(__file__)
+    def fin():
+        master1.delete()
+        master2.delete()
+    request.addfinalizer(fin)
 
     # Here we have two instances master and consumer
     return TopologyMaster1Master2(master1, master2)
@@ -315,8 +317,6 @@ def test_ticket47869_check(topology):
 
 
 def test_ticket47869_final(topology):
-    topology.master1.delete()
-    topology.master2.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 6
dirsrvtests/tests/tickets/ticket47871_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 '''
@@ -123,9 +123,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # clear the tmp directory
-    master.clearTmpDir(__file__)
-
+    def fin():
+        master.delete()
+        consumer.delete()
+    request.addfinalizer(fin)
     #
     # Here we have two instances master and consumer
     # with replication working. Either coming from a backup recovery
@@ -198,8 +199,6 @@ def test_ticket47871_2(topology):
 
 
 def test_ticket47871_final(topology):
-    topology.master.delete()
-    topology.consumer.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47900_test.py

@@ -68,8 +68,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -321,7 +322,6 @@ def test_ticket47900(topology):
 
 
 def test_ticket47900_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 22 - 22
dirsrvtests/tests/tickets/ticket47910_test.py

@@ -55,11 +55,11 @@ def topology(request):
 
     # Clear out the tmp dir
     standalone.clearTmpDir(__file__)
-    
+
     def fin():
         standalone.delete()
     request.addfinalizer(fin)
-    
+
     return TopologyStandalone(standalone)
 
 
@@ -73,13 +73,13 @@ def log_dir(topology):
 
     log.info("Diable access log buffering")
     topology.standalone.setAccessLogBuffering(False)
-    
+
     log.info("Do a ldapsearch operation")
     topology.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, "(objectclass=*)")
-    
+
     log.info("sleep for sometime so that access log file get generated")
     time.sleep( 1 )
-    
+
     return topology.standalone.accesslog
 
 
@@ -95,7 +95,7 @@ def execute_logconv(start_time_stamp, end_time_stamp, access_log):
     assign these values to -S and -E options of logconv
     and, it will execute logconv and return result value
     '''
-    
+
     log.info("Executing logconv.pl with -S current time and -E end time")
     cmd = ['logconv.pl', '-S', start_time_stamp, '-E', end_time_stamp, access_log]
     log.info(" ".join(cmd))
@@ -115,20 +115,20 @@ def test_ticket47910_logconv_start_end_positive(topology, log_dir):
     # Execute logconv.pl -S -E with random timestamp
     #
     log.info('Running test_ticket47910 - Execute logconv.pl -S -E with random values')
-    
+
     log.info("taking current time with offset of 2 mins and formatting it to feed -S")
     start_time_stamp = (datetime.now() - timedelta(minutes=2))
     formatted_start_time_stamp = format_time(start_time_stamp)
-    
+
     log.info("taking current time with offset of 2 mins and formatting it to feed -E")
     end_time_stamp = (datetime.now() + timedelta(minutes=2))
     formatted_end_time_stamp = format_time(end_time_stamp)
-    
+
     log.info("Executing logconv.pl with -S and -E")
     result = execute_logconv(formatted_start_time_stamp, formatted_end_time_stamp, log_dir)
     assert result == 0
 
-    
+
 def test_ticket47910_logconv_start_end_negative(topology, log_dir):
     '''
     Execute logconv.pl with -S and -E(endtime) with random time stamp
@@ -136,20 +136,20 @@ def test_ticket47910_logconv_start_end_negative(topology, log_dir):
     starttime
     This should give error message
     '''
-    
+
     #
     # Execute logconv.pl -S and -E with random timestamp
     #
     log.info('Running test_ticket47910 - Execute logconv.pl -S -E with starttime>endtime')
-    
+
     log.info("taking current time with offset of 2 mins and formatting it to feed -S")
     start_time_stamp = (datetime.now() + timedelta(minutes=2))
     formatted_start_time_stamp = format_time(start_time_stamp)
-    
+
     log.info("taking current time with offset of 2 mins and formatting it to feed -E")
     end_time_stamp = (datetime.now() - timedelta(minutes=2))
     formatted_end_time_stamp = format_time(end_time_stamp)
-    
+
     log.info("Executing logconv.pl with -S and -E")
     result = execute_logconv(formatted_start_time_stamp, formatted_end_time_stamp, log_dir)
     assert result == 1
@@ -167,24 +167,24 @@ def test_ticket47910_logconv_start_end_invalid(topology, log_dir):
     log.info("Set start time and end time to invalid values")
     start_time_stamp = "invalid"
     end_time_stamp = "invalid"
-    
+
     log.info("Executing logconv.pl with -S and -E")
     result = execute_logconv(start_time_stamp, end_time_stamp, log_dir)
     assert result == 1
 
-    
+
 def test_ticket47910_logconv_noaccesslogs(topology, log_dir):
-    
+
     '''
     Execute logconv.pl -S(starttime) without specify
-    access logs location  
+    access logs location
     '''
-    
+
     #
     # Execute logconv.pl -S with random timestamp and no access log location
     #
     log.info('Running test_ticket47910 - Execute logconv.pl without access logs')
-        
+
     log.info("taking current time with offset of 2 mins and formatting it to feed -S")
     time_stamp = (datetime.now() - timedelta(minutes=2))
     formatted_time_stamp = format_time(time_stamp)
@@ -195,10 +195,10 @@ def test_ticket47910_logconv_noaccesslogs(topology, log_dir):
     stdout, stderr = proc.communicate()
     log.info("standard output" + stdout)
     log.info("standard errors" + stderr)
-    
+
     assert proc.returncode == 1
 
-    
+
 if __name__ == '__main__':
     # Run isolated
     # -s for DEBUG mode

+ 3 - 3
dirsrvtests/tests/tickets/ticket47920_test.py

@@ -101,8 +101,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -169,7 +170,6 @@ def test_ticket47920_mod_readentry_ctrl(topology):
 
 
 def test_ticket47920_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47921_test.py

@@ -51,8 +51,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -145,7 +146,6 @@ def test_ticket47921(topology):
 
 
 def test_ticket47921_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47927_test.py

@@ -69,8 +69,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -289,7 +290,6 @@ def test_ticket47927_six(topology):
 
 
 def test_ticket47927_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47937_test.py

@@ -60,8 +60,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -164,7 +165,6 @@ def test_ticket47937(topology):
 
 
 def test_ticket47937_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47950_test.py

@@ -64,8 +64,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -199,7 +200,6 @@ def test_ticket47950(topology):
 
 
 def test_ticket47953_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 15 - 4
dirsrvtests/tests/tickets/ticket47953_test.py

@@ -12,6 +12,7 @@ import time
 import ldap
 import logging
 import pytest
+import shutil
 from lib389 import DirSrv, Entry, tools, tasks
 from lib389.tools import DirSrvTools
 from lib389._constants import *
@@ -61,8 +62,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    #request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -80,7 +82,15 @@ def test_ticket47953(topology):
     #
     # Import an invalid ldif
     #
-    ldif_file = topology.standalone.getDir(__file__, DATA_DIR) + "ticket47953/ticket47953.ldif"
+    ldif_file = (topology.standalone.getDir(__file__, DATA_DIR) +
+                 "ticket47953/ticket47953.ldif")
+    try:
+        ldif_dir = topology.standalone.get_ldif_dir()
+        shutil.copy(ldif_file, ldif_dir)
+        ldif_file = ldif_dir + '/ticket47953.ldif'
+    except:
+        log.fatal('Failed to copy ldif to instance ldif dir')
+        assert False
     importTask = Tasks(topology.standalone)
     args = {TASK_WAIT: True}
     try:
@@ -88,6 +98,8 @@ def test_ticket47953(topology):
     except ValueError:
         assert False
 
+    time.sleep(2)
+
     #
     # Delete the invalid aci
     #
@@ -104,7 +116,6 @@ def test_ticket47953(topology):
 
 
 def test_ticket47953_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47963_test.py

@@ -50,8 +50,9 @@ def topology(request):
     standalone.create()
     standalone.open()
 
-    # Clear out the tmp dir
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     return TopologyStandalone(standalone)
 
@@ -181,7 +182,6 @@ def test_ticket47963(topology):
 
 
 def test_ticket47963_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 5 - 5
dirsrvtests/tests/tickets/ticket47966_test.py

@@ -3,7 +3,7 @@
 # All rights reserved.
 #
 # License: GPL (version 3 or any later version).
-# See LICENSE for details. 
+# See LICENSE for details.
 # --- END COPYRIGHT BLOCK ---
 #
 import os
@@ -114,8 +114,10 @@ def topology(request):
         log.fatal('Replication is not working.')
         assert False
 
-    # Clear out the tmp dir
-    master1.clearTmpDir(__file__)
+    def fin():
+        master1.delete()
+        master2.delete()
+    request.addfinalizer(fin)
 
     return TopologyReplication(master1, master2)
 
@@ -208,8 +210,6 @@ def test_ticket47966(topology):
 
 
 def test_ticket47966_final(topology):
-    topology.master1.delete()
-    topology.master2.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47970_test.py

@@ -65,8 +65,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -134,7 +135,6 @@ def test_ticket47970(topology):
 
 
 def test_ticket47970_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47973_test.py

@@ -65,8 +65,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -161,7 +162,6 @@ def test_ticket47973(topology):
 
 
 def test_ticket47973_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

+ 3 - 3
dirsrvtests/tests/tickets/ticket47980_test.py

@@ -117,8 +117,9 @@ def topology(request):
     # Used to retrieve configuration information (dbdir, confdir...)
     standalone.open()
 
-    # clear the tmp directory
-    standalone.clearTmpDir(__file__)
+    def fin():
+        standalone.delete()
+    request.addfinalizer(fin)
 
     # Here we have standalone instance up and running
     return TopologyStandalone(standalone)
@@ -638,7 +639,6 @@ def test_ticket47980(topology):
 
 
 def test_ticket47980_final(topology):
-    topology.standalone.delete()
     log.info('Testcase PASSED')
 
 

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels