swift shell does not always raise SysExit when error has occurred

Bug #1379229 reported by Alistair Coles
This bug report is a duplicate of:  Bug #973557: Swift cli doesn't return exit codes. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-swiftclient
Fix Committed
Undecided
Unassigned

Bug Description

Unit tests fail intermittently because the swiftclient shell has not raised SysExit when expected. For example, seen here:
http://logs.openstack.org/75/125275/6/check/gate-python-swiftclient-python27/ae69bda/testr_results.html.gz

ft1.138: tests.unit.test_shell.TestShell.test_upload_segmentsize_error_StringException: Traceback (most recent call last):
  File "/home/jenkins/workspace/gate-python-swiftclient-python27/.tox/py27/local/lib/python2.7/site-packages/mock.py", line 1618, in _inner
    return f(*args, **kw)
  File "/home/jenkins/workspace/gate-python-swiftclient-python27/.tox/py27/local/lib/python2.7/site-packages/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "tests/unit/test_shell.py", line 450, in test_upload_segmentsize_error
    self.assertRaises(SystemExit, swiftclient.shell.main, argv)
  File "/usr/lib/python2.7/unittest/case.py", line 475, in assertRaises
    callableObj(*args, **kwargs)
  File "/usr/lib/python2.7/unittest/case.py", line 116, in __exit__
    "{0} not raised".format(exc_name))
AssertionError: SystemExit not raised

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

Reviewed: https://review.openstack.org/127196
Committed: https://git.openstack.org/cgit/openstack/python-swiftclient/commit/?id=43c1141baa6c5a5987fd4ab71d1c2299898ea251
Submitter: Jenkins
Branch: master

commit 43c1141baa6c5a5987fd4ab71d1c2299898ea251
Author: Alistair Coles <email address hidden>
Date: Thu Oct 9 09:42:16 2014 +0100

    Fix race in shell when testing for errors to raise SysExit

    SysExit is raised if the OutputManager has non-zero
    error_count. However, error_count is incremented in
    a print thread, but tested on the main thread.
    Currently error_count is tested before the OutputManager
    print threads have exited, which results in a race. This race
    means that SysExit is not always raised even when an error
    has occured.

    This change moves the error_count test after the
    OutputManager context manager has exited, which ensures that
    the OutputManager threads have exited.

    Change-Id: I5ef7d9f10057fe2b41f48ab95066a7265b86a3ac
    Closes-Bug: #1379229

Changed in python-swiftclient:
status: New → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-swiftclient 2.4.0

This issue was fixed in the openstack/python-swiftclient 2.4.0 release.

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.