Non determinism in test_db.test_image_get_all_marker

Bug #930543 reported by justinsb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
justinsb

Bug Description

The test test_image_get_all_marker in test_db is non-deterministic...

If the two timestamps have the same created_at timestamp (either a fast machine or a low granularity clock), then the order of the results should comes down to the order of the UUIDs. However, this test assumes that Fixture #2 always comes after Fixture #1.

An easy way to check this is to do the below (pre-compute the timestamps), and change the timedelta between 0 and 1.

t1 = datetime.datetime.utcnow()
t2 = t1 + datetime.timedelta(microseconds=1)

FIXTURES = [
    {'id': UUID1,
     'name': 'fake image #1',
     'status': 'active',
     'disk_format': 'ami',
     'container_format': 'ami',
     'is_public': False,
     'created_at': t1,
     'updated_at': t1,
     'deleted_at': None,
     'deleted': False,
     'checksum': None,
     'min_disk': 0,
     'min_ram': 0,
     'size': 13,
     'location': "swift://user:passwd@acct/container/obj.tar.0",
     'properties': {'type': 'kernel'}},
    {'id': UUID2,
     'name': 'fake image #2',
     'status': 'active',
     'disk_format': 'vhd',
     'container_format': 'ovf',
     'is_public': True,
     'created_at': t2,
     'updated_at': t2,
     'deleted_at': None,
     'deleted': False,
     'checksum': None,
     'min_disk': 5,
     'min_ram': 256,
     'size': 19,
     'location': "file:///tmp/glance-tests/2",
     'properties': {}}]

With a timedelta of 0, python run_tests.py glance.tests.unit.test_db will fail all the time.

I think there's also a related bug in the == logic, I'm going to file that separately.

Changed in glance:
assignee: nobody → justinsb (justin-fathomdb)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: New → In Progress
Jay Pipes (jaypipes)
Changed in glance:
milestone: none → essex-4
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/4045
Committed: http://github.com/openstack/glance/commit/7990cb4e0c0528f6d4694fa0faf81597ea56d6ba
Submitter: Jenkins
Branch: master

commit 7990cb4e0c0528f6d4694fa0faf81597ea56d6ba
Author: Justin Santa Barbara <email address hidden>
Date: Mon Feb 13 13:27:44 2012 -0800

    Fix paging ties

    Bug #930543
    Bug #930544

    Change-Id: Ifad1ea61f3ecbf58af9bc7f0bc635e69246f6ece

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: essex-4 → 2012.1
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.