summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Bypass user and group verification in RemoveRole" into stable/ussuriZuul2020-11-111-0/+242
|\
| * Bypass user and group verification in RemoveRoleLance Bragstad2020-08-191-0/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keystone let's users remove role assignments that reference non-existent users and groups. This is nice when keystone backs to an identity store like LDAP and users or groups are removed. Previously, openstackclient would validate the user and group existed in keystone before sending the request to delete the role assignment. This commit updates the code to bypass that validation so that users can use IDs to forcibly cleanup role assignments. Change-Id: I102b41677736bbe37a82abaa3c5b3e1faf2475d5 Story: 2006635 Task: 36848 (cherry picked from commit e24673267093de85beee753860cda1fb224ce4bc)
* | Merge "Add system role assignment tests for users and groups" into stable/ussuriZuul2020-11-021-0/+137
|\ \ | |/
| * Add system role assignment tests for users and groupsLance Bragstad2020-08-191-0/+137
| | | | | | | | | | | | | | | | | | I was writing some additional functionality and noticed these tests were missing. This commit adds tests for adding and removing system role assignments for users and groups. Change-Id: I30fdc6ec55e1eb1cfa55f4cbf92c3f001d89865f (cherry picked from commit a8aad9fec80bcb6c9917d2dd076373f06467849f)
* | Merge "Add API check for server_groups.list" into stable/ussuriZuul2020-10-142-2/+130
|\ \
| * | Add API check for server_groups.listLewis Denny2020-10-032-2/+131
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | The policies parameter has been replaced with the policy parameter since Nova API version 2.64[1] This commit adds a check to make sure the correct parameter is used. [1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59 Change-Id: Ia37beb7790884d6d15bec45074f446e64af1a2aa Story: #2008041 Task: #40703 (cherry picked from commit ed6d8d941104c60f447de852582eb9388b9d2e73)
* | Add API check for server_groups.createLewis2020-10-031-0/+23
|/ | | | | | | | | | | | | | The policies field has been replaced with the policy field since Nova API version 2.64[1] This commit adds a check to make sure the correct field is used. [1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59 Change-Id: I06d3211937d822c26070b7f8ad757c365dcbb1bb Story: #2007822 Task: #40101 (cherry picked from commit 51a1ea65f4d095b073381200e5268f909bf360de)
* Replace assertItemsEqual with assertCountEqualAlfredo Moralejo2020-06-111-2/+2
| | | | | | | | | | | | | | | | assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: I1ad0da8deda3a8cbec384b5a9c88860a526eb48c (cherry picked from commit a15b1addb41147415716417f385f8ee32aace64b)
* Client should parse string to boolean for value 'is_domain'5.2.1yanpuqing2020-06-101-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | When we use "--property" parameter, client get lists these the value is string type, but the type of the value 'is_domain' should be boolean, so we should judge it and parse it. The patch parse string to boolean for value 'is_domain'. Co-Authored-By: Lance Bragstad <lbragstad@gmail.com> Conflict: Direct backports of this patch fail because the original tests proposed to the Victoria (master) branch included keystone ``options``. Support for ``options`` was added in: I9c3bdd741f28bf558267fb217818d947597ce13e This backport removes the ``options`` key from the expected values in the tests since feature support for ``options`` isn't going to be backported. Otherwise, the functionality of this change is fully tested like it is on later releases. Change-Id: I37c9eb854524bde3a1530bfe2e3a03810fb1a676 Task: 30039 Story: 2005246 (cherry picked from commit 533af9f1b2de40d98f69e83cdf89ecf254cf3879)
* Fix ussuri jobsPete Zaitcev2020-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Squashed two changes together since both are needed to fix jobs: Resolve PEP8 No idea how this happened, but reviews started failing the pep8 gate job. The failures are legitimate, see the commit. I guess the pep8 tests became smarter and found these issues. (cherry picked from commit 52ff421e3d339f81c2625bff429e6829a2d9af67) Add libc6-dev to bindep The python-builder base image was updated to no longer install recommends. This is inline with the other Infra images and keeps image sizes smaller. gcc recommended libc6-dev - but it turns out we need that for limits.h for one of our depends. Add it to fix our image builds. (cherry picked from commit 97d027caecdb977779ff130bb9ee2b3204c5646c) Change-Id: Id9a0dad644134dafd68eed37fe8f41c583d7a619
* Merge "Complete switch from glanceclient to SDK for image service"Zuul2020-03-252-111/+72
|\
| * Complete switch from glanceclient to SDK for image serviceArtem Goncharov2020-03-242-111/+72
| | | | | | | | | | | | | | | | | | In https://review.opendev.org/#/c/650374/ a work has been started to switch image service support from glanceclient with all it's dependencies to the SDK version. With this change version 1 (anyway deprecated since ages) is also being switched to SDK. Change-Id: Ic391500af02a73d81d64a9e9113cca85c9e24390
* | Merge "Switch image to use SDK"Zuul2020-03-256-367/+378
|\ \ | |/
| * Switch image to use SDKArtem Goncharov2020-03-236-367/+378
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a work to switch OSC from using glanceclient to OpenStackSDK. With this change only v2 is using OpenStackSDK. V1 is still using glanceclient and will be switched in a separate change. Remove the direct depend on keystoneauth- let that flow through openstacksdk. Depends-on: https://review.opendev.org/#/c/698972 Change-Id: I36f292fb70c98f6e558f58be55d533d979c47ca7
* | Merge "Add unit tests and release note for dns_publish_fixed_ip"Zuul2020-03-241-0/+38
|\ \
| * | Add unit tests and release note for dns_publish_fixed_ipDean Troyer2020-01-141-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up to https://review.opendev.org/#/c/679834/ which added the options and lacked both a release note and minimal option-handling unit tests. Change-Id: Ibb2820add9b2fedaf5a8b1a77babf043f6641724 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | | Merge "Add "fields" parameter to ListSecurityGroup query"Zuul2020-03-241-5/+12
|\ \ \
| * | | Add "fields" parameter to ListSecurityGroup queryRodolfo Alonso Hernandez2020-03-121-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new query parameter will allow to send a query sending the "fields" parameter. This "fields" parameter contains the needed API fields, translated into OVO fields in Neutron server, that require to be retrieved from the DB. As commented in the related bug, the OSC "list" command only prints five parameters, none of them the security group rules. In systems with a reasonable amount of security groups, skipping the unnecessary rule load can save a lot of time. Depends-On: https://review.opendev.org/#/c/710820/ Change-Id: I16f48e292997d029d68f66365db949b9f4b5a0c8 Closes-Bug: #1865223
* | | | Merge "Fix network segment range "_get_ranges" function"Zuul2020-03-231-0/+14
|\ \ \ \ | |_|_|/ |/| | |
| * | | Fix network segment range "_get_ranges" functionRodolfo Alonso Hernandez2020-03-231-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function should return an ordered set of ranges based on an unordered list of numbers (int or str). Change-Id: I918c8befc51236cc33d96a5c88fb6eafdd143e9c Story: 2007341 Task: 38878
* | | | Merge "Now we can add description for role creation in OSC"Zuul2020-03-202-0/+80
|\ \ \ \
| * | | | Now we can add description for role creation in OSCM V P Nitesh2018-09-182-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now user can add the description when user create's the role using OSC ``openstack role create`` command. User can add the description by adding `--description <Description>` to OSC ``openstack role create`` command. Co-Authored-By: Deepak Mourya<deepakmoriya7@gmail.com> Change-Id: I858e004c3b29c687b6a39c8a1ed5fb029eb19c67 Depends-on: I230af9cc833af13064636b5d9a7ce6334c3f6e9a Closes-Bug: #1669080
* | | | | Allow setting floating IP descriptionDaniel Strong2020-03-181-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: If664bfe3c9fdcb69c7046eb16c5d32602d1b3262 Story: 2007439 Task: 39094
* | | | | Merge "Add storage policy option to create container command"Zuul2020-03-132-0/+74
|\ \ \ \ \
| * | | | | Add storage policy option to create container commandSimon Merrick2020-02-192-0/+74
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + Add CLI option to specify swift storage policy + Add CLI flag to specify container uses public read ACLS + Show storage policy in container show data Change-Id: I08ffa0d98bd39d467aa415771675f59bd77768ff
* | | | | Merge "Add qos_network_policy_id to network port tests"Zuul2020-03-132-0/+3
|\ \ \ \ \ | |_|_|/ / |/| | | |
| * | | | Add qos_network_policy_id to network port testsRodolfo Alonso Hernandez2020-02-182-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added "qos_network_policy_id" to "port show" command. Because this is just a read-only parameter and is read from the SDK port definition, this patch only modifies the corresponding tests. This patch is adding this new parameter to the test bench. Change-Id: Ice7423e0e0b98a39cc36622b70eae5a8493a037c Closes-Bug: #1851362
* | | | | Disallow setting default on internal networkHongbin Lu2020-03-091-0/+33
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ``--default`` option should be only used for external network. Default internal network is not currently supported so we disallow it for now. Change-Id: Ia9d39b40e1e041d7bda0f6a27d058e382b572e1a Closes-Bug: #1745658
* | | | Stop silently ignoring invalid 'server create --hint' optionsStephen Finucane2020-02-031-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The '--hint' option for 'server create' expects a key-value pair like so: openstack server create --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ... However, the command doesn't complain if this isn't the case, meaning typos like the below aren't indicated to the user: openstack server create --hint 245e1dfe-2d0e-4139-80a9-fce124948896 Due to how we'd implemented this here, this ultimately results in us POSTing the following as part of the body to 'os-servers': { ... "OS-SCH-HNT:scheduler_hints": { "245e1dfe-2d0e-4139-80a9-fce124948896": null } ... } Which is unfortunately allowed and ignored by nova due to the use of 'additionalProperties' in the schema [1] Do what we do for loads of other options and explicitly fail on invalid values. This involves adding a new argparse action since none of those defined in osc-lib work for us. This is included here to ease backporting of the fix but will be moved to osc-lib in a future patch. [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146 Change-Id: I9e96d2978912c8dfeadae4a782c481a17cd7e348 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: #2006628 Task: #36840 Related-Bug: #1845322
* | | | Add support for app cred access rulesColleen Murphy2020-01-173-9/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the --access-rules option for 'application credential create' as well as new 'access rule' commands for listing, showing, and deleting access rules. bp whitelist-extension-for-app-creds Change-Id: I04834b2874ec2a70da456a380b5bef03a392effa
* | | | Raise flake8-import-order version to latestSean McGinnis2020-01-10101-160/+143
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had this library capped at a release that is a few years old. Now that we have dropped py2 testing, we can pick up the latest version. This uncovered a few things to clean up. Mostly the fact that mock is now a part of the StdLib unittest since Python 3.3. Change-Id: I27484dd4c25378413ff16e97a35a1a46062357bc Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | | Replace six.iteritems() with .items()lihaijing2020-01-092-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. As mentioned in [1], we should avoid using 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 Co-Authored-By: Akihiro Motoki <amotoki@gmail.com> Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85 Implements: blueprint replace-iteritems-with-items
* | | Fix router create/show if extraroute not supportedÉdouard Thuleau2019-12-041-0/+18
| | | | | | | | | | | | | | | | | | | | | If neutron does not support extraroute l3 extension, the route column formatter fails. Change-Id: I7b89c4f818865073947e0850e86c18d0d2415a51
* | | Provide stderr in exception when check_parser failsMatt Riedemann2019-11-202-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For negative tests that are asserting an argparse failure it would be useful to assert the specific reason for the failure in the test rather than just getting an exception, especially to avoid false positives in the tests when what is being tested and failing isn't the actual expected reason for the failure. This wraps the check_parser code that parses the args and mocks sys.stderr so we can trap that output and put it in the exception message that gets raised to the test. As a result, we can tighten up a test that was passing before for the wrong reason [1]. [1] https://review.opendev.org/#/c/673725/12/openstackclient/tests/unit/compute/v2/test_server.py@605 Change-Id: I0f1dc1215bdfb3eba98ccaf66a0041d220b93812
* | | Microversion 2.79: Add delete_on_termination to volume-attach APIzhangbailin2019-11-191-0/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added ``--disable-delete-on-termination`` and ``--enable-delete-on-termination`` options to the ``openstack server add volume`` command that enables users to mark whether to delete the attached volume when the server is destroyed. Depends-On: https://review.opendev.org/#/c/681267/ Part of blueprint support-delete-on-termination-in-server-attach-volume Change-Id: I6b5cd54b82a1135335a71b9768a1a2c2012f755b
* | | Use SDK to get compute API extensionsMatt Riedemann2019-10-311-13/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | python-novaclient 16.0.0 removed the deprecated list_extensions module [1] so this changes the extensions command to use openstacksdk to get the compute API extensions. The functional test ExtensionTests.test_extension_list_compute ensures this works. [1] https://review.opendev.org/686516/ Change-Id: I9894bc395c0474aaa6494ac4534862efe4ea7984 Story: #2006769 Task: #37284
* | | Merge "Add parent project filter for listing projects"Zuul2019-10-221-0/+22
|\ \ \
| * | | Add parent project filter for listing projectsTakashi Kajinami2019-09-021-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a new option --parent into project list, to specify a parent project to filter projects which has the given project as their parent. Depends-on: https://review.opendev.org/#/c/677101 Change-Id: I6725262cf040e0ec6ceca9cf0462ce59224049c6
* | | | Merge "Add floating IP Port Forwarding commands"Zuul2019-09-092-0/+579
|\ \ \ \
| * | | | Add floating IP Port Forwarding commandsLIU Yulong2019-08-292-0/+579
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add following commands: floating ip port forwarding create floating ip port forwarding delete floating ip port forwarding list floating ip port forwarding set floating ip port forwarding show Closes-Bug: #1811352 Change-Id: I6a5642e8acce28fc830410d4fa3180597b862761
* | | | | Microversion 2.77: Support Specifying AZ to unshelvezhangbailin2019-09-031-0/+54
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new parameter ``--availability-zone`` to ``openstack server unshelve`` command. This can help users to specify an ``availability_zone`` to unshelve a shelve offloaded server from 2.77 microversion. Depends-On: https://review.opendev.org/679295 Implements: blueprint support-specifying-az-when-restore-shelved-server Change-Id: Ia431e27c2a17fe16466707cc362532860ecf22df
* | | | Merge "Remove token_endpoint auth type"Zuul2019-08-292-15/+15
|\ \ \ \
| * | | | Remove token_endpoint auth typeDean Troyer2019-08-272-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The token_endpoint was a compatibility auth type to maintain support for the --url global option that dated back to the beginning of OpenStack CLI auth. The common keystoneauth library implements 'admin_token' which provides the same functionality using --endpoint rather than --url. Change-Id: I1b9fbb96e447889a41b705324725a2ffc8ecfd9f Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | | | | Merge "Bump hacking version"Zuul2019-08-282-2/+2
|\ \ \ \ \ | |_|/ / / |/| | | |
| * | | | Bump hacking versionStephen Finucane2019-08-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pick up newer versions of this library. Thankfully no serious changes are needed. Change-Id: I69e523844529fc1c8aa0c1ce764182dbe29cfeb6 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | | | Format aggregate command fields and de-race functional testsDean Troyer2019-08-261-18/+23
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename metadata to property in all aggregate commands Beef up functional tests to reduce street racing Change-Id: I4598da73b85a954f3e6a3981db21891b45d9548c Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | | | Merge "Add 'openstack server resize (confirm|revert)' commands"Zuul2019-08-201-2/+80
|\ \ \ \
| * | | | Add 'openstack server resize (confirm|revert)' commandsStephen Finucane2019-08-091-2/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are currently exposed as flags on the 'openstack server resize' command but they are in fact operation and should be exposed as commands in their own right. The old flag-based variants are deprecated for removal in 4.0. Change-Id: I733796d3bda6c3755a3d3548bbe695abb474a6a0 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | | | Merge "Add openstack server create --boot-from-volume option"Zuul2019-08-201-0/+27
|\ \ \ \ \ | | |/ / / | |/| | |
| * | | | Add openstack server create --boot-from-volume optionMatt Riedemann2019-08-091-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a --boot-from-volume option to the server create command which is used with the --image or --image-property option and will create a volume-backed server from the specified image with the specified size. Similar to the --volume option, the created root volume will not be deleted when the server is deleted. The --boot-from-volume option is not allowed with the --volume option since they both create a block device mapping with boot_index=0. Change-Id: I88c590361cb232c1df7b5bb010dcea307080d34c Story: 2006302 Task: 36017