From 6b7494f5e7f72a29350d5fbbf2dbae866ded9b63 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 24 Aug 2017 15:02:43 +1200 Subject: [PATCH] perftest: ad_dc_medley failing base search failed to catch exception This meant it only happened once. Signed-off-by: Douglas Bagnall Reviewed-by: Gary Lockyer --- .../dsdb/tests/python/ad_dc_medley_performance.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source4/dsdb/tests/python/ad_dc_medley_performance.py b/source4/dsdb/tests/python/ad_dc_medley_performance.py index f49563c7f6c..05be482cf61 100644 --- a/source4/dsdb/tests/python/ad_dc_medley_performance.py +++ b/source4/dsdb/tests/python/ad_dc_medley_performance.py @@ -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] ") 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'],