TestHTTPSVerifyCert - No appropriate failure message is received

Bug #1499355 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Undecided
David Sariel

Bug Description

Running tox -e py27 results in the following:

======================================================================
FAIL: glanceclient.tests.unit.test_ssl.TestHTTPSVerifyCert.test_v2_requests_valid_cert_no_key
tags: worker-0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/python-glanceclient/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "glanceclient/tests/unit/test_ssl.py", line 211, in test_v2_requests_valid_cert_no_key
    self.fail('No appropriate failure message is received')
  File "/tmp/python-glanceclient/.tox/py27/local/lib/python2.7/site-packages/unittest2/case.py", line 690, in fail
    raise self.failureException(msg)
AssertionError: No appropriate failure message is received
Schema is not a valid JSON object.
No metadata definition namespace passed via stdin or --file argument.
Schema is not a valid JSON object.
Schema is not a valid JSON object.
Unable to upload image data to an image which is active.
Schema is not a valid JSON object.
Property MyProperty not found in object MyObject.
======================================================================
FAIL: glanceclient.tests.unit.test_ssl.TestHTTPSVerifyCert.test_v2_requests_bad_cert
tags: worker-2
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/python-glanceclient/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "glanceclient/tests/unit/test_ssl.py", line 235, in test_v2_requests_bad_cert
    self.fail('Unexpected exception has been raised')
  File "/tmp/python-glanceclient/.tox/py27/local/lib/python2.7/site-packages/unittest2/case.py", line 690, in fail
    raise self.failureException(msg)
AssertionError: Unexpected exception has been raised
======================================================================
FAIL: glanceclient.tests.unit.test_ssl.TestHTTPSVerifyCert.test_v2_requests_bad_ca
tags: worker-3
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/python-glanceclient/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "glanceclient/tests/unit/test_ssl.py", line 253, in test_v2_requests_bad_ca
    self.fail('No appropriate failure message is received')
  File "/tmp/python-glanceclient/.tox/py27/local/lib/python2.7/site-packages/unittest2/case.py", line 690, in fail
    raise self.failureException(msg)
AssertionError: No appropriate failure message is received
Ran 438 tests in 3.592s
FAILED (id=0, failures=3, skips=1)

Revision history for this message
Niall Bunting (niall-bunting) wrote :

I have tested this on the most recent release and this does not seem to happen.

Changed in python-glanceclient:
status: New → Incomplete
Revision history for this message
David Sariel (dsariel) wrote :

Due to the change in python libs starting from 2.7.8 the messages
that SSL certificate handling module is producing for py27 are
different from error messages produced in earlier versions py27.

Fixed how the following test cases of TestHTTPSVerifyCert class
are handling erroneous SSL certification messages:

- test_v2_requests_valid_cert_no_key
- test_v2_requests_bad_cert
- test_v2_requests_bad_ca

The fix is available here: https://review.openstack.org/263790

I have a machine with python 2.7.8 and a machine with 2.7.5. On a machine
with 2.7.5 no problem is encountered while on machine with python 2.7.8 (and greater)
the error messages you have posted are obtained.

Posting here the messages to save time for someone that want to compare the messages
of py27 for different python versions:

*******************************************************************************************************************
test_v2_requests_valid_cert_no_key-./python-glanceclient/glanceclient/tests/unit/test_ssl.py (line 211)
PY3 (python lib > 3.x) and PY2 (python lib > 2.7.8) razing exception with exception string 'Error finding address for https://0.0.0.0:42189/v2/images/image123: [SSL] PEM lib (_ssl.c:2757)'

– CommunicationError() - exception

PY2 (e.g. python lib 2.7.5) razing exception with exception string 'Error finding address for https://0.0.0.0:42103/v2/images/image123: [Errno 336265225] _ssl.c:351: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib'

– CommunicationError() - exception

*******************************************************************************************************************
test_v2_requests_bad_cert - ./python-glanceclient/glanceclient/tests/unit/test_ssl.py(line 239)

PY3 (python lib > 3.x) and PY2 (python lib > 2.7.8) razing exception with exception string '[Errno 2] No such file or directory'

– PY2 - IOError(2, 'No such file or directory') exception

PY2 (e.g. python lib 2.7.5) razing exception with exception string “'Error finding address for https://0.0.0.0:54591/v2/images/image123: [Errno 336265218] _ssl.c:351: error:140B0002:SSL routines:SSL_CTX_use_PrivateKey_file:system lib'”

–PY2 - CommunicationError() - exception

*******************************************************************************************************************

test_v2_requests_bad_ca - ./python-glanceclient/glanceclient/tests/unit/test_ssl.py (256)

PY3 (python lib > 3.x) and PY2 (python lib > 2.7.8) razing exception with exception string 'Error finding address for https://0.0.0.0:57471/v2/images/image123: [Errno 2] No such file or directory'

–PY2 - CommunicationError() - exception

PY2 (e.g. python lib 2.7.5) razing exception with exception string 'Error finding address for https://0.0.0.0:40273/v2/images/image123: [Errno 185090050] _ssl.c:340: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib'

 –PY2 - CommunicationError() - exception

Changed in python-glanceclient:
assignee: nobody → David Sariel (dsariel)
status: Incomplete → Fix Committed
Changed in python-glanceclient:
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-glanceclient (master)

Reviewed: https://review.openstack.org/263790
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=f2eab45c33aa6838c6b2928573cc969bc55f0927
Submitter: Jenkins
Branch: master

commit f2eab45c33aa6838c6b2928573cc969bc55f0927
Author: David Sariel <email address hidden>
Date: Fri Jan 15 11:56:19 2016 +0200

    Fixed TestHTTPSVerifyCert failure messages

    Due to the change in python versions greater then 2.7.8, messages
    that SSL certificate handling module is producing are different
    from the error messages produced in earlier versions of py27.

    Fixed how the following test cases of TestHTTPSVerifyCert class
    are handling erroneous SSL certification messages:

    - test_v2_requests_valid_cert_no_key
    - test_v2_requests_bad_cert
    - test_v2_requests_bad_ca

    Closes-Bug:1499355
    Change-Id: I3b939292ba0042bced5cc91a26e2593450f9cafe

Changed in python-glanceclient:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-glanceclient 2.0.0

This issue was fixed in the openstack/python-glanceclient 2.0.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.