diff options
| author | Rodolfo Alonso Hernandez <ralonsoh@redhat.com> | 2021-07-27 16:45:24 +0000 |
|---|---|---|
| committer | Rodolfo Alonso Hernandez <ralonsoh@redhat.com> | 2021-12-07 17:49:26 +0000 |
| commit | bef70397a3e1240cc593b3fb34049f2ff6601e68 (patch) | |
| tree | 25ad4af54a4448fd931fc1d125ca0977d55be430 /openstackclient/tests/unit/common | |
| parent | 59256becc93d7953f983e0fbbdef098fefba73ff (diff) | |
| download | python-openstackclient-bef70397a3e1240cc593b3fb34049f2ff6601e68.tar.gz | |
Add network update quota "limit_check" parameter
This new parameter commands the Neutron server to first check the
resource usage before setting the new quota limit. If the resource
usage is below the new limit, the Neutron server will raise an
exception.
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/806254
Depends-On: https://review.opendev.org/c/openstack/neutron/+/801470
Partial-Bug: #1936408
Change-Id: Idc1b99492d609eb699d0a6bef6cd760458a774f6
Diffstat (limited to 'openstackclient/tests/unit/common')
| -rw-r--r-- | openstackclient/tests/unit/common/test_quota.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/common/test_quota.py b/openstackclient/tests/unit/common/test_quota.py index 8771359c..896a63a7 100644 --- a/openstackclient/tests/unit/common/test_quota.py +++ b/openstackclient/tests/unit/common/test_quota.py @@ -950,6 +950,49 @@ class TestQuotaSet(TestQuota): ) self.assertIsNone(result) + def test_quota_set_with_check_limit(self): + arglist = [ + '--subnets', str(network_fakes.QUOTA['subnet']), + '--volumes', str(volume_fakes.QUOTA['volumes']), + '--cores', str(compute_fakes.core_num), + '--check-limit', + self.projects[0].name, + ] + verifylist = [ + ('subnet', network_fakes.QUOTA['subnet']), + ('volumes', volume_fakes.QUOTA['volumes']), + ('cores', compute_fakes.core_num), + ('check_limit', True), + ('project', self.projects[0].name), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + result = self.cmd.take_action(parsed_args) + + kwargs_compute = { + 'cores': compute_fakes.core_num, + } + kwargs_volume = { + 'volumes': volume_fakes.QUOTA['volumes'], + } + kwargs_network = { + 'subnet': network_fakes.QUOTA['subnet'], + 'check_limit': True, + } + self.compute_quotas_mock.update.assert_called_once_with( + self.projects[0].id, + **kwargs_compute + ) + self.volume_quotas_mock.update.assert_called_once_with( + self.projects[0].id, + **kwargs_volume + ) + self.network_mock.update_quota.assert_called_once_with( + self.projects[0].id, + **kwargs_network + ) + self.assertIsNone(result) + class TestQuotaShow(TestQuota): |
