summaryrefslogtreecommitdiff
path: root/openstackclient/tests
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-032-2/+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 "Fix faulthy state argument choice"5.1.0Zuul2020-03-241-0/+18
|\ \
| * | Fix faulthy state argument choiceBram Verschueren2019-12-191-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The correct state name for a failing volume snapshot deletion is 'error_deleting' instead of 'error-deleting'. [1] [1] https://opendev.org/openstack/cinder/src/commit/89d6a5042fcb2ede5a0b1112d72fae805ea52fcd/cinder/objects/fields.py#L126 Task: #37844 Story: #2007037 Change-Id: Ia99900ece4f1cd29769b22ddaa3965789d719556
* | | 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-204-1/+106
|\ \ \ \ \
| * | | | | Now we can add description for role creation in OSCM V P Nitesh2018-09-184-1/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | Merge "Create Volume v3 functional tests"Zuul2020-01-135-11/+1031
|\ \ \ \ \
| * | | | | Create Volume v3 functional testsDean Troyer2019-11-185-11/+1031
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now-ish Volume v3 has been a pass-through to v2. In order to prepare to make the Volume v3 commands stand-alone copy the v2 functional tests to v3. This is the first of a series of reviews to completely separate Volume v2 and v3 commands. Once these are split we can begin to implement v3 microversion support and/or start using the OpenStack SDK as the REST library. Change-Id: Iefd78d8ef6bb851d7360596337a88ee8f8476767 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | | | | | 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
* | | | | Merge "Fix router create/show if extraroute not supported"Zuul2020-01-071-0/+18
|\ \ \ \ \
| * | | | | 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
* | | | | Fix openstack server list --deleted --marker optionKeithMnemonic2020-01-021-0/+43
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes using the "name" option for a marker when --deleted is also used. The find_resource() function that is being called does not correctly handle using the marker as the "name" in the search when also using deleted=True. One simple way to fix this is force the marker to only be an ID when --deleted is used. This is how the nova client works. Using the --deleted option is available to users with the admin role by default. If you're an admin listing --deleted servers with a marker by name, find_resource() is going to fail to find it since it doesn't apply the --deleted filter to find_resource(). The find_resource() function is trying to find the marker server by name if it's not found by id, and to find it by name it's listing servers with the given marker as the name, but not applying the --deleted filter so it doesn't get back any results. In the story it was suggested modifying find_resource to include the deleted query param when it's specified on the command line but that didn't work because it still results in something like this: http://192.168.1.123/compute/v2.1/servers?deleted=True&name=4cecd49f-bc25-4a7e-826e-4aea6f9267d9 It seems like there are bugs in find_resource(). Restricting the marker to be the server ID when listing deleted servers is probably OK since if you're using --deleted you're an admin and you could be listing across all projects and if you're filtering by a server across all projects anyway (not that you have to, I'm just saying if you are), or even showing a server in another project, you have to do it by id rather than name because find_resource() won't find the server in another project by name, only ID. story: 2006761 Task: 37258 Change-Id: Ib878982b1d469212ca3483dcfaf407a8e1d2b417
* | | | 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
* | | Refactor AggregateTestsEric Fried2019-11-051-41/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While investigating the referenced story/bug I noticed that wait_for_status in openstackclient.tests.functional.compute.v2.test_aggregate.AggregateTests was doing a lot more than it should ever need to (it probably got copied in from somewhere). The two places calling it only need to a) check the output of `openstack aggregate show`, and b) try once -- since they just got done creating the aggregate synchronously, there should never be a need to delay/retry. So this commit removes the helper method and just inlines the check. At the same time, the addCleanup(aggregate delete) directives are moved above their respective creates. This is a defensive best practice which makes sure cleanup happens even if something fails very soon after the actual back-end create (as was in fact the case with the referenced bug/story). It is unknown whether this will impact the referenced bug. Change-Id: I0d7432f13642fbccd5ca79da9c76adfcbabb5fa9 Story: 2006811 Related-Bug: #1851391
* | | 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
* | | Fix functional tests for py3Eric Fried2019-10-315-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix various things so the functional tests will work under python3: - A hashlib.md5() can only be update()d with an encoded string in py3. - There's no dict.iteritems(), change to dict.items() (which is already an iterator). - Open temp files with 'w+' mode rather than the default 'w+b' (as an alternative to encoding all the write and expected-read payloads as bytes). - (This is a weird one) Explicitly raise SkipTest from unittest (rather than unittest2, which is where cls.skipException landed). Not sure why this is busted, but this moves the ball. Change-Id: Ic9b2b47848a600e87a3674289ae7ae8c3e091fee
* | | 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 "More aggregate functional race chasing"Zuul2019-09-111-5/+3
|\ \ \ \
| * | | | More aggregate functional race chasingDean Troyer2019-09-101-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AggregateTests.wait_for_status() was a classmethod, those often are sources of conflict in parallel testing... Change-Id: I6211fd9c36926ca97de51a11923933d4d9d2dfda Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | | | | 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