Tempest novnc tests fail behind reverse proxy

Bug #1748339 reported by Jan
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Undecided
Oleksandr Savatieiev

Bug Description

tempest.api.compute.servers.test_novnc.NoVNCConsoleTestJSON.test_novnc fails when the vncproxy api endpoint is run behind an nginx reverse proxy. The connection is successfully upgraded, but the tempest test expects the server reponse to come directly from WebSockify

https://github.com/openstack/tempest/blob/17.2.0/tempest/api/compute/servers/test_novnc.py#L157

This can be fixed in the nginx reverse proxy setup by adding "proxy_pass_header Server;" so that the proxied Server header is returned instead of nginx, but I would prefer to avoid that. Removing that assertion sounds like a bad idea, and I'm not sure what _validate_websocket_upgrade should instead test for, so I don't have any suggested fix.

tempest output:

tempest.api.compute.servers.test_novnc.NoVNCConsoleTestJSON.test_novnc[id-c640fdff-8ab4-45a4-a5d8-7e6146cbd0dc]
---------------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "/Users/cybojanek/.virtualenvs/tempest/lib/python2.7/site-packages/tempest/api/compute/servers/test_novnc.py", line 170, in test_novnc
        self._validate_websocket_upgrade()
      File "/Users/cybojanek/.virtualenvs/tempest/lib/python2.7/site-packages/tempest/api/compute/servers/test_novnc.py", line 158, in _validate_websocket_upgrade
        'Did not get the expected WebSocket HTTP Response.')
      File "/Users/cybojanek/.virtualenvs/tempest/lib/python2.7/site-packages/unittest2/case.py", line 702, in assertTrue
        raise self.failureException(msg)
    AssertionError: False is not true : Did not get the expected WebSocket HTTP Response.

Captured pythonlogging:
~~~~~~~~~~~~~~~~~~~~~~~
    2018-02-08 19:50:56,460 17605 DEBUG [tempest.lib.common.rest_client] Starting Request (NoVNCConsoleTestJSON:test_novnc): POST http://10.2.0.8:8774/v2.1/servers/10a8ccfd-92b2-47db-b0e1-7bac9bf2d18d/action
    2018-02-08 19:50:56,653 17605 INFO [tempest.lib.common.rest_client] Request (NoVNCConsoleTestJSON:test_novnc): 200 POST http://10.2.0.8:8774/v2.1/servers/10a8ccfd-92b2-47db-b0e1-7bac9bf2d18d/action 0.193s
    2018-02-08 19:50:56,653 17605 DEBUG [tempest.lib.common.rest_client] Request - Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': '<omitted>'}
            Body: {"os-getVNCConsole": {"type": "novnc"}}
        Response - Headers: {'status': '200', u'content-length': '118', 'content-location': 'http://10.2.0.8:8774/v2.1/servers/10a8ccfd-92b2-47db-b0e1-7bac9bf2d18d/action', u'x-compute-request-id': 'req-7ad1724b-43d0-4228-beaf-0c19e5c66c7e', u'vary': 'OpenStack-API-Version,X-OpenStack-Nova-API-Version', u'server': 'nginx/1.12.2', u'openstack-api-version': 'compute 2.1', u'connection': 'close', u'x-openstack-nova-api-version': '2.1', u'date': 'Fri, 09 Feb 2018 00:50:56 GMT', u'content-type': 'application/json', u'x-openstack-request-id': 'req-7ad1724b-43d0-4228-beaf-0c19e5c66c7e'}
            Body: {"console": {"url": "http://10.2.0.8:6080/vnc_auto.html?token=2f6c1ac1-05e3-469d-b133-d3a8f1da1f7b", "type": "novnc"}}

tcp stream dump from wireshark:

GET /websockify HTTP/1.1
Host: 10.2.0.8:6080
Upgrade: websocket
Connection: Upgrade
Cookie: token=bad6b5be15c-6207-45f5-8fbf-bbc22f5f7309
Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol: binary

HTTP/1.1 101 Switching Protocols
Server: nginx/1.12.2
Date: Fri, 09 Feb 2018 01:40:24 GMT
Connection: upgrade
Upgrade: websocket
Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=
Sec-WebSocket-Protocol: binary

Changed in tempest:
assignee: nobody → Oleksandr Savatieiev (osavatieiev)
status: New → In Progress
Revision history for this message
Oleksandr Savatieiev (osavatieiev) wrote :
Changed in tempest:
status: In Progress → Confirmed
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/557388
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=82b6aebee79e3a4709268a45861069cb87b3f96a
Submitter: Zuul
Branch: master

commit 82b6aebee79e3a4709268a45861069cb87b3f96a
Author: Alex Savatieiev <email address hidden>
Date: Wed Mar 28 17:56:49 2018 +0200

    VNC harcoded server name removed

      VNC server can be other than WebSockify, so there is a need to
      configure it once in a while for various deployments

        - added config option
        - updated test

    Change-Id: I938bae347eaa9fcf76e4118188b325ba6d3efa77
    Closes-Bug: #1748339

Changed in tempest:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tempest 19.0.0

This issue was fixed in the openstack/tempest 19.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.