oslo.service/oslo_service/tests
Davanum Srinivas 6a56ec63bf Fix Heartbeats stop when time is changed
eventlet's hub mechanism defaults to using time.time for figuring
out how long to sleep, when to wake up etc:
https://github.com/eventlet/eventlet/blob/master/eventlet/hubs/epolls.py#L37
https://github.com/eventlet/eventlet/blob/master/eventlet/hubs/hub.py#L344

So if you mess with the system time, anything using loopingcall
will stop working. Best example as described in the bug is
`nova-manage service list` which fails for some services when
the clock is advanced.

If we use a monotonic timer, then we can get past this problem.
In this review we use the EVENTLET_HUB hook to specify
a custom Hub. In our custom Hub, we just delegate to the
existing hub mechanism (get_default_hub()) to create an
instance of the Hub and override the clock with one based
on monotonic.

Note that use_hub() mechanism will not work because that sets
the Hub just for the current thread and will not work for other
threads that may be started later. In order to set this
environment variable early, we set it in the __init__.py so
anyone who uses oslo service will enable this support just
by a simple import referencing anything in oslo.service

Co-Authored-By: Victor Stinner <vstinner@redhat.com>
Closes-Bug: 1510234
Change-Id: I4c1cf223e9f6faa1e6dcaf432be1aa709072a343
2016-03-03 21:21:02 +01:00
..
ssl_cert Added wsgi functionality 2015-08-19 12:01:40 +00:00
__init__.py doing monkey_patch for unittest. 2015-09-15 11:13:49 +08:00
base.py Add functionality for creating Unix domain WSGI servers 2015-11-18 17:35:16 +03:00
eventlet_service.py Fix test execution on CentOS 7 2016-01-08 17:35:31 +01:00
test_eventlet_backdoor.py Allow the backdoor to serve from a local unix domain socket 2016-02-18 19:24:19 -08:00
test_loopingcall.py Fix Heartbeats stop when time is changed 2016-03-03 21:21:02 +01:00
test_periodic.py fix a couple of assert issues 2015-12-23 11:41:41 +08:00
test_service.py Fix race condition on handling signals 2016-01-26 21:38:30 +01:00
test_sslutils.py Enable py3 mock.patch of RuntimeError 2015-12-09 11:02:47 -05:00
test_systemd.py Increase test coverage of systemd 2015-07-02 16:14:28 +03:00
test_threadgroup.py ThreadGroup's stop didn't recognise the current thread correctly 2015-09-17 10:38:05 +08:00
test_wsgi.py Use requests in TestWSGIServerWithSSL instead of raw socket client 2016-02-11 16:21:55 +03:00