[jira] [Commented] (LIBCLOUD-945) testsuite fails on i686

2017-09-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16172182#comment-16172182
 ] 

ASF GitHub Bot commented on LIBCLOUD-945:
-

Github user asfgit closed the pull request at:

https://github.com/apache/libcloud/pull/


> testsuite fails on i686
> ---
>
> Key: LIBCLOUD-945
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-945
> Project: Libcloud
>  Issue Type: Bug
> Environment: build of python-apache-libcloud 2.2.0 on archlinux with 
> python3 on intel 32 bit
>Reporter: Erich Eckner
>Assignee: Tomaz Muraus
>  Labels: build
>
> There are several failures during test, because of type mismatches
> === FAILURES 
> ===
>  AzureBlobsTests.test_upload_object_invalid_md5 
> 
> self =  testMethod=test_upload_object_invalid_md5>
> def test_upload_object_invalid_md5(self):
> # Invalid md5 is returned by azure
> self.mock_response_klass.type = 'INVALID_HASH'
> 
> container = Container(name='foo_bar_container', extra={},
>   driver=self.driver)
> object_name = 'foo_test_upload'
> file_path = os.path.abspath(__file__)
> try:
> self.driver.upload_object(file_path=file_path, 
> container=container,
>   object_name=object_name,
> > verify_hash=True)
> libcloud/test/storage/test_azure_blobs.py:640: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> libcloud/storage/drivers/azure_blobs.py:771: in upload_object
> use_lease=ex_use_lease)
> libcloud/storage/drivers/azure_blobs.py:895: in _put_object
> stream=stream)
> libcloud/storage/base.py:627: in _upload_object
> headers=headers, raw=True)
> libcloud/common/base.py:590: in request
> stream=stream)
> libcloud/test/__init__.py:163: in prepared_request
> raw=raw, stream=stream)
> libcloud/http.py:227: in prepared_request
> prepped = self.session.prepare_request(req)
> /usr/lib/python2.7/site-packages/requests/sessions.py:437: in prepare_request
> hooks=merge_hooks(request.hooks, self.hooks),
> /usr/lib/python2.7/site-packages/requests/models.py:306: in prepare
> self.prepare_headers(headers)
> /usr/lib/python2.7/site-packages/requests/models.py:440: in prepare_headers
> check_header_validity(header)
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> header = ('Content-Length', 37589L)
> def check_header_validity(header):
> """Verifies that header value is a string which doesn't contain
> leading whitespace or return characters. This prevents unintended
> header injection.
> 
> :param header: tuple, in the format (name, value).
> """
> name, value = header
> 
> if isinstance(value, bytes):
> pat = _CLEAN_HEADER_REGEX_BYTE
> else:
> pat = _CLEAN_HEADER_REGEX_STR
> try:
> if not pat.match(value):
> raise InvalidHeader("Invalid return character or leading 
> space in header: %s" % name)
> except TypeError:
> raise InvalidHeader("Value for header {%s: %s} must be of type 
> str or "
> >   "bytes, not %s" % (name, value, type(value)))
> E   InvalidHeader: Value for header {Content-Length: 37589} must be 
> of type str or bytes, not 
> /usr/lib/python2.7/site-packages/requests/utils.py:872: InvalidHeader
> ___ AzureBlobsTests.test_upload_page_object_success 
> 
> self =  testMethod=test_upload_page_object_success>
> def test_upload_page_object_success(self):
> self.mock_response_klass.use_param = None
> file_path = tempfile.mktemp(suffix='.jpg')
> file_size = AZURE_PAGE_CHUNK_SIZE * 4
> 
> with open(file_path, 'w') as file_hdl:
> file_hdl.write('0' * file_size)
> 
> container = Container(name='foo_bar_container', extra={},
>   driver=self.driver)
> object_name = 'foo_test_upload'
> extra = {'meta_data': {'some-value': 'foobar'}}
> obj = self.driver.upload_object(file_path=file_path,
> container=container,
> object_name=object_name,
> extra=extra,
> verify_hash=False,
> >   ex_blob_type='PageBlob')
> libcloud/test/storage/test_azure_blobs.py:707: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> 

[jira] [Commented] (LIBCLOUD-945) testsuite fails on i686

2017-09-19 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16172179#comment-16172179
 ] 

