tests: Reduce likelihood of auth_log test locking up during CI
authorAaron Haslett <aaronhaslett@catalyst.net.nz>
Thu, 28 Feb 2019 03:55:31 +0000 (16:55 +1300)
committerNoel Power <npower@samba.org>
Tue, 5 Mar 2019 13:10:43 +0000 (13:10 +0000)
commit6a7dd7ab510a85d4c5f6d7e740b6bbd58b714085
treecf1e45660f565f01facc3a430b214c3b7ee416d4
parentf0ecfd384c279c94b2c341b638426cf1cbd797ce
tests: Reduce likelihood of auth_log test locking up during CI

We would sometimes see the auth_log test hang during a CI run. The CI
job would eventually fail after consuming a costly 10 hours of CI
runtime.

We believe the problem is around the test creating multiple instances of
the Messaging() context. This is a similar race condition to what was
seen in 19f34b2161dee26.

Currently a new Messaging() context is created for every test case. By
using classmethods instead, the Messaging context is only created once
per python test file execution (i.e. creation of the python class,
rather than initialization of the python object, which happens for every
test-case).

This means the test will only create one Messaging() context, which
should avoid any race conditions.

Changes:
+ removed msg_ctxs - this wasn't actually used for anything.
+ use classmethods to setup and tear-down the Messaging() context (and
tweak lp initialization accordingly).
+ fix discardMessages() - the loop wasn't actually discarding any
messages previously (this may also have been the cause of the test
hanging).

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Mar  5 13:10:43 UTC 2019 on sn-devel-144
python/samba/tests/auth_log_base.py