Timing issue in SimpleTenantUsageSample(Json|XML)Test

Bug #1206526 reported by Roman Podoliaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Roman Podoliaka

Bug Description

Being an integrated test SimpleTenantUsageSample(Json|XML)Test makes POST/GET HTTP queries to start a new instance and retrieve information about it. The actual implementation is stubbed out, but queries nevertheless take some time to proceed.

Test setUp() is defined as:

    def setUp(self):
        """setUp method for simple tenant usage."""
        super(SimpleTenantUsageSampleJsonTest, self).setUp()
        self._post_server()
        timeutils.set_time_override(timeutils.utcnow() +
                                    datetime.timedelta(hours=1))
        self.query = {
            'start': str(timeutils.utcnow() - datetime.timedelta(hours=1)),
            'end': str(timeutils.utcnow())
        }

The problem is, that if for some reason (e. g. high LA value) self._post_server() takes more than 1 second, the test will fail, because the instance uptime value will not be equal to one defined in API call sample (3600):

Traceback (most recent call last):
  File "/home/jenkins/workspace/gate-nova-python26/nova/tests/integrated/test_api_samples.py", line 2132, in test_get_tenant_usage_details
    response, 200)
  File "/home/jenkins/workspace/gate-nova-python26/nova/tests/integrated/test_api_samples.py", line 307, in _verify_response
    response_data, "Response")
  File "/home/jenkins/workspace/gate-nova-python26/nova/tests/integrated/test_api_samples.py", line 205, in _compare_result
    result_str)
  File "/home/jenkins/workspace/gate-nova-python26/nova/tests/integrated/test_api_samples.py", line 238, in _compare_result
    raise NoMatch('\n'.join(error))
NoMatch: Extra list items in template:
{ ... {'__tag__': 'uptime', '__content__': '3600'}]}]}
Extra list items in Response:
{ ... {'__tag__': 'uptime', '__content__': '3601'}]}]}

The error is rare, nevertheless it happens time to time when Jenkins runs gate jobs.

Tags: tests
Changed in nova:
assignee: nobody → Roman Podolyaka (rpodolyaka)
tags: added: tests
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/39299
Committed: http://github.com/openstack/nova/commit/2e87d4dc13c9478f633889fefe77ab3954755cd0
Submitter: Jenkins
Branch: master

commit 2e87d4dc13c9478f633889fefe77ab3954755cd0
Author: Roman Podolyaka <email address hidden>
Date: Tue Jul 30 11:40:02 2013 +0300

    Fix timing issue in SimpleTenantUsageSample test

    If POST query, which is made in test setUp(), for some reason
    takes more that 1 second to proceed (e. g. high LA value), the
    test will fail due to mismatch between the expected and actual
    instance uptime values.

    The error is quite rare, but nevertheless happens time to time
    when Jenkins runs gate jobs.

    Fixes bug 1206526

    Change-Id: I0418ee3f852db6dd3c5ed905490be2e48c8fd0ba

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
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.