OpenStack Telemetry (Ceilometer) Alarming
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 |
||
---|---|---|
bin | ||
ceilometer | ||
doc | ||
etc | ||
nova_tests | ||
tools | ||
.coveragerc | ||
.gitignore | ||
.gitreview | ||
.testr.conf | ||
babel.cfg | ||
CONTRIBUTING.rst | ||
LICENSE | ||
MAINTAINERS | ||
openstack-common.conf | ||
README.rst | ||
ReleaseNotes | ||
requirements.txt | ||
setup-test-env.sh | ||
setup.cfg | ||
setup.py | ||
test-requirements.txt | ||
tox.ini |
ceilometer
See the ReleaseNotes document and the project home for more info.