Havan rc2 acl scenarios failing due to timezone assumption

Bug #1240994 reported by David Peraza
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Low
David Peraza
Havana
Fix Released
Low
David Peraza

Bug Description

keystoneclient 0.4 uses utcnow to determine if a token has expired. The acl scenarios FakeMemcache simulates expires by doing datetime.now which uses current timezone this and issue if current timezone is not utc.

Here is a sample of the failure I see
======================================================================
FAIL: tests.api.v2.test_acl_scenarios.TestAPIACL.test_with_non_admin_missing_project_query(db2)
tags: worker-13
----------------------------------------------------------------------
pythonlogging:'': {{{
connecting to MongoDB on mongodb://localhost:29000/ceilometer_1239424e18ad412dbb1a37a88146b7e8
Starting keystone auth_token middleware
Configuring auth_uri to point to the public identity endpoint is required; clients may not be able to authenticate against an admin endpoint
Using /var/cache/ceilometer as cache directory for signing certificate
Using fake.cache memcache for caching token
Auth Token proceeding with requested v2.0 apis
Starting new HTTP connection (1): 127.0.0.1
Retrying on HTTP connection exception: HTTPConnectionPool(host='127.0.0.1', port=35357): Max retries exceeded with url: /v2.0/tokens (Caused by <class 'socket.error'>: [Errno 111] Connection refused)
Starting new HTTP connection (1): 127.0.0.1
Retrying on HTTP connection exception: HTTPConnectionPool(host='127.0.0.1', port=35357): Max retries exceeded with url: /v2.0/tokens (Caused by <class 'socket.error'>: [Errno 111] Connection refused)
Starting new HTTP connection (1): 127.0.0.1
Retrying on HTTP connection exception: HTTPConnectionPool(host='127.0.0.1', port=35357): Max retries exceeded with url: /v2.0/tokens (Caused by <class 'socket.error'>: [Errno 111] Connection refused)
Starting new HTTP connection (1): 127.0.0.1
HTTP connection exception: HTTPConnectionPool(host='127.0.0.1', port=35357): Max retries exceeded with url: /v2.0/tokens (Caused by <class 'socket.error'>: [Errno 111] Connection refused)
Authorization failed for token 4562138218392832
Invalid user token - rejecting request
}}}

Traceback (most recent call last):
  File "ceilometer/tests/base.py", line 87, in skip_if_not_implemented
    return func(*args, **kwargs)
  File "tests/api/v2/test_acl_scenarios.py", line 170, in test_with_non_admin_missing_project_query
    "X-Project-Id": "project-good"})
  File "tests/api/v2/test_acl_scenarios.py", line 119, in get_json
    **params)
  File "ceilometer/tests/api.py", line 218, in get_json
    expect_errors=expect_errors)
  File "/home/openstack/workspace/ceilometer/.tox/py27/local/lib/python2.7/site-packages/webtest/app.py", line 206, in get
    expect_errors=expect_errors)
  File "/home/openstack/workspace/ceilometer/.tox/py27/local/lib/python2.7/site-packages/webtest/app.py", line 515, in do_request
    self._check_status(status, res)
  File "/home/openstack/workspace/ceilometer/.tox/py27/local/lib/python2.7/site-packages/webtest/app.py", line 544, in _check_status
    res)
AppError: Bad response: 401 Unauthorized (not 200 OK or 3xx redirect for http://localhost/v2/meters)
'Authentication required'
======================================================================

Changed in ceilometer:
assignee: nobody → David Peraza (dperaza)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/52182
Committed: http://github.com/openstack/ceilometer/commit/ac2a503d4d9ada69b5d5c1fbd2acf7397d8b4ac9
Submitter: Jenkins
Branch: master

commit ac2a503d4d9ada69b5d5c1fbd2acf7397d8b4ac9
Author: David Peraza <email address hidden>
Date: Wed Oct 16 13:14:10 2013 -0500

    Changes FakeMemcache to set token to expire on utcnow + 5 mins

    fixes bug 1240994

    keystoneclient 0.4 will use utcnow to compare expiration date.
    The FakMemcache class sets expiration to datetime.now which sets
    date for local timezone. If this timezone happens to be behind
    utc the test will fail with expiration error because we are
    comparing utc + 5 mins with utc - 1 or more hours.

    Change-Id: I551506a5aaf0aef77476b11786399a66225603bf

Changed in ceilometer:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/52638

Revision history for this message
Eoghan Glynn (eglynn) wrote :

Not a user-visible fix, but acceptable for stable none-the-less as this will smooth the way for other patches in development for stable to be tested more easily.

Changed in ceilometer:
milestone: none → icehouse-1
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/havana)

Reviewed: https://review.openstack.org/52638
Committed: http://github.com/openstack/ceilometer/commit/becae1827530c0cb43cd57180f853b364ec1dcbd
Submitter: Jenkins
Branch: stable/havana

commit becae1827530c0cb43cd57180f853b364ec1dcbd
Author: David Peraza <email address hidden>
Date: Wed Oct 16 13:14:10 2013 -0500

    Changes FakeMemcache to set token to expire on utcnow + 5 mins

    fixes bug 1240994

    keystoneclient 0.4 will use utcnow to compare expiration date.
    The FakMemcache class sets expiration to datetime.now which sets
    date for local timezone. If this timezone happens to be behind
    utc the test will fail with expiration error because we are
    comparing utc + 5 mins with utc - 1 or more hours.

    Change-Id: I551506a5aaf0aef77476b11786399a66225603bf
    (cherry picked from commit ac2a503d4d9ada69b5d5c1fbd2acf7397d8b4ac9)

Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: icehouse-1 → 2014.1
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.