ASF subversion and git services commented on LIBCLOUD-945:
--

Commit 28a5590425aefc2983d40b71b4372e3340ceeecf in libcloud's branch 
refs/heads/trunk from [~kami]
[ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=28a5590 ]

Fix Azure blobs driver, make sure Content-Length header value is a
string and not a number.

Part of LIBCLOUD-945

Closes #


> testsuite fails on i686
> ---
>
> Key: LIBCLOUD-945
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-945
> Project: Libcloud
>  Issue Type: Bug
> Environment: build of python-apache-libcloud 2.2.0 on archlinux with 
> python3 on intel 32 bit
>Reporter: Erich Eckner
>Assignee: Tomaz Muraus
>  Labels: build
>
> There are several failures during test, because of type mismatches
> === FAILURES 
> ===
>  AzureBlobsTests.test_upload_object_invalid_md5 
> 
> self =  testMethod=test_upload_object_invalid_md5>
> def test_upload_object_invalid_md5(self):
> # Invalid md5 is returned by azure
> self.mock_response_klass.type = 'INVALID_HASH'
> 
> container = Container(name='foo_bar_container', extra={},
>   driver=self.driver)
> object_name = 'foo_test_upload'
> file_path = os.path.abspath(__file__)
> try:
> self.driver.upload_object(file_path=file_path, 
> container=container,
>   object_name=object_name,
> > verify_hash=True)
> libcloud/test/storage/test_azure_blobs.py:640: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> libcloud/storage/drivers/azure_blobs.py:771: in upload_object
> use_lease=ex_use_lease)
> libcloud/storage/drivers/azure_blobs.py:895: in _put_object
> stream=stream)
> libcloud/storage/base.py:627: in _upload_object
> headers=headers, raw=True)
> libcloud/common/base.py:590: in request
> stream=stream)
> libcloud/test/__init__.py:163: in prepared_request
> raw=raw, stream=stream)
> libcloud/http.py:227: in prepared_request
> prepped = self.session.prepare_request(req)
> /usr/lib/python2.7/site-packages/requests/sessions.py:437: in prepare_request
> hooks=merge_hooks(request.hooks, self.hooks),
> /usr/lib/python2.7/site-packages/requests/models.py:306: in prepare
> self.prepare_headers(headers)
> /usr/lib/python2.7/site-packages/requests/models.py:440: in prepare_headers
> check_header_validity(header)
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> header = ('Content-Length', 37589L)
> def check_header_validity(header):
> """Verifies that header value is a string which doesn't contain
> leading whitespace or return characters. This prevents unintended
> header injection.
> 
> :param header: tuple, in the format (name, value).
> """
> name, value = header
> 
> if isinstance(value, bytes):
> pat = _CLEAN_HEADER_REGEX_BYTE
> else:
> pat = _CLEAN_HEADER_REGEX_STR
> try:
> if not pat.match(value):
> raise InvalidHeader("Invalid return character or leading 
> space in header: %s" % name)
> except TypeError:
> raise InvalidHeader("Value for header {%s: %s} must be of type 
> str or "
> >   "bytes, not %s" % (name, value, type(value)))
> E   InvalidHeader: Value for header {Content-Length: 37589} must be 
> of type str or bytes, not 
> /usr/lib/python2.7/site-packages/requests/utils.py:872: InvalidHeader
> ___ AzureBlobsTests.test_upload_page_object_success 
> 
> self =  testMethod=test_upload_page_object_success>
> def test_upload_page_object_success(self):
> self.mock_response_klass.use_param = None
> file_path = tempfile.mktemp(suffix='.jpg')
> file_size = AZURE_PAGE_CHUNK_SIZE * 4
> 
> with open(file_path, 'w') as file_hdl:
> file_hdl.write('0' * file_size)
> 
> container = Container(name='foo_bar_container', extra={},
>   driver=self.driver)
> object_name = 'foo_test_upload'
> extra = {'meta_data': {'some-value': 'foobar'}}
> obj = self.driver.upload_object(file_path=file_path,
> container=container,
> object_name=object_name,
> extra=extra,
> 

[jira] [Commented] (LIBCLOUD-945) testsuite fails on i686

2017-09-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16171931#comment-16171931
 ] 

ASF GitHub Bot commented on LIBCLOUD-945:
-

GitHub user Kami opened a pull request:

https://github.com/apache/libcloud/pull/

[Common] Make sure we normalize header types for test mock connection class

This pull request fixes the issue reported in 
https://issues.apache.org/jira/browse/LIBCLOUD-945.

We normalized header types inside the actual Connection class, but not 
inside the Connection class used by the tests. That's why some of the tests 
failed with newer version of `requests` which doesn't automatically cast header 
values to strings anymore.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Kami/libcloud make_sure_hader_value_is_string

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/libcloud/pull/.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #


commit 7953b24e5126a193b1a5925ee7fa52c7cf0a3a3d
Author: Tomaz Muraus 
Date:   2017-09-19T15:27:27Z

Fix Azure blobs driver, make sure Content-Length header value is a
string and not a number.

Part of LIBCLOUD-945

commit 6e19a63847a6a554aef9078c7efce60c175ad32e
Author: Tomaz Muraus 
Date:   2017-09-19T15:28:08Z

Add test cases for it.

Part of LIBCLOUD-745.




> testsuite fails on i686
> ---
>
> Key: LIBCLOUD-945
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-945
> Project: Libcloud
>  Issue Type: Bug
> Environment: build of python-apache-libcloud 2.2.0 on archlinux with 
> python3 on intel 32 bit
>Reporter: Erich Eckner
>Assignee: Tomaz Muraus
>  Labels: build
>
> There are several failures during test, because of type mismatches
> === FAILURES 
> ===
>  AzureBlobsTests.test_upload_object_invalid_md5 
> 
> self =  testMethod=test_upload_object_invalid_md5>
> def test_upload_object_invalid_md5(self):
> # Invalid md5 is returned by azure
> self.mock_response_klass.type = 'INVALID_HASH'
> 
> container = Container(name='foo_bar_container', extra={},
>   driver=self.driver)
> object_name = 'foo_test_upload'
> file_path = os.path.abspath(__file__)
> try:
> self.driver.upload_object(file_path=file_path, 
> container=container,
>   object_name=object_name,
> > verify_hash=True)
> libcloud/test/storage/test_azure_blobs.py:640: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> libcloud/storage/drivers/azure_blobs.py:771: in upload_object
> use_lease=ex_use_lease)
> libcloud/storage/drivers/azure_blobs.py:895: in _put_object
> stream=stream)
> libcloud/storage/base.py:627: in _upload_object
> headers=headers, raw=True)
> libcloud/common/base.py:590: in request
> stream=stream)
> libcloud/test/__init__.py:163: in prepared_request
> raw=raw, stream=stream)
> libcloud/http.py:227: in prepared_request
> prepped = self.session.prepare_request(req)
> /usr/lib/python2.7/site-packages/requests/sessions.py:437: in prepare_request
> hooks=merge_hooks(request.hooks, self.hooks),
> /usr/lib/python2.7/site-packages/requests/models.py:306: in prepare
> self.prepare_headers(headers)
> /usr/lib/python2.7/site-packages/requests/models.py:440: in prepare_headers
> check_header_validity(header)
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> header = ('Content-Length', 37589L)
> def check_header_validity(header):
> """Verifies that header value is a string which doesn't contain
> leading whitespace or return characters. This prevents unintended
> header injection.
> 
> :param header: tuple, in the format (name, value).
> """
> name, value = header
> 
> if isinstance(value, bytes):
> pat = _CLEAN_HEADER_REGEX_BYTE
> else:
> pat = _CLEAN_HEADER_REGEX_STR
> try:
> if not pat.match(value):
> raise InvalidHeader("Invalid return character or leading 
> space in header: %s" % name)
> except TypeError:
> raise InvalidHeader("Value for header {%s: %s} must be of type 
> str or "
> >   "bytes, not %s" % (name, value, type(value)))
> E   InvalidHeader: Value for header {Content-Length: 37589} must be 
> 

[jira] [Commented] (LIBCLOUD-945) testsuite fails on i686

2017-09-19 Thread Tomaz Muraus (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16171877#comment-16171877
 ] 

Tomaz Muraus commented on LIBCLOUD-945:
---

I believe this is related to one of the recent version of requests library 
which doesn't automatically cast header values to string anymore.

In any case, I believe fix on our side should be quite easy.

> testsuite fails on i686
> ---
>
> Key: LIBCLOUD-945
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-945
> Project: Libcloud
>  Issue Type: Bug
> Environment: build of python-apache-libcloud 2.2.0 on archlinux with 
> python3 on intel 32 bit
>Reporter: Erich Eckner
>  Labels: build
>
> There are several failures during test, because of type mismatches
> === FAILURES 
> ===
>  AzureBlobsTests.test_upload_object_invalid_md5 
> 
> self =  testMethod=test_upload_object_invalid_md5>
> def test_upload_object_invalid_md5(self):
> # Invalid md5 is returned by azure
> self.mock_response_klass.type = 'INVALID_HASH'
> 
> container = Container(name='foo_bar_container', extra={},
>   driver=self.driver)
> object_name = 'foo_test_upload'
> file_path = os.path.abspath(__file__)
> try:
> self.driver.upload_object(file_path=file_path, 
> container=container,
>   object_name=object_name,
> > verify_hash=True)
> libcloud/test/storage/test_azure_blobs.py:640: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> libcloud/storage/drivers/azure_blobs.py:771: in upload_object
> use_lease=ex_use_lease)
> libcloud/storage/drivers/azure_blobs.py:895: in _put_object
> stream=stream)
> libcloud/storage/base.py:627: in _upload_object
> headers=headers, raw=True)
> libcloud/common/base.py:590: in request
> stream=stream)
> libcloud/test/__init__.py:163: in prepared_request
> raw=raw, stream=stream)
> libcloud/http.py:227: in prepared_request
> prepped = self.session.prepare_request(req)
> /usr/lib/python2.7/site-packages/requests/sessions.py:437: in prepare_request
> hooks=merge_hooks(request.hooks, self.hooks),
> /usr/lib/python2.7/site-packages/requests/models.py:306: in prepare
> self.prepare_headers(headers)
> /usr/lib/python2.7/site-packages/requests/models.py:440: in prepare_headers
> check_header_validity(header)
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> header = ('Content-Length', 37589L)
> def check_header_validity(header):
> """Verifies that header value is a string which doesn't contain
> leading whitespace or return characters. This prevents unintended
> header injection.
> 
> :param header: tuple, in the format (name, value).
> """
> name, value = header
> 
> if isinstance(value, bytes):
> pat = _CLEAN_HEADER_REGEX_BYTE
> else:
> pat = _CLEAN_HEADER_REGEX_STR
> try:
> if not pat.match(value):
> raise InvalidHeader("Invalid return character or leading 
> space in header: %s" % name)
> except TypeError:
> raise InvalidHeader("Value for header {%s: %s} must be of type 
> str or "
> >   "bytes, not %s" % (name, value, type(value)))
> E   InvalidHeader: Value for header {Content-Length: 37589} must be 
> of type str or bytes, not 
> /usr/lib/python2.7/site-packages/requests/utils.py:872: InvalidHeader
> ___ AzureBlobsTests.test_upload_page_object_success 
> 
> self =  testMethod=test_upload_page_object_success>
> def test_upload_page_object_success(self):
> self.mock_response_klass.use_param = None
> file_path = tempfile.mktemp(suffix='.jpg')
> file_size = AZURE_PAGE_CHUNK_SIZE * 4
> 
> with open(file_path, 'w') as file_hdl:
> file_hdl.write('0' * file_size)
> 
> container = Container(name='foo_bar_container', extra={},
>   driver=self.driver)
> object_name = 'foo_test_upload'
> extra = {'meta_data': {'some-value': 'foobar'}}
> obj = self.driver.upload_object(file_path=file_path,
> container=container,
> object_name=object_name,
> extra=extra,
> verify_hash=False,
> >   ex_blob_type='PageBlob')
> libcloud/test/storage/test_azure_blobs.py:707: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _