1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/python/samba
Noel Power 81043cdf0e python/samba/tests: Fix auth_log messaging problems in py3
Some tests (especially samba.tests.auth_log_netlogon_bad_creds) are
failing due to not receiving expected messages. There seems to be
some timing issue or race around the messaging bus being set up and
getting the expected events resulting from the failed netlogon.

Specifically the the order of destruction of the messaging.Messaging()
c-py objects is different under python2. Under python2 all of the
messaging.Messaging() objects are destructed *after* all the tests
are run. Note: each instance of the TestCase has it's own Messaging()
instance which is created by TestCaseXYZ.setUp, so it appears the unittest
destroys the test instances when all the tests have run whereas in
python3 we see each messaging.Messaging() instance destroyed after
each test runs.
Ok, what difference does that make ? well it seems in python3 because
each Messaging() instance is destructed after a test runs that the
associated messaging_dgm_destroy() also runs, this destroys the
global_dgm_context context which means when the next test runs the whole
messaging infrastructure needs to be built again when the next Messaging()
object is created. On the server-side this seems to result in attempts
to send messages to the listener failing first with

get_event_server: Failed to find 'auth_event' registered on the message bus to send JSON audit events to: NT_STATUS_CONNECTION_REFUSED

and subsequently with

get_event_server: Failed to find 'auth_event' registered on the message bus to send JSON audit events to: NT_STATUS_UNSUCCESSFUL

client doesn't get any more messages, test fails :-(

So, what's the difference in python2, well because the destructors for the
(4 in the case of netlogon_bad_creds) instances of Messagaging() don't run
till the end of the tests this doesn't happen and the global_dgm_context
never gets destroyed untill all the tests complete. There is some race
condition at play here, a simple sleep at the start of a failing test
fixes the problem. But... ok that isn't a possible solution here, instead
I have adjusted the base auth tests to store the Messaging() objects in a
global list forcing them to remain in scope until the tests are complete.
This ensure the behaviour is consistent across python2 & python3.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-10 10:38:22 +01:00
..
emulate traffic_replay: Add a max-members option to cap group size 2018-12-04 12:22:50 +01:00
gp_parse python/samba/gp_parse: PY2/PY3 Decode only when necessary 2018-11-05 20:05:24 +01:00
kcc python/samba/kcc: PY3 fix some str versus ldb.bytes comparisons 2018-12-10 10:38:22 +01:00
netcmd python/samba/netcmd: PY3 fix samba4.blackbox.trust_utils test 2018-12-10 10:38:21 +01:00
provision python/samba/provision: PY3 port samba4.dlz_bind9.version 2018-11-14 05:07:15 +01:00
samba3 python/samba3: import passdb in the manner it is used 2018-11-01 05:08:14 +01:00
subunit PEP8: fix E701: multiple statements on one line (colon) 2018-08-24 07:49:30 +02:00
tests python/samba/tests: Fix auth_log messaging problems in py3 2018-12-10 10:38:22 +01:00
web_server s4/web_server: PY3: port to python3 2018-09-27 01:54:27 +02:00
__init__.py python/samba: PY3 ord needs 'str' type not int 2018-12-10 10:38:21 +01:00
colour.py python/colour: add colourizing and switch functions 2018-05-31 01:57:17 +02:00
common.py python: avoid useless work in dsdb_Dn.__cmp__ 2018-11-01 05:08:12 +01:00
compat.py python/samba: fix default params for PY3 ConfigParser 2018-12-10 10:38:22 +01:00
dbchecker.py Fix spelling mistakes 2018-11-30 03:35:13 +01:00
descriptor.py PEP8: fix E302: expected 2 blank lines, found 1 2018-08-24 07:49:29 +02:00
dnsserver.py PEP8: fix E302: expected 2 blank lines, found 1 2018-08-24 07:49:29 +02:00
domain_update.py python/domain_update: remove unused imports 2018-10-25 21:45:53 +02:00
drs_utils.py drs_utils: Avoid invalid dereference of v8 requests 2018-11-06 07:15:33 +01:00
forest_update.py python/forest_update: remove unused imports 2018-10-25 21:45:53 +02:00
getopt.py python/samba: PY3 fix can't compare string with int 2018-11-14 05:07:17 +01:00
gp_ext_loader.py python/gp_ext_loader: remove unused imports 2018-10-25 21:45:53 +02:00
gp_sec_ext.py python/samba: PY3 port gpo.apply smbtorture test 2018-12-10 10:38:22 +01:00
gpclass.py python/samba: PY3 port gpo.apply smbtorture test 2018-12-10 10:38:22 +01:00
graph.py PEP8: fix E303: too many blank lines (2) 2018-08-24 07:49:30 +02:00
hostconfig.py PEP8: fix E302: expected 2 blank lines, found 1 2018-08-24 07:49:29 +02:00
idmap.py PEP8: fix E302: expected 2 blank lines, found 1 2018-08-24 07:49:29 +02:00
join.py PY3: net.change_password & net.set_password take string not bytes 2018-12-10 10:38:21 +01:00
logger.py logger: use color automatically for a tty 2018-11-21 10:46:20 +01:00
mdb_util.py mdb_util: Better error message if lmdb-utils not installed 2018-11-09 21:07:47 +01:00
ms_display_specifiers.py python/samba: port open to io.open for PY2/PY3 compat 2018-09-03 03:22:20 +02:00
ms_forest_updates_markdown.py python/samba: PY3 port samba4.blackbox.functionalprep 2018-10-23 05:50:28 +02:00
ms_schema_markdown.py PEP8: fix E305: expected 2 blank lines after class or function definition, found 1 2018-08-24 07:49:30 +02:00
ms_schema.py python/samba: port open to io.open for PY2/PY3 compat 2018-09-03 03:22:20 +02:00
ndr.py PEP8: fix E302: expected 2 blank lines, found 1 2018-08-24 07:49:29 +02:00
ntacls.py python/ntacls: remove unused imports 2018-10-25 21:45:53 +02:00
remove_dc.py python/remove_dc: fix Exception construction 2018-11-01 05:08:13 +01:00
samdb.py python/samba: PY3 fix failing py3 samba.tests.group_audit test 2018-12-10 10:38:22 +01:00
schema.py python/schema: remove unused import 2018-10-25 21:45:53 +02:00
sd_utils.py PEP8: fix E231: missing whitespace after ',' 2018-08-24 07:49:28 +02:00
sites.py PEP8: fix E128: continuation line under-indented for visual indent 2018-08-24 07:49:27 +02:00
subnets.py python/subnets: use the correct variable name 2018-11-01 05:08:11 +01:00
tdb_util.py PEP8: fix E302: expected 2 blank lines, found 1 2018-08-24 07:49:29 +02:00
upgrade.py PEP8: improve formatting around bit-wise OR ("|") 2018-08-24 07:49:32 +02:00
upgradehelpers.py python/upgradehelpers: use mkstemp, not mktemp 2018-11-07 17:55:08 +01:00
uptodateness.py uptodateness: add get_utdv_summary function 2018-10-18 06:15:25 +02:00
xattr.py python/xattr: remove unused variable 2018-11-01 05:08:14 +01:00