summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/test_shell.py
Commit message (Collapse)AuthorAgeFilesLines
* Tests: Don't write bash-completion cache filesEric Harney2019-08-221-0/+11
| | | | | | | | | | Mock out writing of bash-completion cache files during unit tests. Related-Bug: #1817782 Change-Id: I944862c30fb4684dd034eba6953e9302d2d22439 (cherry picked from commit a39805c6f45baf94c0d14da3ae775ee204a267ee)
* Fix shell upload-to-image with no volume type4.2.1Eric Harney2019-06-031-0/+28
| | | | | | | | | Upload-to-image would error after launching the operation if the volume type is None. Closes-Bug: #1821818 Change-Id: I015e0ddfa98d62f25334e2df5effaee72a3988ab (cherry picked from commit 274fa111696783e846561d12f670967ed01ebcbc)
* Fix max version handling for help outputSean McGinnis2019-03-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Commit fefe331f218d73ba6d1d7acf81b5eb02609c953e incorrectly set the default API version to the max the client knew about in order to get the full help output, including all microversioned commands. The original intent was to have help print out information for all versions, but still require the user to specify a version if they wanted to use any microversioned version of an API. The code accidentally made it so all commands would request the max version the client knew about. This meant an unspecified request would get the newer functionality rather than the default v3 functionality, and also meant the client could request a microversion higher than what the server knew about, resulting in an unexpected error being returned. To keep the originally intended functionality, but keep all help output, this only uses the max API version for the help command unless the user specifies otherwise. Closes-bug: #1813967 Change-Id: I20f6c5471ffefe5524a4d48c967e2e8db53233f1 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com> (cherry picked from commit bccbd510a77843824b8187e15c4d8df9c2dfa55e)
* Allow --help for specific commandsEric Harney2018-04-101-0/+11
| | | | | | | | | | | | This makes calls such as: $ cinder list --help work as expected, equivalent to: $ cinder help list rather than just printing the full help message. Change-Id: I038eeeea554f0bb5dd170f503eaec570441520b3
* Migrate to keystoneauth identity cli opts.Zhao Chao2018-01-161-0/+16
| | | | | | | | | | | | | | | | | | Use keystoneauth1 to parse keystone authentication arguments. Previously these arguments are parsed in the different service clients seperately. Use keystoneauth1 instead will make this consistent across projects and less error-prone. This change is inspired by NovaClient. Co-Authored-By: Morgan Fainberg <morgan.fainberg@gmail.com> Co-Authored-By: David Hu <david.hu@hp.com> Co-Authored-By: Monty Taylor <mordred@inaugust.com> Closes-Bug: #1734945 Change-Id: I3c5141eeddd3747ff542e95b04e4848470ad9508 Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
* Fix OS_AUTH_TYPE env var usageGorka Eguileor2017-08-041-0/+20
| | | | | | | | | | | | | Right now only deprecated OS_AUTH_SYSTEM environmental variable works to set the authentication to noauth, the reason is that we have multiple arguments writing on the same destination. This patch fixes this by making both arguments have the same default value, which is to use environmental variable OS_AUTH_TYPE if it has a value or deprecated OS_AUTH_SYSTEM if not. Closes-Bug: #1708687 Change-Id: I478fb0e628d4bebd4a1dc78c2559202916aa051f
* Do not require network for test_noauth_plugin()Thomas Bechtold2017-06-011-5/+8
| | | | | | | | | | | | | | | | | | While running the unittests, test_noauth_plugin() needs network access and fails in build environments where no network is available: keystoneauth1.exceptions.connection.ConnectFailure: Unable to establish \ connection to http://example.com/v2/admin/volumes/detail: HTTPConnectionPool \ (host='example.com', port=80): Max retries exceeded with url: /v2/admin/ \ volumes/detail (Caused by NewConnectionError('<requests.packages.urllib3. \ connection.HTTPConnection object at 0x7f04c4394290>: Failed to establish a \ new connection: [Errno -3] Temporary failure in name resolution',)) Prevent the need of network access to be able to run the unittest in such build envs. Closes-Bug: #1695009 Change-Id: I123919f29de7cb72a780b5f134a5bfaa404f5b53
* Fix noauth supportIvan Kolodyazhny2017-03-241-47/+10
| | | | | | | | | | | | | | | | | | | | | This patch includes several improvements: 1. Use keystoneauth1 plugin mechanism for auth plugins. 2. Implements CinderNoAuthPlugin. 3. Deletes non-working cinderclient.auth_plugin module. 4. Deprecates --bypass-url in flavor of --os-endpoint to be consistent with keystoneauth1 plugins. 5. Deprecates in --os-auth-system in falvor of --os-auth-type to be consistent with keystoneauth1 plugins. Both bypass_url and os_auth_system params are not changed for client objects to not break backward compatibility for Python API. How to use noauth with cinderclient CLI: OS_USER_ID=userid OS_PROJECT_ID=projectis cinder --os-auth-type noauth --os-endpoint=http://localhost:8776/v2 list Change-Id: I3be59a5a39235acbc3334e0a0b797081507a5c88 Closes-Bug: #1657156
* Make V3 the default and fixup version reportingJohn Griffith2017-03-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | This adds in a version-list command that reports the min/max versions of the Cinder API supported by this version of the client, and also queries the Cinder API V3 server to obtain min/max micro-versions and report those as well. In addition, we bump the default version of the client to 3.0, of course if you specify V2 in your rc file or on the cmd line that works fine too. I did run into one problem where I broke: cinder.tests.unit.test_shell:test_cinder_service_name Seems to be some hidden trickery with a fake, fixture or mock that I can't figure out. For now I added a skip to that test, but maybe somebody can point out the problem during review. Change-Id: I44e667c511d89de28af758a3c9ea1f812e682f18
* Fix test_version_discovery testIvan Kolodyazhny2016-11-221-1/+1
| | | | | | | | | | | | Something changed in requests/urllib3 library and now it sends requests with url in a lower-case. It affects test_version_discovery test because we use url in camel-case. This patch changes test url to lower-case to be compatible with old and new behaviours. Change-Id: I4ae9715b124adb0a2e0115c9b00ab16576665f72 Closes-Bug: #1643874
* Replace 'MagicMock' with 'Mock'xianming mao2016-09-301-1/+1
| | | | | | | In magicmock,there just have a mock_add_spec function,in this code,there have not called this method so i think it can be removed and call mock directly. Change-Id: Ic3b218eecb5738769dd2c18b6029dc70210d3989
* Add "start_version" and "end_version" support to argparseCao Shufeng2016-08-161-0/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, "cinder help subcommand" can not show whether an argument is supported for a specific microversion. With this change, developers only need to add a start_version or end_version in the utils.arg wrap, cinderclient will support the microversion for that arguement. @utils.arg( '--foo', start_version='3.1') @utils.arg( '--bar', start_version='3.2', end_version='3.5') def do_some_action(): ...... In previous example, an exception will be raised for such command: $ cinder --os-volume-api-version 3.6 --bar some-ation And only "--foo" will show up for such help command: $ cinder --os-volume-api-version 3.1 help some-ation Change-Id: I74137486992846bbf9fdff53c009851db2356eef Partial-Bug: #1600567 Co-Authored-By: Nate Potter <nathaniel.potter@intel.com>
* Use self.ks_logger instead of ks_loggerdineshbhor2016-08-011-0/+11
| | | | | | | | | | | | Currently with '--debug' option any cinder command only logs the request from keystoneauth and not the main cinder service request. Added keystoneauth logger to self.ks_logger so that logs can be logged as expected. Closes-Bug: #1606814 Change-Id: I7193aa6f43cb3186c49fc409b6e1ce7a36f596f9
* Switch to keystoneauthSteve Martinelli2016-07-231-16/+21
| | | | | | | | | | | move cinderclient to keystoneauth as keystoneclient's auth session, plugins and adapter code has been deprecated. Co-Authored-By: Paulo Ewerton <pauloewerton@lsd.ufcg.edu.br> Co-Authored-By: Sean McGinnis <sean.mcginnis@gmail.com> Co-Authored-By: Jamie Lennox <jamielennox@gmail.com> Change-Id: Id4bf0e2088e8ad99e83cd4f9b8549c2aca1f65a2
* Merge "Fix authentication issue"Jenkins2016-07-151-1/+10
|\
| * Fix authentication issueAbhijeet Malawade2016-04-271-1/+10
| | | | | | | | | | | | | | | | | | Fix authentication issue if password is provided from tty prompt. Set options.os_password to user input from prompt, as it gets used to create auth object otherwise it will give authentication error. Change-Id: I0246473f2165f1464d731e0ae9b4afa0b61dcbcc Closes-Bug: #1575656
* | Merge "Fix argument order for assertEqual to (expected, observed)"Jenkins2016-06-141-2/+2
|\ \
| * | Fix argument order for assertEqual to (expected, observed)reedip2016-06-141-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | assertEqual expects that the arguments provided to it should be (expected, observed). If a particluar order is kept as a convention, then it helps to provide a cleaner message to the developer if Unit Tests fail. The following patch fixes this issue. TrivialFix Change-Id: I817a654733e0f3886ca85778a49aa579592f60ff Closes-Bug: #1259292
* | Support --os-key optionCedric Brandily2016-05-171-0/+23
|/ | | | | | | | | | | | | | | | Currently we can specify a client certificate key using --os-key option inherited from keystoneclient cli options but it has no effect because keystoneclient Session expects as cert argument, one of the followings: * None (no client certificate), * a path to client certificate, * a tuple with client certificate/key paths. The change updates cinderclient code to support the last case (ie: os_cert and os_key are non-empty) in order to take into --os-key option and OS_KEY environment variable. Closes-Bug: #1564646 Change-Id: I258fd554ad2d6a5413ffe778acefa3a0b83e591f
* Pass insecure option to HTTPClientCory Stone2016-01-271-0/+16
| | | | | | | This option was silently being ignored. Closes-Bug: #1538648 Change-Id: I3a1b5268e87cbc9803924be95b374d76b72a3a5d
* No longer ignores CINDER_SERVICE_NAMEDerrick J. Wippler2015-09-141-0/+19
| | | | | | | | | | Cinderclient now utilizes the CINDER_SERVICE_NAME when deciding what endpoint to choose. Closes-Bug: #1486256 Change-Id: I494a34afe5799e7832b1359b9c24c31ead68b6d1 UpgradeImpact: Existing configurations may select a different endpoint after this patch.
* Fixed test_password_promptedDerrick J. Wippler2015-08-271-4/+8
| | | | | | | test_password_prompted no longer makes DNS lookups on the network. Change-Id: If310f52e829b09b01c76d02deae4aec74f00870d Closes-Bug: 1486647
* Replace assertEqual(None, *) with assertIsNone in testsYusuke Hayashi2015-08-091-2/+2
| | | | | | | | Replace assertEqual(None, *) with assertIsNone in tests to have more clear messages in case of failure. Change-Id: I7ea0306009e8fdde468c1394615972de4d296f45 Closes-Bug:#1280522
* New mock release(1.1.0) broke unit/function testsrico.lin2015-07-141-1/+1
| | | | | Change-Id: Ia84c667b65fb69ba877bdb0ecb45827281539e03 Closes-Bug: #1473454
* Revert "Enable version discovery"Mike Perez2015-07-021-200/+1
| | | | | | | | | | | | | | | This reverts commit ae03d2a721bd9acb61805ce792a27fb7cf88e5cd. Cases where a deployment is using a proxy, Cinder servers won't return the expected publicURL, and instead gives an internal URL that the client can't use. Commit 2eb25ab8803214cb3beb5d8fe3efbf70a462c414 in Cinder introduces the public_endpoint config option, but not everyone is expected to be running that later of a version to take advantage of this. Closes-Bug: #1464160 Change-Id: I61228c1e8630b958c792be077674b48fbdb83135
* Avoid _get_keystone_session() if auth_pluginDerrick J. Wippler2015-05-071-1/+51
| | | | | | | | Avoid calling _get_keystone_session() if auth_plugin is provided by the user Closes-Bug: 1421433 Change-Id: I37a7139107c357caf1a25ac3d0a3457afade0f83
* Add version removal rule to stop discovery warningMike Perez2015-04-291-3/+3
| | | | | | | | | | | Cinder recently added version discovery leveraging Keystone Client. For cases where the service catalog still contains version numbers, this can result in Keystone attempting to do discovery at the base url with the version number and giving warnings. This will set a version removal rule so Keystone can find the correct base url. Change-Id: I71432468fea8bf1e50f180ab7f6dd69ee9aaa7e6 Closes-Bug: #1448244
* Enable version discoveryMike Perez2015-04-201-2/+201
| | | | | | | | | | | | | The service catalog can now have the cinder endpoint x.x.x.x:8776 with service_type volume, without needing to specify a version in the endpoint. Keystone will do discovery of the root / GET of the Cinder API to discover the versions that can be talked to. This also provides backwards compatibility for the previous solution of having v1 enabled on service_type volume and v2 on service_type volumev2. Change-Id: Id0347f8370dbc8fd7fa8096cd5859e10b0c5d67c
* Move unit tests into test directoryJohn Griffith2015-03-231-0/+169
This is the first step of moving functional testing into the project tree. This change just moves all of the unit tests to be under a dedicated tests/unit directory. Follow up patches will add the functional directory and start moving tempest CLI tests there. Change-Id: I9dc0b8f761676c1b3bbdeb03e2f44b35f75c693e