Jenkins failed due to TestGlanceAPI.test_get_details_filter_changes_since

Bug #1242501 reported by Feilong Wang
38
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Critical
Zhi Yan Liu
Grizzly
Fix Released
Critical
Alan Pevec
Havana
Fix Released
Critical
Alan Pevec

Bug Description

Now we're running into the Jenkins failure due to below test case failure:

2013-10-20 06:12:31.930 | ======================================================================
2013-10-20 06:12:31.930 | FAIL: glance.tests.unit.v1.test_api.TestGlanceAPI.test_get_details_filter_changes_since
2013-10-20 06:12:31.930 | ----------------------------------------------------------------------
2013-10-20 06:12:31.930 | _StringException: Traceback (most recent call last):
2013-10-20 06:12:31.931 | File "/home/jenkins/workspace/gate-glance-python27/glance/tests/unit/v1/test_api.py", line 1358, in test_get_details_filter_changes_since
2013-10-20 06:12:31.931 | self.assertEquals(res.status_int, 400)
2013-10-20 06:12:31.931 | File "/home/jenkins/workspace/gate-glance-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 322, in assertEqual
2013-10-20 06:12:31.931 | self.assertThat(observed, matcher, message)
2013-10-20 06:12:31.931 | File "/home/jenkins/workspace/gate-glance-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 417, in assertThat
2013-10-20 06:12:31.931 | raise MismatchError(matchee, matcher, mismatch, verbose)
2013-10-20 06:12:31.931 | MismatchError: 200 != 400

Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

I'm wondering why run_tests.sh could return success but tox.

Zhi Yan Liu (lzy-dev)
Changed in glance:
status: New → Confirmed
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

The root causes is that the current latest version for iso8601 is 0.1.7, its "parse_date()" util function could successfully handle datestring param which missing the time part like "2011-09-05". This behavior is different then iso8601-0.1.4, our test case code assume iso8601 always raise an exception when it parse the datestring withich don't have time part.

https://github.com/openstack/glance/blob/master/glance/openstack/common/timeutils.py#L52
https://github.com/openstack/glance/blob/master/glance/registry/api/v1/images.py#L215

I prefer fix this via change test case code but don't cap iso8601 version in requirement.txt (such as <0.1.7), one thing here I'm concerning is that do we need to update some user doc? since glance can support yyyy-mm-dd param (no time part) as "changes-since" filter param for the image-list query request, like"2011-09-05".

