OpenStack Telemetry (Ceilometer) Alarming
Go to file
ZhiQiang Fan 59e647f82c Avoid reading real config files in unit test
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
2014-06-18 12:17:23 +08:00
bin Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00
ceilometer Avoid reading real config files in unit test 2014-06-18 12:17:23 +08:00
doc Merge "Fix LBaaS connection meter docs" 2014-06-17 22:10:29 +00:00
etc Drop deprecated api v1 2014-05-18 16:17:01 +02:00
nova_tests Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00
tools Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00
.coveragerc test code should be excluded from test coverage summary 2013-12-11 11:40:51 -05:00
.gitignore Clean up .gitignore 2014-06-16 09:00:22 +02:00
.gitreview Update .gitreview for openstack. 2012-11-11 19:13:08 +00:00
.testr.conf Removes per test testr timeout 2014-06-09 19:43:23 +02:00
babel.cfg Ground work for transifex-ify ceilometer. 2012-12-18 10:14:03 +08:00
CONTRIBUTING.rst Switch to pbr. 2013-05-11 12:44:54 -04:00
LICENSE include a copy of the ASL 2.0 2013-03-15 14:25:48 +00:00
MAINTAINERS Fix some spelling mistakes and a incorrect url 2014-03-06 11:28:50 +08:00
openstack-common.conf Clean up openstack-common.conf 2014-05-08 20:09:09 +08:00
README.rst Rename README.md to README.rst 2013-07-14 21:09:38 +02:00
ReleaseNotes Update documentation URL 2012-12-05 10:22:43 +01:00
requirements.txt Updated from global requirements 2014-05-20 12:59:42 -04:00
setup-test-env.sh Respect $TMPDIR environment variable to run tests 2014-06-10 10:16:17 +02:00
setup.cfg Metering LoadBalancer as a Service 2014-06-09 15:29:52 -07:00
setup.py Updated from global requirements 2014-05-20 12:59:42 -04:00
test-requirements.txt Updated from global requirements 2014-05-28 16:26:48 +00:00
tox.ini Merge "Clean tox.ini" 2014-06-08 06:14:26 +00:00

ceilometer

See the ReleaseNotes document and the project home for more info.

http://launchpad.net/ceilometer