summaryrefslogtreecommitdiff
path: root/glanceclient/tests
Commit message (Collapse)AuthorAgeFilesLines
...
| * Do not quote '+' for token headerwangxiyuan2018-07-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The token in request header may contain url char, such as '+', if quote it, '+' will change to '%2B' which will lead to 401 error. Our CI doesn't notice this bug because Keystone use fernet token which doesn't contain url char by default. But token format in keystone is plugable, some out-tree token formats may contain url char (for example, PKI/PKIZ token). So we should skip quote token to avoiding information changing. Closes-bug: #1783290 Change-Id: I5aa71b3e2b9b19581e46ccf8a80eda5d637f17d1
* | Add support for hide old imagesAbhishek Kekane2018-07-251-8/+123
|/ | | | | | | | Added --hidden argument to list, create and update call. Related to blueprint hidden-images Change-Id: I1f2dcaa545c9da883186b20a96a70c7df994b994
* Merge "Unit tests for multi-store support"Zuul2018-07-251-0/+232
|\
| * Unit tests for multi-store supportAbhishek Kekane2018-07-241-0/+232
| | | | | | | | | | | | Related to blueprint multi-store Change-Id: Ib22cc5fd4eee0326c307abb236ef31a39edfa6a6
* | Merge "Add multi-store support"Zuul2018-07-251-4/+6
|\ \ | |/
| * Add multi-store supportAbhishek Kekane2018-07-241-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | Added multi-store support. User can now use '--backend' option to pass desired store while creating, uploading or importing image to speific store backend. Added new command 'stores-info' which will return available stores information to the user. Related to blueprint multi-store Change-Id: I7370094fc4ed47205b5a86a18b22aaa7b9457e5b
* | Add support for multihashAbhishek Kekane2018-07-231-0/+76
|/ | | | | | Related to blueprint multihash Change-Id: Iff4a5fe224b5d47255d7f23f65bbc08468f47f02
* update shell tests to not rely on the serialization order of a dictDoug Hellmann2018-06-071-8/+8
| | | | | | | | | Under python 3 with ordering randomized we cannot depend on the JSON output matching exactly. Instead we de-serialize the data structure that was written and compare the structures, which will always match. Change-Id: I134b62413a7cde25f3efda6a2452c1e3d11d41d0 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* Image show: print human readable string when the virtual size is unknownCyril Roelandt2018-05-311-0/+38
| | | | | | | | | Currently, when the virtual size of an image is not known, "None" is displayed. To a regular user, it feels like a programming error. We try and make things clearer by using a "human readable" string instead. Change-Id: Id7b8799356857d9bc58cc8a3677024fe1a7f4f56 Partial-Bug: #1665037
* Merge "Removes unicode 'u' response from "glance image-tag-update""Zuul2018-05-181-0/+36
|\
| * Removes unicode 'u' response from "glance image-tag-update"Abijitha Nadagouda2018-02-021-0/+36
| | | | | | | | | | | | | | | | | | | | | | "glance image-tag-update" command returns unicoded response for lists. Therefore it requires print_list method from util class to handle such case. Added unicode_key_value_to_string() method to remove extra 'u' from lists and dictionaries. This fix is inspired from cinderclient's implementation. Change-Id: I16a04e8d34f7629f72fe389456001ca1db9335ea Closes-bug: #1534046
* | Handle HTTP headers per RFC 8187Brian Rosmaita2018-05-171-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to RFC 8187, HTTP headers should use 7-bit ASCII encoding. The glanceclient was encoding them as UTF-8, which can leave the 8th bit nonzero when representing unicode, and which presents problems for any recipient following the standard and decoding the headers as ASCII. This change requires keystoneauth1 3.6.2, which has a fix for a bug that made it unable to handle bytes in headers. The dependency is a patch bumping the keystoneauth1 version in upper-constraints. Depends-on: https://review.openstack.org/#/c/569138/ Change-Id: I0d14974126fcb20e23a37347f4f1756c323cf2f5 Closes-bug: #1766235
* | Merge "Split glanceclient functional tests"Zuul2018-04-126-16/+75
|\ \
| * | Split glanceclient functional testsBrian Rosmaita2018-03-286-16/+75
| |/ | | | | | | | | | | | | | | | | | | | | | | Prepare for the Image API v1 to be removed from glance during Rocky by splitting the functional tests that hit v1 from the tests that hit v2. Introduce a new job that runs the functional-v1 tests against a devstack running glance stable/queens, and configure this job for both check and gate for the glanceclient. The v2 functional tests continue to be run for both check and gate against a devstack running glance master. Change-Id: Ifa98ada26a84e4cca3ea8c98173f61a6174cca27
* | Merge "Update local copy of image schema for 2.6"Zuul2018-04-111-1/+4
|\ \
| * | Update local copy of image schema for 2.6Brian Rosmaita2018-04-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Update the local copy of the image schema to reflect Image API 2.6. Change-Id: Ib0e56027927880d0fa198ffd8ea4b57e39f9d0fe Closes-bug: #1762044 Depends-on: https://review.openstack.org/#/c/559501/
* | | Make image-import fail fasterBrian Rosmaita2018-04-041-8/+196
|/ / | | | | | | | | | | | | | | Add checks to image-import command so that it provides better user feedback in failure situations. Change-Id: I8b6b32c3d1d1a745aa68ff8dc629419dff9bb130 Closes-bug: #1758718
* | Make image-create-via-import fail fasterBrian Rosmaita2018-04-041-16/+475
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add checks to the image-create-via-import commmand so that it provides better user feedback and doesn't begin the import workflow unless the input has a chance of succeeding. Preserves backward compatibility with the current image-create command by (1) allowing an image record only to be created when no import-method is specified AND no data is supplied, and (2) doing the glance-direct workflow when no import- method is specified AND data is provided. Also adds the ability for the import-method to be set as an env var OS_IMAGE_IMPORT_METHOD. Change-Id: I0a225f5471a9311217b5d90ebb5fd415c369129a Closes-bug: #1758149
* | Fix intermittent v2 shell unit test failuresBrian Rosmaita2018-03-291-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The do_image_download code has a check to make sure that there's a place to put the data (either filename or stdout redirect) before initiating the download. The location of this check was moved by change I841bebeda38814235079429eca0b1e5fd2f04dae to happen at the beginning of the function. The two intermittently failing tests do not explicitly address the check condition, and as a result the tests do exit early, but before they can check what they're supposed to be testing. Closes-bug: #1759951 Change-Id: I3c85bb358f669504b364d55618c21382b7a2a66b
* | Merge "Remove usage of ordereddict"Zuul2018-03-261-4/+1
|\ \
| * | Remove usage of ordereddictDirk Mueller2018-03-081-4/+1
| |/ | | | | | | | | | | | | This was only needed for Python < 2.7, but glanceclient's setup.cfg already declares compatibility only with 2.7. Change-Id: I80d42abf5dd5565da424a90a93545ba82ef7a58d
* | Check for container,disk_format on web-downloadBrian Rosmaita2018-03-221-0/+40
| | | | | | | | | | | | | | | | | | Fail image-create-via-import requests for the web-download import method that don't include values for container_format or disk_format. Closes-bug: #1757927 Change-Id: Ic5c81916823ff32f2dbddd32b40e825de0697dc9
* | Add support for web-download import methodPranaliD2018-03-213-0/+55
|/ | | | | | | | | | | | | This change adds support for 'web-download' import method to 'image-import' and 'create-image-via-import' call. To use this 'web-download' import method, user needs to pass --uri option 'a valid uri to external image to import in glance' to 'image-import' and 'create-image-via-imaport' calls. Co-authored-by: Pranali Deore <pdeore@redhat.com> Co-authored-by: Erno Kuvaja <jokke@usr.fi> Change-Id: I0e1d18844f64723608288de473e97710798eb602
* Remove deprecated ssl optionsRui Yuan Dou2018-01-171-11/+0
| | | | | | | | Old deprecated ssl options block the new keystoneauth parser get the correct value, should be removed. Change-Id: Ie080f9a8fa7f4407b1fcbb7fb7c763152c5ec295 Closes-Bug: 1697163
* Compare against 'RequestIdProxy.wrapped'Stephen Finucane2018-01-021-5/+4
| | | | | | | | | | | | Due to the 'glanceclient.common.utils.add_req_id_to_object' decorator, an instance of 'glanceclient.common.utils.RequestIdProxy' is returned for most calls in glanceclient. If we wish to compare to None, we have to compare the contents of this wrapper and not the wrapper itself. Unit tests are updated to highlight this. Change-Id: I7dadf32d37ac2bda33a92c71d5882e9f23e38a82 Closes-Bug: #1736759
* Revise functional testing README fileBrian Rosmaita2017-12-151-8/+17
| | | | | | Clarifies the location of clouds.yaml for functional testing. Change-Id: Ib0b8e84579bca72e791229752df14542358e21b7
* Migrate dsvm functional test jobs to project repoBrian Rosmaita2017-12-141-46/+0
| | | | | | | | | | | | | | Migrate legacy dsvm functional test jobs for python-glanceclient to the project repository as zuul3 jobs using the devstack functional base job. Co-authored-by: Monty Taylor <mordred@inaugust.com> Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com> Needed-By: I0b974bf60da6bafabeb037a75ac10654e2a6406c Needed-By: I0271a1430843ef546e991a7a3c4b572b3e404963 Depends-On: I84de60181cb88574e341ff83cd4857cce241f2dd Change-Id: I1977ee0d348645987107c2efb5b454d7f8b81adf
* Add domain info to functional test clientsBrian Rosmaita2017-12-111-1/+5
| | | | | | | Keystone wants domain info, so pass it on. Change-Id: Ie99f79b61e5f8d469695fa19ad99d919fa23ae8e Closes-bug: #1737583
* Merge "Validate input args before trying image download"Jenkins2017-07-261-0/+14
|\
| * Validate input args before trying image downloadRavi Shekhar Jethani2017-07-241-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | Currently client is contacting glance service even if the caller has niether specified any redirection nor '--file' option. This unnecessary request although isn't causing any critical issues but can be avoided by simply doing input validation first. TrivialFix Change-Id: I841bebeda38814235079429eca0b1e5fd2f04dae
* | Removed the --no-ssl-compression parameter which is deprecatedPranaliD2017-07-251-9/+0
|/ | | | | | | | --no-ssl-compression is deprecated and no longer used. So, it is removed from the help message. Change-Id: I2b886671a568ed191ee380cf16335ccd9ae85062 Closes-Bug: #1583919
* Merge "Replace assertTrue(isinstance()) with assertIsInstance()"Jenkins2017-06-301-1/+1
|\
| * Replace assertTrue(isinstance()) with assertIsInstance()Van Hung Pham2017-06-141-1/+1
| | | | | | | | | | | | | | | | Some of tests use different method of assertTrue(isinstance(A, B)) or assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B) provided by test tools. Change-Id: Ibb5e5f848c5632f7c1895c47b8c1a938f2c746c3
* | Merge "Replace six.iteritems() with .items()"Jenkins2017-06-282-4/+3
|\ \
| * | Replace six.iteritems() with .items()ji-xuepeng2017-02-082-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1.As mentioned in [1], we should avoid usingg six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2.In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Change-Id: I71c13040318eca6e5ed993e8aa03f8003986a71c
* | | allow unhandled exceptions to cause test errorsDoug Hellmann2017-06-261-16/+0
| |/ |/| | | | | | | | | | | | | | | Hiding the unhandled exception in the test with a failure makes it harder to debug the problem. Let them pass unhandled so the test reports an ERROR instead of FAILURE. Change-Id: I4e435a6d276fdf161dac28f08c2c7efedd1d6385 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* | Merge "Allow global_request_id in Client constructor"2.7.0Jenkins2017-06-011-0/+13
|\ \
| * | Allow global_request_id in Client constructorSean Dague2017-06-011-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to pass in a global_request_id in the client constructor so that subsequent calls with this client pass that to the servers. This enables cross project request_id tracking. oslo spec I65de8261746b25d45e105394f4eeb95b9cb3bd42 Change-Id: Iea1e754a263a01dae5ed598fdda134394aff54b0
* | | Downloading image with --progress failsAbhishek Kekane2017-05-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Downloading image with --progress fails with "RequestIdProxy object is not an iterator". This is because to display download progress VerboseFileWrapper in progressbar requires object of IterableWithLength, but after support of returning request-id [1] to caller it returns RequestIdProxy object which is wrapped around IterableWithLength and response. To resolve this issue overridden next and __next__ methods in RequestIdProxy so that it can act as iterator for python 2.x and 3.x as well. [1] 610177a779b95f931356c1e90b05a5bffd2616b3 Closes-Bug: #1670464 Change-Id: I188e67c2487b7e4178ea246f02154bbcbc35a2b1
* | | Merge "Downloading image with --progress fails for python3"Jenkins2017-05-291-2/+4
|\ \ \ | |/ / |/| |
| * | Downloading image with --progress fails for python3Abhishek Kekane2017-05-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Downloading image with --progress fails for python3 with, TypeError: 'IterableWithLength' object is not an iterator. This is because IterableWithLength class does not implemented python3 compatible __next__ method. Added __next__ method for python3 compatibility. Change-Id: Ic2114180fac26e9a60678f06612be733e8671bdb Closes-Bug: #1671365
* | | v2: Content-Type: application/octet-stream header always addedckonstanski2017-05-193-1/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Convert IOError from requestsEric Fried2017-05-191-10/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requests commit [1] changed the behavior when a nonexistent cacert file is passed in: now it raises IOError. This is getting through glanceclient.common.http.HTTPClient._request, which used to raise CommunicationError in this scenario. Even though there is arguably a better exception than CommunicationError to represent this condition (like maybe IOError), for backward compatibility this change set converts IOError to CommunicationError. We also improve the unit test to raise the original exception if the expected conditions aren't met; this improves debugability. [1] https://github.com/kennethreitz/requests/commit/7d8b87c37f3a5fb993fd83eda6888ac217cd108e Change-Id: I6a2cf4c6d041b67d3509153b4cef18b459263648 Closes-Bug: #1692085
* | x-openstack-request-id logged twice in logsAbhishek Kekane2017-02-221-0/+18
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | In the recent release of keystoneauth1 2.18.0 provision is made to log x-openstack-request-id for session client. Once this new library is synced in openstack projects, the x-openstack-request-id will be logged twice on the console if session client is used. For example, $ glance --debug image-list DEBUG:keystoneauth.session:GET call to image for http://10.232.48.204:9292/v2/schemas/image used request id req-96a3f203-c605-4c96-a31d-f1199d41705c DEBUG:glanceclient.common.http:GET call to glance-api for http://10.232.48.204:9292/v2/schemas/image used request id req-96a3f203-c605-4c96-a31d-f1199d41705c Above log will be logged twice on the console. Removed logging of x-openstack-request-id in case of SessionClient as it is already logged in keystoneauth1. x-openstack-request-id will only be logged once on console if HTTPClient is used. Depends-On: I492b331ff3da8d0b91178bf0d5fe1d3702f15bd7 Closes-Bug: #1657351 Change-Id: I64258f997dc060113f53682aee74bdd40a346e54
* Merge "Add support for community images"Jenkins2017-01-232-2/+20
|\
| * Add support for community imagesAlexander Bashmakov2016-11-102-2/+20
| | | | | | | | | | | | | | | | This patch adds support for community images retrieval and creation in the Glance client. Depends-On: I94bc7708b291ce37319539e27b3e88c9a17e1a9f Change-Id: I81e83eab5a9d30643c354f0cb6df425cf7a7bae3
* | Merge "Add request id to returned objects"Jenkins2017-01-2312-134/+301
|\ \
| * | Add request id to returned objectsRavi Jethani2017-01-2012-134/+301
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding two classes RequestIdProxy and GeneratorProxy derived from wrapt.ObjectProxy to wrap objects returned from the API. GeneratorProxy class is used to wrap generator objects returned by cases like images.list() etc. whereas RequestIdProxy class is used to wrap non-generator object cases like images.create() etc. In all cases the returned object will have the same behavior as the wrapped(original) object. However now the returned objects will have an extra property 'request_ids' which is a list of exactly one request id. For generator cases the request_ids property will be an empty list until the underlying generator is invoked at-least once. Co-Authored-By: Abhishek Kekane <abhishek.kekane@nttdata.com> Closes-Bug: #1525259 Blueprint: return-request-id-to-caller Change-Id: If8c0e0843270ff718a37ca2697afeb8da22aa3b1
* | | Add ploop in disk_formatEvgeny Antyshev2017-01-192-2/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | "ploop" image format is supported in upstream Glance https://review.openstack.org/341633 And similar patch has been added in python-openstackclient: https://review.openstack.org/411405 Co-Authored-By: yuyafei <yu.yafei@zte.com.cn> Change-Id: I1471224df97cf5fecfe7f02e549855af81c45848 Related-Bug: 1650342
* | Merge "Handle formatting of subcommand name in error output"Jenkins2017-01-131-0/+29
|\ \