unit tests are not isolated from /etc/ceilometer/ceilometer.conf

Bug #1463889 reported by Chris Dent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
Low
Chris Dent

Bug Description

If you run devstacks on the same machine where you do your gnocchi development the fact that the unit tests are not isolated from /etc/ceilometer/ceilometer.conf is very annoying.

The failure is pasted below. This only happens if a [gnocchi_dispatcher] section in ceilometer.conf has:

filter_service_activity = False

:the paste:

==============================
Failed 1 tests - output below:
==============================

gnocchi.tests.test_ceilometer_dispatcher.DispatcherTest.test_activity_filter_match_project_id
---------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "gnocchi/tests/test_ceilometer_dispatcher.py", line 135, in test_activity_filter_match_project_id
        self._do_test_activity_filter([self.samples[1]])
      File "/home/cdent/src/gnocchi/.tox/py27/lib/python2.7/site-packages/mock.py", line 1201, in patched
        return func(*args, **keywargs)
      File "gnocchi/tests/test_ceilometer_dispatcher.py", line 109, in _do_test_activity_filter
        expected_samples, True,
      File "/home/cdent/src/gnocchi/.tox/py27/lib/python2.7/site-packages/mock.py", line 835, in assert_called_with
        raise AssertionError(msg)
    AssertionError: Expected call: _process_samples(<ANY>, 'd2249765-4c37-4e90-bbac-f12050d6e11d', 'disk.root.size', [{'source': 'openstack', 'project_id': 'test_project', 'counter_name': 'disk.root.size', 'resource_id': 'd2249765-4c37-4e90-bbac-f12050d6e11d', 'counter_volume': '2', 'timestamp': '2014-05-08 20:23:48.028195', 'resource_metadata': {'instance_flavor_id': '1234', 'host': 'foo', 'display_name': 'myinstance', 'image_ref_url': 'imageref!'}, 'user_id': 'test_user', 'counter_type': 'gauge'}], True)
    Actual call: _process_samples(<stevedore.extension.Extension object at 0x7f0da670a910>, 'd2249765-4c37-4e90-bbac-f12050d6e11d', 'disk.root.size', [{'source': 'openstack', 'project_id': 'a2d42c23-d518-46b6-96ab-3fba2e146859', 'counter_name': 'disk.root.size', 'resource_id': 'd2249765-4c37-4e90-bbac-f12050d6e11d', 'counter_volume': '2', 'timestamp': '2012-05-08 20:23:48.028195', 'resource_metadata': {'instance_flavor_id': '1234', 'host': 'foo', 'display_name': 'myinstance', 'image_ref_url': 'imageref!'}, 'user_id': 'test_user', 'counter_type': 'gauge'}, {'source': 'openstack', 'project_id': 'test_project', 'counter_name': 'disk.root.size', 'resource_id': 'd2249765-4c37-4e90-bbac-f12050d6e11d', 'counter_volume': '2', 'timestamp': '2014-05-08 20:23:48.028195', 'resource_metadata': {'instance_flavor_id': '1234', 'host': 'foo', 'display_name': 'myinstance', 'image_ref_url': 'imageref!'}, 'user_id': 'test_user', 'counter_type': 'gauge'}], True)

Julien Danjou (jdanjou)
Changed in gnocchi:
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (master)

Fix proposed to branch: master
Review: https://review.openstack.org/190262

Changed in gnocchi:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/190262
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=8ce25d4774708c6d5d1ecc1b4e3b8347324f99e4
Submitter: Jenkins
Branch: master

commit 8ce25d4774708c6d5d1ecc1b4e3b8347324f99e4
Author: Chris Dent <email address hidden>
Date: Wed Jun 10 16:53:17 2015 +0000

    Avoid conflicts with ceilometer.conf in dispatcher tests

    This makes sure a critical configuration value
    (filter_service_activity) used in the ceilometer dispatcher tests
    is explicitly set in the setUp of the test. Otherwise a conflicting
    value in /etc/ceilometer/ceilometer.conf can cause tests to fail.

    Efforts to make a solution which just ignores
    /etc/ceilometer/ceilometer.conf were confounded by too much "helpful"
    magic in oslo_config. Given that this dispatcher will be leaving the
    gnocchi repo soonish, a long trip down a rabbit hole was skipped.

    Change-Id: I8f270183d6c38de0b4088166ddc2da687576a752
    Closes-Bug: #1463889

Changed in gnocchi:
status: In Progress → Fix Committed
Julien Danjou (jdanjou)
Changed in gnocchi:
milestone: none → 1.1.0
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (stable/1.0)

Fix proposed to branch: stable/1.0
Review: https://review.openstack.org/239386

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on gnocchi (stable/1.0)

Change abandoned by Julien Danjou (<email address hidden>) on branch: stable/1.0
Review: https://review.openstack.org/239386

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.