Commit Graph

18 Commits

Author SHA1 Message Date
ckonstanski 03900522d4 v2: Content-Type: application/octet-stream header always added
The bug: any existing Content-Type header cannot be found because the
call to headers.get() fails. Therefore we end up with two Content-Type
headers because a new one (applicaion/octet-stream) gets added
unconditionally. The cause: the strings (keys and values) in the headers
dict are converted from unicode sequences of type <str> to utf-8
sequences of type <bytes>. This happens in safe_encode()
(oslo_utils/encodeutils.py:66). <str> != <bytes> even if they appear to
have the same characters.

Hence, for python 3.x, _set_common_request_kwargs() adds content-type
to header even if custom content-type is set in the request.

This results in unsupported media type exception when glance client
is used with keystoneauth and python 3.x

The fix: follow the directions in encode_headers().
It says to do this just before sending the request. Honor this principle;
do not encode headers and then perform more business logic on them.

Change-Id: Idf6079b32f70bc171f5016467048e917d42f296d
Closes-bug: #1641239
Co-Authored-By: Pushkar Umaranikar <pushkar.umaranikar@intel.com>
2017-05-19 19:02:00 +00:00
wangxiyuan cbb46434e6 Replace tempest_lib with tempest.lib
As the tempest_lib is deprecated and the code has been moved into
tempest. We should use tempest.lib insteded of tempest_lib.

Change-Id: Id22f90a47056cd88f9524fc6015607c93f7d88b5
2016-06-27 17:26:02 +08:00
yangds 03f13e471a trival: fix a typo in comment
s/thouhg/though

Change-Id: I483ac7b3f9d9ecac7d6697e6dbd18e0e39669bfd
2016-02-15 06:44:49 -05:00
kairat_kushaev 29fcefc67a Fix warnings in glanceclient README
README.rst file for functional tests and glanceclient itself
raises some warnings when passing these docs through REST
validator and build the doc:
- Need additional empty line to provide correct indent in
cloud.yaml example
- Title should be with the same length as overline.
The patch fixes these warnings.

Change-Id: I2e2ef6f838ee639d1a88256b6e321181a62cc76b
2016-02-01 13:15:01 +03:00
Kyrylo Romanenko 698f53d241 Update set of wanted commands in read-only test
Nowadays Glance supports more subcommands.
Closes-Bug: #1520585

Change-Id: Ic95c26df31dc3bfb4436969e728f7a1a7c50ff0c
2015-11-27 15:58:19 +02:00
Alexey Galkin 0ac91856ca Fix 'test_help' for shell client.
Added new items in 'wanted_commands'.

Related bug: #1508356

Change-Id: I21ca66d51ace18ac58d33d5d542f805150cb8e4f
2015-11-13 13:06:23 +00:00
Jenkins 785ced37ae Merge "Add documentation for running the functional tests" 2015-11-02 14:00:17 +00:00
Stuart McLaren 8a4cd7916b Add documentation for running the functional tests
Change-Id: I824f6cd2aa988ed1e4025765971161b44993f00a
2015-10-21 13:33:41 +00:00
Monty Taylor 84538d8870 Use clouds.yaml from devstack for functional tests
devstack produces a file called clouds.yaml already with credentials in
it. Rather than producing our own config file to run functional tests,
just consume the clouds.yaml file that's already there.

Closes-Bug: #1507386
Change-Id: I82c071b2cd903b9578d1f2ec515882c815812692
2015-10-21 05:43:26 +09:00
Flavio Percoco 1322fbc5d8 Consider --os-token when using v2
The `_cache_schemas` call currently forces authentication even when the
`auth_token` and `os_image_url` are passed. Instead of handling forced
authentications, let the client use the passed arguments and
authenticate only once if needed.

This was not caught by the existing tests because the call to
`_cache_schemas` was mocked.

Change-Id: I93cec9a68cafc0992d14dab38114d03e25f1e5da
Closes-bug: #1490462
2015-09-04 13:31:55 +02:00
Flavio Percoco 47423ebbb2 Check if v2 is available and fallback
We have a basic implementation for a fallback mechanism that will use v1
rather than v2 when downloading schema files from glance-api fails.
However, this is not sound. If the schemas are cached already, we won't
check if v2 is available and fail to fallback.

This patch fixes the aforementioned issue by getting the list of
available versions from the server only when the API versions was not
explicitly specified through the CLI. That is, for all commands that
don't pass `--os-image-api-version 2`, we'll check v2's availability and
we'll fallback to v1 if it isn't available.

This patch also changes how we handle `/versions` calls in the client.
The server has been, incorrectly, replying to requests to `/version`
with a 300 error, which ended up in the client re-raising such
exception. While I think 300 shouldn't raise an exception, I think we
should handle that in a spearate patch. Therefore, this patch just
avoids raising such exception when `/version` is explicitly called.

