[PATCH] Another flapping python 3 test
Stefan Metzmacher
metze at samba.org
Tue Oct 2 10:55:45 UTC 2018
Hi,
> the problem is that an unexpected "error" is generated,
> knownfail can only catch unexpected "failures"...
>
> With python this typically happens if we don't catch expections,
> see python/samba/tests/__init__.py
>
> ok = False
> try:
> testMethod()
> ok = True
> except SkipTest as e:
> self._addSkip(result, str(e))
> return
> except self.failureException:
> result.addFailure(self, self._exc_info())
> except KeyboardInterrupt:
> raise
> except:
> result.addError(self, self._exc_info())
>
> KCCTests.test_verify() needs to catch the
> samba.kcc.graph_utils.GraphError exception and generate
> a self.failureException exception, which typically happens with
> the self.assert*() functions.
The attached patch turns it into an error for me.
Please review and push:-)
Thanks!
metze
-------------- next part --------------
From 197886d19282888d5c9d5507c6042c8d92b6682c Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Tue, 2 Oct 2018 12:01:03 +0200
Subject: [PATCH] python/tests: turn GraphError into failure inside of
test_verify()
That test was already marked as flapping in commit
5a73f904e192c44e304850287ac439d0b52f7be5.
However the test generates an UNEXPECTED(error)
instead of an UNEXPECTED(failure).
[67(594)/75 at 36m28s] samba.tests.kcc.python3(vampire_dc)
repsFrom source DSA guid (62f01940-a784-4e60-947a-a661c787c8cc) not found
repsFrom source DSA guid (62f01940-a784-4e60-947a-a661c787c8cc) not found
repsFrom source DSA guid (62f01940-a784-4e60-947a-a661c787c8cc) not found
repsFrom source DSA guid (62f01940-a784-4e60-947a-a661c787c8cc) not found
repsFrom source DSA guid (62f01940-a784-4e60-947a-a661c787c8cc) not found
UNEXPECTED(error): samba.tests.kcc.python3.samba.tests.kcc.KCCTests.test_verify(vampire_dc)
REASON: Exception: Exception: Traceback (most recent call last):
File "bin/python/samba/tests/kcc/__init__.py", line 80, in test_verify
attempt_live_connections=False)
File "bin/python/samba/kcc/__init__.py", line 2659, in run
('connected',))
File "bin/python/samba/kcc/__init__.py", line 2513, in plot_all_connections
vertex_colors=vertex_colours)
File "bin/python/samba/kcc/graph_utils.py", line 334, in verify_and_dot
for p, e, doc in errors)))
samba.kcc.graph_utils.GraphError: The 'dsa_final CN=NTDS Settings,CN=LOCALVAMPIREDC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samba,DC=example,DC=com' graph lacks the following properties:
connected: the graph is not connected, as the following vertices are unreachable:
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
python/samba/tests/kcc/__init__.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/python/samba/tests/kcc/__init__.py b/python/samba/tests/kcc/__init__.py
index 3d33295e575a..39167824d353 100644
--- a/python/samba/tests/kcc/__init__.py
+++ b/python/samba/tests/kcc/__init__.py
@@ -75,6 +75,22 @@ 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)
--
2.17.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20181002/41a49885/signature.sig>
More information about the samba-technical
mailing list