test_post_samples_scenarios fail when devstack enable ceilometer services

Bug #1325354 reported by ZhiQiang Fan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Medium
Unassigned

Bug Description

after install devstack with keystone and ceilometer service enabled, and then run tox -epy27 under ceilometer clone, it get the following error, and cause 42 failure

Traceback (most recent call last):
  File "ceilometer/tests/base.py", line 75, in skip_if_not_implemented
    return func(*args, **kwargs)
  File "/home/zqfan/openstack/ceilometer-master/ceilometer/tests/api/v2/test_post_samples_scenarios.py", line 57, in setUp
    self.patch_publishers()
  File "/home/zqfan/openstack/ceilometer-master/ceilometer/tests/api/v2/test_post_samples_scenarios.py", line 43, in patch_publishers
    pipeline_hook = self.app.app.application.app.hooks[2]
AttributeError: 'StaticFileMiddleware' object has no attribute 'application'

after some debug, I found that, the /etc/ceilometer/ceilometer.conf has set debug to true, which cause ceilometer.tests.api.FunctionalTest().app to be (app=webtest.app.TestApp, app=pecan.middleware.static.StaticFileMiddleware, app=pecan.middleware.debug.DebugMiddleware, app=pecan.middleware.recursive.RecursiveMiddleware), which instead is expected to be (app=webtest.app.TestApp, app=pecan.middleware.recursive.RecursiveMiddleware, application=ceilometer.api.middleware.ParsableErrorMiddleware, app=pecan.core.Pecan)

mock the debug value to false can fix this problem, but further dig is needed too

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

will upload a patch soon

Eoghan Glynn (eglynn)
Changed in ceilometer:
status: New → Triaged
importance: Undecided → Medium
ZhiQiang Fan (aji-zqfan)
Changed in ceilometer:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

according to https://github.com/openstack/ceilometer/blob/master/ceilometer/api/app.py#L74, ceilometer.api will use cfg.CONF.debug to invoke pecan.make_app

and according to https://github.com/stackforge/pecan/blob/master/pecan/__init__.py#L101, pecan will wrap app with DebugMiddleware and StaticFileMiddleware if debug is true, so it explains the behavior

I think mock the debug value can eventually fix the problem

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

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

Changed in ceilometer:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ceilometer (master)

Change abandoned by ZhiQiang Fan (<email address hidden>) on branch: master
Review: https://review.openstack.org/97099
Reason: llu's patch is better than this one, and that one has already been merged

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

the final solution is here: https://review.openstack.org/#/c/98295/

and this one has been already released

Changed in ceilometer:
assignee: ZhiQiang Fan (aji-zqfan) → nobody
status: In Progress → Fix Committed
Changed in ceilometer:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: juno-2 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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