Non determinism in test_db.test_image_get_all_marker

Bug #930543 reported by justinsb on 2012-02-11
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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)

    {'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 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)

Fix proposed to branch: master

Changed in glance:
status: New → In Progress
Jay Pipes (jaypipes) on 2012-02-11
Changed in glance:
milestone: none → essex-4
importance: Undecided → High

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) on 2012-02-29
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in glance:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers