perftest: ad_dc_medley failing base search failed to catch exception
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 24 Aug 2017 03:02:43 +0000 (15:02 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Sat, 5 May 2018 02:32:42 +0000 (04:32 +0200)
This meant it only happened once.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/dsdb/tests/python/ad_dc_medley_performance.py

index f49563c7f6cbeb6f232e7f72af241141f148e8c8..05be482cf6165716e31212c6709718f49faf4f91 100644 (file)
@@ -38,6 +38,7 @@ from samba.auth import system_session
 from ldb import Message, MessageElement, Dn, LdbError
 from ldb import FLAG_MOD_ADD, FLAG_MOD_REPLACE, FLAG_MOD_DELETE
 from ldb import SCOPE_BASE, SCOPE_SUBTREE, SCOPE_ONELEVEL
+from ldb import ERR_NO_SUCH_OBJECT
 
 parser = optparse.OptionParser("ad_dc_performance.py [options] <host>")
 sambaopts = options.SambaOptions(parser)
@@ -222,15 +223,19 @@ class UserTests(samba.tests.TestCase):
                                     attrs=['cn'])
                 except LdbError as e:
                     (num, msg) = e.args
-                    if num != 32:
+                    if num != ERR_NO_SUCH_OBJECT:
                         raise
 
     def _test_base_search_failing(self):
         pattern = 'missing%d' + self.ou
         for i in range(4000):
-            self.ldb.search(pattern % i,
-                            scope=SCOPE_BASE,
-                            attrs=['cn'])
+            try:
+                self.ldb.search(pattern % i,
+                                scope=SCOPE_BASE,
+                                attrs=['cn'])
+            except LdbError as (num, msg):
+                if num != ERR_NO_SUCH_OBJECT:
+                    raise
 
     def search_expression_list(self, expressions, rounds,
                                attrs=['cn'],