swift test cases fail, response headers lack of "transfer-encoding"

Bug #1819851 reported by Zhangdaming on 2019-03-13
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I have tested server side directly by hand. I find there is 'transfer-encoding' header in response only when it is persistent connection。
I have checked the source test code, the test add "Connection:close" in the request explicitly,function as below

def request(self, url, method, *args, **kwargs):

        class Response(dict):
            def __init__(self, info):
                for key, value in info.getheaders().items():
                    # We assume HTTP header name to be string, not random
                    # bytes, thus ensure we have string keys.
                    self[six.u(key).lower()] = value
                self.status = info.status
                self['status'] = str(self.status)
                self.reason = info.reason
                self.version = info.version
                self['content-location'] = url

        original_headers = kwargs.get('headers', {})
        new_headers = dict(original_headers, connection='close')
        new_kwargs = dict(kwargs, headers=new_headers)

        # Follow up to 5 redirections. Don't raise an exception if
        # it's exceeded but return the HTTP 3XX response instead.
        retry = urllib3.util.Retry(raise_on_redirect=False, redirect=5)
        r = super(ClosingHttp, self).request(method, url, retries=retry,
                                             *args, **new_kwargs)
        return Response(r), r.data

function from "tempest.lib.common.http.ClosingHttp#request"

So I think it is not suitable to check 'transfer-encoding' header in test case 'tempest.api.object_storage.test_object_slo.ObjectSloTest.test_delete_large_object'
function as below:
    def test_delete_large_object(self):
        # delete static large object using multipart manifest
        object_name = self._create_large_object()

        params_del = {'multipart-manifest': 'delete'}
        resp, _ = self.object_client.delete_object(

        # When deleting SLO using multipart manifest, the response contains
        # not 'content-length' but 'transfer-encoding' header. This is the
        # special case, therefore the existence of response headers is checked
        # outside of custom matcher.
        self.assertIn('transfer-encoding', resp)
        self.assertIn('content-type', resp)
        self.assertIn('x-trans-id', resp)
        self.assertIn('date', resp)

function from "tempest.api.object_storage.test_object_slo.ObjectSloTest#test_delete_large_object"

Other information:
1.tempest version:18.0.0

2.test case name

3.client side debug log
Traceback (most recent call last):
  File "/home/tempest/refstack-client/.tempest/tempest/common/utils/__init__.py", line 107, in wrapper
    return func(*func_args, **func_kwargs)
  File "/home/tempest/refstack-client/.tempest/tempest/api/object_storage/test_object_slo.py", line 167, in test_delete_large_object
    self.assertIn('transfer-encoding', resp)
  File "/home/tempest/refstack-client/.tempest/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 417, in assertIn
    self.assertThat(haystack, Contains(needle), message)
  File "/home/tempest/refstack-client/.tempest/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 498, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'transfer-encoding' not in {'status': '200', 'content-location': 'https://swift.xx.xx.xx.com/v1/AUTH_e88b9cf6908b493fa7c5fd853f306df6/tempest-TestContainer-1214636738/tempest-TestObject-694206116?multipart-manifest=delete', u'connection': 'close', u'x-trans-id': 'tx05210000016974ad0aa80-3c39a872f5', u'date': 'Wed, 13 Mar 2019 01:31:31 GMT', u'content-type': 'text/plain'}
tags: -worker-0

4. server side header infomation

Zhangdaming (swift.hw) on 2019-03-13
description: updated
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers