Comment 33 for bug 1482633

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

Reviewed: https://review.opendev.org/735900
Committed: https://git.openstack.org/cgit/openstack/oslo.service/commit/?id=caf66be763fd8f99ccfa57a8e465aaf1b85b5fe8
Submitter: Zuul
Branch: master

commit caf66be763fd8f99ccfa57a8e465aaf1b85b5fe8
Author: Hervé Beraud <email address hidden>
Date: Tue Jun 16 14:42:03 2020 +0200

    Fix wsgi SSL tests for wsgi module under python 3

    Previously some tests were ignored under python 3 environment, this was
    due to some design changes introduced by python 3.7 [1] in the SSL
    module of the stdlib. These changes reactivate some of them (some other
    are still skipped and needs further works).

    Indeed, when we try to use requests with SSL in a monkey patched
    environment we faced the following issue:

    ```
    TypeError: wrap_socket() got an unexpected keyword argument '_context'
    ```

    This is due to the fact that we are in a monkey patched environment
    where `requests` is monkey patched too.

    We don't need `request` for our needs. Indeed we can easily send
    http requests through low level socket. Our main goal is to test
    our wsgi server and not to test the `requests` library, and `requests`
    was just used to make the code more simpler.

    In our case we can implement a code dedicated to send request to our green
    server, unlock our tests and move away from this bug/side effect.

    Also this reactivated test will check WSGI server with and without SSL,
    so these changes add changes that allow us to submit a request without
    wrapping the socket with SSL.

    These changes move away from `requests` which is badly monkey patched by
    eventlet [1]. Now we use monkey patched socket and ssl to
    request the green server which is executed in background. Low level
    (monkey patched) modules could help us to skirt layers that are possibly
    badly monkey patched on higher level modules (urllib, requests, etc...).

    [1] https://github.com/eventlet/eventlet/issues/526#issuecomment-482694279
    [2] https://github.com/eventlet/eventlet/issues/526

    Change-Id: I3a018d507d102266c1e2fc9b6732a9c09fa2bb49
    Closes-Bug: #1482633