59e647f82c
When we call oslo.config.cfg.CONF(), it will do basic setup and search configuration files under certain directories, by default, they are [/etc, /etc/ceilometer, ~/, ~/.ceilometer]. However, we should avoid such behaviour when we run unit test code, because that if the system has run devstack or installed ceilometer services, then /etc/ceilometer/ceilometer.conf will exist, then unit test result can be different. So we should mock the default searching directories of cfg in the begining of all unit tests, which will call cfg.CONF() at somewhere during the test. The best place to mock the default directories can be ceilometer.test.base.BaseTestCase, which should be used as parent class of all other test classes. Note: since this patch sets default searching directory to {repo}/etc/ceilometer, you can run the unit test with different settings which are set in etc/ceilometer/ceilometer.conf (not tracked by git). Note: mock.patch.stopall has compatibility problem with oslo.fixture, so this patch slightly refactors the tests.compute.pollsters.base.TestPollsterBase.setUp method. Change-Id: I533ffb2ba2c9be0223cecbcf04176312e4a96369 Closes-Bug: #1328550 |
||
---|---|---|
.. | ||
alarm | ||
api | ||
central | ||
compute | ||
dispatcher | ||
energy | ||
event | ||
hardware | ||
image | ||
locale | ||
network | ||
objectstore | ||
openstack | ||
orchestration | ||
publisher | ||
storage | ||
tests | ||
transformer | ||
volume | ||
__init__.py | ||
agent.py | ||
cli.py | ||
collector.py | ||
messaging.py | ||
middleware.py | ||
neutron_client.py | ||
notification.py | ||
notifier.py | ||
nova_client.py | ||
pipeline.py | ||
plugin.py | ||
sample.py | ||
service.py | ||
utils.py |