[SCM] Samba Shared Repository - branch master updated

Douglas Bagnall dbagnall at samba.org
Thu Oct 18 11:18:02 UTC 2018


The branch, master has been updated
       via  ce518f3 ldb_ldif: be less horribly efficient in debugging
       via  30e9c00 py3_tests/kcc : test_verify can hit KCCError as well as GraphError
       via  204bd0e4 py3/tests/kcc: turn error into failure for flapping.d/kcc
      from  e404b6a selftest: add tests for samba-tool drs uptodateness

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ce518f387f9f6742f642ce33901cd778375bb4fd
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Oct 17 16:28:25 2018 +1300

    ldb_ldif: be less horribly efficient in debugging
    
    perf said all the time was in strlen.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Douglas Bagnall <dbagnall at samba.org>
    Autobuild-Date(master): Thu Oct 18 13:17:30 CEST 2018 on sn-devel-144

commit 30e9c00f2d8ba6395deb4fe8734e41b1000f13f0
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Oct 17 17:21:09 2018 +1300

    py3_tests/kcc : test_verify can hit KCCError as well as GraphError
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 204bd0e447b5a83f603eac9dd317bdb026539cbc
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Oct 17 09:50:41 2018 +1300

    py3/tests/kcc: turn error into failure for flapping.d/kcc
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/common/ldb_ldif.c          |  6 +++---
 python/samba/tests/kcc/__init__.py | 34 ++++++++++++++--------------------
 selftest/flapping.d/kcc_verify_py3 |  2 +-
 3 files changed, 18 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/common/ldb_ldif.c b/lib/ldb/common/ldb_ldif.c
index e23b568..ec1859b 100644
--- a/lib/ldb/common/ldb_ldif.c
+++ b/lib/ldb/common/ldb_ldif.c
@@ -313,6 +313,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
 
 	for (i=0;i<msg->num_elements;i++) {
 		const struct ldb_schema_attribute *a;
+		size_t namelen = strlen(msg->elements[i].name);
 
 		if (msg->elements[i].name == NULL) {
 			ldb_debug(ldb, LDB_DEBUG_ERROR,
@@ -347,7 +348,6 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
 			CHECK_RET;
 			continue;
 		}
-
 		for (j=0;j<msg->elements[i].num_values;j++) {
 			struct ldb_val v;
 			bool use_b64_encode = false;
@@ -371,7 +371,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
 				CHECK_RET;
 				ret = base64_encode_f(ldb, fprintf_fn, private_data,
 						      (char *)v.data, v.length,
-						      strlen(msg->elements[i].name)+3);
+						      namelen + 3);
 				CHECK_RET;
 				ret = fprintf_fn(private_data, "\n");
 				CHECK_RET;
@@ -384,7 +384,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
 				} else {
 					ret = fold_string(fprintf_fn, private_data,
 							  (char *)v.data, v.length,
-							  strlen(msg->elements[i].name)+2);
+							  namelen + 2);
 				}
 				CHECK_RET;
 				ret = fprintf_fn(private_data, "\n");
diff --git a/python/samba/tests/kcc/__init__.py b/python/samba/tests/kcc/__init__.py
index 3916782..3ca2084 100644
--- a/python/samba/tests/kcc/__init__.py
+++ b/python/samba/tests/kcc/__init__.py
@@ -62,7 +62,10 @@ class KCCTests(samba.tests.TestCase):
         my_kcc = kcc.KCC(unix_now, False, False, False, False)
         my_kcc.load_samdb("ldap://%s" % os.environ["SERVER"],
                           self.lp, self.creds)
-        dsas = my_kcc.list_dsas()
+        try:
+            dsas = my_kcc.list_dsas()
+        except kcc.KCCError as e:
+            self.fail("kcc.list_dsas failed with %s" % e)
         env = os.environ['TEST_ENV']
         for expected_dsa in ENV_DSAS[env]:
             self.assertIn(expected_dsa, dsas)
@@ -75,22 +78,13 @@ class KCCTests(samba.tests.TestCase):
         my_kcc = kcc.KCC(unix_now, readonly=True, verify=True,
                          debug=False, dot_file_dir=None)
 
-        #
-        # The following seems to raise
-        # samba.kcc.graph_utils.GraphError when something
-        # goes wrong.
-        #
-        # Typically failureException is exceptions.AssertionError
-        # by default, see pydoc unittest.TestCase
-        #
-        # As this is flapping under python3, we need to
-        # make sure it generates a failure instead of an error.
-        #
-        # We need to make sure samba.kcc.graph_utils.GraphError
-        # will generate a failure from here on.
-        #
-        self.failureException = samba.kcc.graph_utils.GraphError
-
-        my_kcc.run("ldap://%s" % os.environ["SERVER"],
-                   self.lp, self.creds,
-                   attempt_live_connections=False)
+        # As this is flapping with errors under python3, we catch
+        # exceptions and turn them into failures..
+        try:
+            my_kcc.run("ldap://%s" % os.environ["SERVER"],
+                       self.lp, self.creds,
+                       attempt_live_connections=False)
+        except (samba.kcc.graph_utils.GraphError, kcc.KCCError):
+            import traceback
+            traceback.print_exc()
+            self.fail()
diff --git a/selftest/flapping.d/kcc_verify_py3 b/selftest/flapping.d/kcc_verify_py3
index 03005fc..e96ce18 100644
--- a/selftest/flapping.d/kcc_verify_py3
+++ b/selftest/flapping.d/kcc_verify_py3
@@ -1 +1 @@
-samba.tests.kcc.python3.samba.tests.kcc.KCCTests.test_verify
+samba.tests.kcc.python3.samba.tests.kcc.KCCTests


-- 
Samba Shared Repository



More information about the samba-cvs mailing list