## iso8601-0.1.7
>>> import iso8601
>>> iso8601.parse_date('2011-09-05')
datetime.datetime(2011, 9, 5, 0, 0, tzinfo=<iso8601.iso8601.Utc object at 0x1c3da50>

## iso8601-0.1.4
>>> import iso8601
>>> iso8601.parse_date('2011-09-05')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lzy/workspace/openstack-org/glance/.venv/local/lib/python2.7/site-packages/iso8601/iso8601.py", line 101, in parse_date
    int(groups["hour"]), int(groups["minute"]), int(groups["second"]),
TypeError: int() argument must be a string or a number, not 'NoneType'

btw, for my above comments, in my dev env, the venv is using iso8601-0.1.4 but tox is using iso8601-0.1.7, so run_tests.sh could return success but tox.

Zhi Yan Liu (lzy-dev)
Changed in glance:
assignee: nobody → Zhi Yan Liu (lzy-dev)
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

If go my approach which i mentioned above, we need update iso8601 version in global requirement also (https://github.com/openstack/requirements/blob/master/global-requirements.txt#L23). Any thought?

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/52894

Changed in glance:
status: Confirmed → In Progress
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :
Revision history for this message
Jeremy Stanley (fungi) wrote :

I expect a bit of pushback from other projects using iso8601, since you're proposing everyone should start to require a newer version than is present in Ubuntu.

http://packages.ubuntu.com/python-iso8601

Is there no way to make this test support 0.1.4's behavior as well as 0.1.7's (perhaps switching on the package version info to determine which behavior it should expect)?

Zhi Yan Liu (lzy-dev)
Changed in glance:
importance: Undecided → Critical
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

Hello Jeremy Staley,

1. The reason of why I have not add the code to glance (including test case) for support both 0.1.4's and 0.1.7 like the approach you proposed "switching on the package version info to determine which behavior it should expect" is that this dynamic logic will causes glance-{api, registry} API provided non-consistent result to end user, it says when deployer using 0.1.7 then the "changes-since" filter param for the image-list API will support yyyy-mm-dd param (no time part), but when deployer using 0.1.4 then that same request will raise an exception. This's unreasonable to me.

2. Your concern "you're proposing everyone should start to require a newer version than is present in Ubuntu." is make sense to me. So there is a second choice to fixes this issue (even I personally don't like go this way), as I mentioned in my comments #3 we can cap or skip iso8601 version 0.1.7 (<0.1.7 or !=0.1.7), do you think this is OK to you/other projects?

Any thoughts others?

Revision history for this message
Jeremy Stanley (fungi) wrote :

It looks like iso8601 0.1.7 is uninstallable under Python 3.3 anyway, so I agree https://review.openstack.org/53156 may be a better choice in the near term. You're still likely to encounter this same behavior change in 0.1.8 so perhaps improving Glance to have a consistent behavior when the time part is omitted (regardless of support in the iso8601 package) would be your best option long-term?

Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

@fungi, Yep I will enhance this part for glance when iso8601 ready (https://bitbucket.org/micktwomey/pyiso8601/issue/10/setuppy-broken-for-python-33 )

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/53703

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/53707

Revision history for this message
Alan Pevec (apevec) wrote :

This brokes Glance gate on stable branches too.

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Zhiyan:

What is the status for this bug in Havana? I am still hitting this issue in Jenkins - http://logs.openstack.org/09/52409/8/check/gate-glance-python27/945b487/console.html

I see the master patchset has been Abandoned?

Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

@dosaboy, we still doing this, after it landing we can fix this broken finally. https://review.openstack.org/#/c/52894/

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

Reviewed: https://review.openstack.org/52894
Committed: http://github.com/openstack/glance/commit/8160ae293383ec600c05fd2e4b38164bca7704c4
Submitter: Jenkins
Branch: master

commit 8160ae293383ec600c05fd2e4b38164bca7704c4
Author: Zhi Yan Liu <email address hidden>
Date: Mon Oct 21 18:40:06 2013 +0800

    Sync iso8601 requirement and fixes test case failures

    1. Sync requirements from global.
    2. iso8601>=0.1.7 "parse_date()" could successfully handle date string
    which only have date part like YYYY-MM-DD, it caused two Glance test
    cases failure.

    Fixes bug: 1242501

    Change-Id: I2625eb3888111829a9da4d093b34193b8795f264
    Signed-off-by: Zhi Yan Liu <email address hidden>

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
Alan Pevec (apevec) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/havana)

Reviewed: https://review.openstack.org/55935
Committed: http://github.com/openstack/glance/commit/9b52a89765449c226b41025aec9c92acfefee0c3
Submitter: Jenkins
Branch: stable/havana

commit 9b52a89765449c226b41025aec9c92acfefee0c3
Author: Zhi Yan Liu <email address hidden>
Date: Mon Oct 21 18:40:06 2013 +0800

    Sync iso8601 requirement and fixes test case failures

    1. Sync requirements from global Iece0116d3c412216251e2d7fbffe10bfe2c1c789
    2. iso8601>=0.1.7 "parse_date()" could successfully handle date string
    which only have date part like YYYY-MM-DD, it caused two Glance test
    cases failure.

    Fixes bug: 1242501

    Change-Id: I2625eb3888111829a9da4d093b34193b8795f264
    Signed-off-by: Zhi Yan Liu <email address hidden>
    (cherry picked from commit 8160ae293383ec600c05fd2e4b38164bca7704c4)
    Conflicts:
     glance/tests/unit/v1/test_registry_api.py
     requirements.txt

Thierry Carrez (ttx)
Changed in glance:
milestone: none → icehouse-1
status: Fix Committed → Fix Released
Alan Pevec (apevec)
no longer affects: glance/folsom
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/grizzly)

Reviewed: https://review.openstack.org/55939
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=07cdc0238068ea507bcf0b5f0f5f3d35307ff9d3
Submitter: Jenkins
Branch: stable/grizzly

commit 07cdc0238068ea507bcf0b5f0f5f3d35307ff9d3
Author: Zhi Yan Liu <email address hidden>
Date: Mon Oct 21 18:40:06 2013 +0800

    Sync iso8601 requirement and fixes test case failures

    1. Sync requirements from global Iece0116d3c412216251e2d7fbffe10bfe2c1c789
    2. iso8601>=0.1.7 "parse_date()" could successfully handle date string
    which only have date part like YYYY-MM-DD, it caused two Glance test
    cases failure.

    Fixes bug: 1242501

    Grizzly notice: this should fix stable/grizzly tempest failure
     error: Installed distribution iso8601 0.1.4 conflicts with requirement iso8601>=0.1.8
     at the expense of bumping version requirement for iso8601 on stable branch!

    Also incldues: Pin Sphinx to <1.2

    1.2 was just released and has a bug that causes builds to fail with
    the error:

      error: 'source_dir' must be a directory name (got `...doc/source`)

    Fixes bug: 1259511

    See: http://bugs.python.org/issue19570
    and: https://bitbucket.org/birkenfeld/sphinx/pull-request/193/builddoc-shouldnt-
    fail-on-unicode-paths/diff

    Change-Id: I2625eb3888111829a9da4d093b34193b8795f264
    Signed-off-by: Zhi Yan Liu <email address hidden>
    (cherry picked from commit 8160ae293383ec600c05fd2e4b38164bca7704c4)
    Conflicts:
            glance/tests/unit/v1/test_api.py
            glance/tests/unit/v1/test_registry_api.py
            tools/pip-requires

Thierry Carrez (ttx)
Changed in glance:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.