This fallback behaviour and the check on `/versions` will be removed in
future versions of the client. The later depends on this bug[0] being
fixed.

[0] https://bugs.launchpad.net/glance/+bug/1491350

Closes-bug: #1489381
Change-Id: Ibeba6bc86db2a97b8a2b4bd042248464cd792e5e
2015-09-04 13:31:55 +02:00
Takashi NATSUME 90b7dc4141 Update path to subunit2html in post_test_hook
Per:

http://lists.openstack.org/pipermail/openstack-dev/2015-August/072982.html

The location of subunit2html changed on the images in the gate
so update the path used in the post_test_hook.

Long-term we should just use what's in devstack-gate.

Change-Id: I142b3c0590ba2fa880973b0ee306ebd1db27fd03
Closes-Bug: #1491646
2015-09-04 10:29:01 +09:00
Stuart McLaren 618637a5bd Remove custom SSL compression handling
Custom SSL handling was introduced because disabling SSL layer compression
provided an approximately five fold performance increase in some
cases. Without SSL layer compression disabled the image transfer would be
CPU bound -- with the CPU performing the DEFLATE algorithm.  This would
typically limit image transfers to < 20 MB/s. When --no-ssl-compression
was specified the client would not negotiate any compression algorithm
during the SSL handshake with the server which would remove the CPU
bottleneck and transfers could approach wire speed.

In order to support '--no-ssl-compression' two totally separate code
paths exist depending on whether this is True or False.  When SSL
compression is disabled, rather than using the standard 'requests'
library, we enter some custom code based on pyopenssl and httplib in
order to disable compression.

This patch/spec proposes removing the custom code because:

* It is a burden to maintain

 Eg adding new code such as keystone session support is more complicated

* It can introduce additional failure modes

 We have seen some bugs related to the 'custom' certificate checking

* Newer Operating Systems disable SSL for us.

 Eg. While Debian 7 defaulted to compression 'on', Debian 8 has compression
 'off'. This makes both servers and client less likely to have compression
 enabled.

* Newer combinations of 'requests' and 'python' do this for us

 Requests disables compression when backed by a version of python which
 supports it (>= 2.7.9). This makes clients more likely to disable
 compression out-of-the-box.

* It is (in principle) possible to do this on older versions too

 If pyopenssl, ndg-httpsclient and pyasn1 are installed on older
 operating system/python combinations, the requests library should
 disable SSL compression on the client side.

* Systems that have SSL compression enabled may be vulnerable to the CRIME
(https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-4929) attack.
Installations which are security conscious should be running the Glance
server with SSL disabled.

Full Spec: https://review.openstack.org/#/c/187674
Blueprint: remove-custom-client-ssl-handling

Change-Id: I7e7761fc91b0d6da03939374eeedd809534f6edf
2015-08-26 12:26:21 +00:00
Fei Long Wang 181131ef2e Use API v2 as default
Now we have claimed v2 is the current API version of Glance,
we should change the Glance client as well to be consistent
with Glance server.

DocImpact

Change-Id: I09c9e409d149e2d797785591183e06c13229b7f7
2015-08-11 14:01:28 +12:00
Darja Shakhray ec0f2dfd85 Enable flake8 checks
This commit enables new flake8 checks:
* E265  block comment should start with '# '
* H405  multi line docstring summary not separated with an empty line
* E123  closing bracket does not match indentation of opening bracket's line
* H238  old style class declaration, use new style (inherit from `object`)
* E128  continuation line under-indented for visual indent
and makes related changes in the code.

Change-Id: Ie993afc930f6b74d7a990bcaa9fc0e9f5ba1585c
2015-07-21 17:08:27 +03:00
Stuart McLaren 9f5c58193b Fix functional tests in gate
The check-glanceclient-dsvm-functional gate job was failing due to the
functional tests not picking up valid OpenStack credentials.

Update how we aquire credentials -- fixes side effect of how tox 2.0
handles environment variables.

Change-Id: Ia665dc9673d09421508476d05039d2da8a5e1a29
Closes-bug: 1455102
2015-05-15 13:18:00 -04:00
Louis Taylor 9c172fb056 Add some basic CLI functional tests
This ports over most of the functional glanceclient cli tests out from
tempest.

Change-Id: I59d409ade72c289ed9942ce374cae732a40518aa
2015-05-01 17:03:40 +00:00
Stuart McLaren 71d97836f8 Create functional test base
This will allow adding 'check-glanceclient-dsvm-functional' tests in
the gate, similar to:

 * check-novaclient-dsvm-functional
 * check-keystoneclient-dsvm-functional
 * check-neutronclient-dsvm-functional
 * etc

Change-Id: Id970db52695db7dc53206aa05fe573995b57aa78
2015-04-18 17:43:01 +00:00