tests fail on 32 bit platforms

Bug #1190054 reported by Soren Hansen
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Medium
Unassigned

Bug Description

Many (all?) of the tokens shipped in the test suite are set to expire in 2112. If running the test suite on a 32 bit platform, this will fail, as the timestamps can't fit in 32 bits.

On 32 bit platforms:
>>> from keystoneclient.openstack.common import time
>>> timeutils.parse_isotime('2112-06-02T14:47:34Z').strftime('%s')
'-1'

On 64 bit platforms:
>>> from keystoneclient.openstack.common import time
>>> timeutils.parse_isotime('2112-06-02T14:47:34Z').strftime('%s')
'4494318454'

This causes a bunch of test failures:

   https://launchpadlibrarian.net/141969786/buildlog_ubuntu-saucy-i386.python-keystoneclient_1%3A0.2.4-0ubuntu1_FAILEDTOBUILD.txt.gz

Changed in python-keystoneclient:
assignee: nobody → Wu Wenxiang (wu-wenxiang)
Revision history for this message
Wu Wenxiang (wu-wenxiang) wrote :

The root cause is: strftime() return long int. And long size is 32 bits in 32 bit system, 64 bits in 64 bit platform.

Dolph Mathews (dolph)
Changed in python-keystoneclient:
status: New → Incomplete
status: Incomplete → Confirmed
importance: Undecided → Medium
Revision history for this message
Dolph Mathews (dolph) wrote :

I'd suggest setting all these timestamps to "2038-01-18T21:14:08Z" as the last possible moment supported by 32-bit systems.

>>> from keystoneclient.openstack.common import timeutils
>>> import sys
>>> timeutils.parse_isotime('2038-01-18T21:14:08Z').strftime('%s')
'-1'
>>> timeutils.parse_isotime('2038-01-18T21:14:08Z').strftime('%s')
'2147483647'
>>> sys.maxint
2147483647
>>> pow(2, 31) - 1
2147483647L

Revision history for this message
Wu Wenxiang (wu-wenxiang) wrote :

So, do you mean:

if isotime >= 2038-2038-01-18T21:14:08Z:
    return 2147483647
else:
    return parse().strftime()

Revision history for this message
Dolph Mathews (dolph) wrote :

No, the test certs were updated to a date far in the future because they expired and tests started failing. I'm suggesting that the certs simply be revised again to expire on 2038-01-18T21:14:08Z.

Revision history for this message
Dolph Mathews (dolph) wrote :

Sorry, terrible copy paste fails above on my part.

The correct time that will work on 32-bit systems is:

  2038-01-18T21:14:07Z

The first time that will fail on 32-bit systems is:

    2038-01-18T21:14:08Z

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

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

Changed in python-keystoneclient:
status: Confirmed → In Progress
Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

@Wu Wenxiang (wu-wenxiang) :
can i assign this bug to me?

Revision history for this message
Wu Wenxiang (wu-wenxiang) wrote :

Of course! :)

Dolph Mathews (dolph)
Changed in python-keystoneclient:
assignee: Wu Wenxiang (wu-wenxiang) → ZhiQiang Fan (aji-zqfan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/46535
Committed: http://github.com/openstack/python-keystoneclient/commit/2fdbcbd06cfa6fd4348bc3752554331651717c87
Submitter: Jenkins
Branch: master

commit 2fdbcbd06cfa6fd4348bc3752554331651717c87
Author: Dolph Mathews <email address hidden>
Date: Fri Sep 13 11:29:49 2013 -0500

    Set example timestamps to 2038-01-18T21:14:07Z

    This timestamp is the last possible moment that can be represented on
    32-bit systems as an integer.

    As a consequence of revising the JSON examples, the corresponding PEM
    files must be re-generated as well.

    Change-Id: Ic6014c08b4545db036605beef1e6a8829ed347c4
    Related-Bug: 1190054
    Related-Bug: 1225084

ZhiQiang Fan (aji-zqfan)
Changed in python-keystoneclient:
assignee: ZhiQiang Fan (aji-zqfan) → nobody
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
milestone: none → 0.4.0
Dolph Mathews (dolph)
Changed in python-keystoneclient:
status: Fix Committed → Fix Released
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.