pycassa stub does not address python's failure to sort time uuids deterministically #217

Closed
kurtjx opened this Issue Oct 17, 2013 · 1 comment

2 participants

@kurtjx

We've rolled our own kludgey pycassa test stubbing framework and we've run into this issue with columns that contain a time uuid. Python doesn't sort time uuids in a time-centric manner and this results in non-deterministic test behavior. Our solution was to cast timeuuids to datetime object in the CF stub.

Here's proof python can't sort time uuids:

import time
import random
from pycassa import util

idx = 0 
while True:
    print idx
    idx += 1
    times = []
    for _ in range(10):
        times.append(time.time())
        time.sleep(random.randrange(0, 100)/ 100.)

    times.sort()

    uuids = [util.convert_time_to_uuid(t) for t in times]

    uuids.sort()

    newtimes = [util.convert_uuid_to_time(u) for u in uuids]

    assert newtimes == times

If time permits, I'll work on a patch. I'd like to get off our own test stubs and onto pycassa stubs.

@thobbs
pycassa member

#218 fixed this, closing.

@thobbs thobbs closed this Apr 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment