summaryrefslogtreecommitdiff
path: root/glanceclient/tests
Commit message (Collapse)AuthorAgeFilesLines
* Migrate dsvm functional test jobs to project repoBrian Rosmaita2018-02-051-46/+0
| | | | | | | | | | | | | | | | | | | | Zuul3-related changes in master have moved functional test gate configuration out of infra/project-config and into the glanceclient repository. This patch backports these changes so that the stable branch has functional test gates. Not a pure cherry-pick, also includes setting SWIFT_HASH, which did not have to be done in master. Co-authored-by: Monty Taylor <mordred@inaugust.com> Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com> (cherry picked from commit c0e63d977fc077be55a02106403840165b89a349) (cherry picked from commit a5985508817e5de73092a339f15ce7f9f701a20f) Depends-On: I84de60181cb88574e341ff83cd4857cce241f2dd Depends-On: I0fecb027e5be6f4d7bb0bf34e59a43543a421f38 Change-Id: Idaa2f4b920e131320499c9e460ade74df1d5a264
* 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
|\ \
| * | Handle formatting of subcommand name in error outputIan Cordasco2017-01-111-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Python 2, decoding all arguments leads to the possibility that users that use the wrong command or mistype the name will see error output with a unicode string's representation instead of one without it. To avoid this we try and find the first non-option string in the argument list and replace it with an string that is not text only on Python 2. If we encoded the string at all times, then users installing glanceclient on Python 3 would see b'invalid-subcommand' instead. That's as bad as seeing u'invalid-subcommand' on Python 2. Closes-bug: 1533090 Change-Id: I018769e159a607ebb233902cbeb13b95ca417190
* | | Add vhdx in disk_formatLi Wei2017-01-103-2/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | vhdx is also a format of the disk valid value in v2 version, so add it in disk_format. Related-Bug: 1635518 Co-Authored-By: Stuart McLaren <stuart.mclaren@hpe.com> Change-Id: I7d82d4a4bdb180a53e86552f6f6b3bed908e6dc0
* | | Merge "Revert "Add last_request_id member to HTTPClient and SessionClient""Jenkins2016-12-141-8/+0
|\ \ \ | |/ / |/| |
| * | Revert "Add last_request_id member to HTTPClient and SessionClient"Abhishek Kekane2016-05-231-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9e532db8b0f0ba537edef143a6f5380a2aaa1e4b. If glanceclient is used in multi-threaded environment, then there is a possibility of getting invalid/wrong last request-id. To avoid this, need to use thread local storage to store last-request-id and add public method to return this request-id to caller. http://specs.openstack.org/openstack/openstack-specs/specs/return-request-id.html#alternatives Change-Id: I08d8d87fc0cc291f1b930b2c0cfc110ec8394131
* | | Move old oslo-incubator code out of openstack/commonAbhishek Kekane2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of the first community-wide goal, teams were asked to remove the openstack/common package of their projects if one existed. This was a byproduct of the old oslo-incubator form of syncing common functionality. Package openstack/common/apiclient is moved to glanceclient/v1 package as it is used by v1 api only. NOTE: Removed glanceclient/common/base.py as it is deprecated and not used anywhere. Closes-Bug: #1639487 Change-Id: Ib3ac09743ce761ab0186e99e1c9de02517f89510
* | | Replace 'assertTrue(a not in b)' with 'assertNotIn(a, b)'Cao Xuan Hoang2016-09-281-1/+1
| |/ |/| | | | | | | | | trivialfix Change-Id: I4d05a8bbcf99794c02261a9f9136e1c6f2c561a6
* | switch from keystoneclient to keystoneauthItisha Dewan2016-09-032-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | move glanceclient to keystoneauth as keystoneclient's auth session, plugins and adapter code has been deprecated. refer to [1] for more information. 1: https://github.com/openstack/python-keystoneclient/commit/1a84e24fa4ce6d3169b59e385f35b2a63f2257f0 implements bp: use-keystoneauth Co-Authored-By: Itisha <ishadewan07@gmail.com> Change-Id: I88fb327628e1bec48dc391f50d66b3deab4a8ab9
* | Merge "Revert "Don't update tags every time""2.5.0Jenkins2016-08-201-31/+0
|\ \
| * | Revert "Don't update tags every time"Steve Martinelli2016-08-191-31/+0
| | | | | | | | | | | | | | | | | | This reverts commit e77322c17931810f4029ef339a791f702f2f4580. Change-Id: Ida826a2aa888beeb76dbe657b2ccd6cb088157ed
* | | Merge "Fix warlock model creation"2.4.0Jenkins2016-08-121-1/+1
|\ \ \
| * | | Fix warlock model creationSabari Kumar Murugesan2016-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commands like glance md-namespace-show <namespace> fail because of a breaking change in warlock 1.3.0's model creation factory method. Warlock introduced a new kwarg 'resolver' in model_factory method but changed its position with the 'base_class' kwarg. Since we were calling the model_factory method with positional arg, this broke the model creation. Closes-Bug: #1596573 Change-Id: Ic7821f4fdb1b752e0c7ed2bc486299a06bf485c1
* | | | Merge "Don't update tags every time"Jenkins2016-08-081-0/+31
|\ \ \ \ | | |/ / | |/| |
| * | | Don't update tags every timeMike Fedosin2016-06-011-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code removes unnecessary PATCH requests for tags updating if they were not modified. Change-Id: I8eced32f39d0c98e0b26014e7b2341ab6580ff01 Closes-bug: 1587999
* | | | py3: Fix encoding and use sys.stdin.bufferSirushti Murugesan2016-07-253-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * exc.py: Encode body in response before calling replace over it. * http.py: prepend the bytes literal to the empty string or else we hit bug 1342080 again in python 3. * utils.py: Use sys.stdin.buffer in python 3. Change-Id: Ieefb8c633658e507486438e5518c5d53e819027d
* | | | Merge "Update docs URL"Jenkins2016-07-141-2/+2
|\ \ \ \
| * | | | Update docs URLKATO Tomoyuki2016-07-131-2/+2
| | |/ / | |/| | | | | | | | | | | | | | Change-Id: Id8b1b97a85534c4398b3c49648c6e2f2df3ee20e Related:-Bug: #1602266
* | | | Merge "image-download: tests to catch stray output"Jenkins2016-07-133-0/+186
|\ \ \ \ | |/ / / |/| | |
| * | | image-download: tests to catch stray outputStuart McLaren2016-06-293-0/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add unit tests to ensure that any stray output (eg print statements) during image-download cause a test failure. Regression test for bug 1488914. Change-Id: Ic19ba5693d059bf7c283702e7c333672a878a1a1 Partial-bug: 1488914
* | | | Merge "Replace tempest_lib with tempest.lib"Jenkins2016-06-292-2/+2
|\ \ \ \ | |/ / / |/| | |
| * | | Replace tempest_lib with tempest.libwangxiyuan2016-06-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Use correct order of arguments to assertEqualzhengyao12016-06-295-39/+35
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The correct order of arguments to assertEqual that is expected by testtools is (expected, observed). This patch fixes the inverted usage of arguments in some places that have cropped up since the last fix of this bug. Change-Id: If8c0dcb58496bc2fcf4c635f384522a1f7d2b2af Closes-Bug: #1259292
* | | Remove deprecated construct method from session initkairat_kushaev2016-06-091-6/+6
|/ / | | | | | | | | | | | | | | construct method is marked as deprecated and might be deleted in one of future releases. So glanceclient need to be aware of that and initialize sesssion from command line arguments directly. Change-Id: Ie81b62b7e70bb177f178caadc41554ae88e51b05
* | Merge "Fix "Codec can't encode characters""Jenkins2016-05-231-4/+1
|\ \
| * | Fix "Codec can't encode characters"Darja Shakhray2016-05-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Headers were encoded in HTTPClient, but when glance client started to use SessionClient this functionality was lost. This commit replaces static method "encode_headers" from HTTPClient and makes it a common function, that SessionClient can use when converting image meta to headers. Change-Id: If9f8020220d2a0431b4241b38b9c83c09c0d75cb Closes-bug: #1574587
* | | Merge "Get endpoint if os_image_url is not set"Jenkins2016-05-191-16/+77
|\ \ \
| * | | Get endpoint if os_image_url is not setNiall Bunting2016-05-121-16/+77
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | If env['OS_IMAGE_URL'] is not set then None is returned. This is then used ignoring the endpoint_type, service_type and region_name. This patch will use those values if the endpoint is None. Change-Id: I76cc527b05d2be75d3dbc33123a0d71be97fe25c Closes-bug: #1579768
* | | Merge "Add last_request_id member to HTTPClient and SessionClient"Jenkins2016-05-181-0/+8
|\ \ \ | |/ / |/| / | |/