diff options
author | Ken'ichi Ohmichi <ken-oomichi@wx.jp.nec.com> | 2016-05-25 15:03:11 -0700 |
---|---|---|
committer | Ken'ichi Ohmichi <ken-oomichi@wx.jp.nec.com> | 2016-06-01 11:23:43 -0700 |
commit | e1e5f6790f420cb8510844107a8154aa77961935 (patch) | |
tree | 90b594b0c1804504d72a4c5a94836cbf2cc3833a | |
parent | 8922a2942f285a1037060c1535a2159dad635219 (diff) | |
download | nova-e1e5f6790f420cb8510844107a8154aa77961935.tar.gz |
Remove the usage of RateLimitingMiddleware
RateLimitingMiddleware exists in legacy v2 API code, and the class is
used at test_limits and fakes moudles. However, that is not necessary
to pass the test at all. So this patch just removes the usage of the
class.
Change-Id: Ic0a74ac244146241c5b6fe6f149205417fbd937d
17 files changed, 2 insertions, 34 deletions
diff --git a/nova/tests/functional/api_sample_tests/test_config_drive.py b/nova/tests/functional/api_sample_tests/test_config_drive.py index 987b9941ed..bb6ff80ccc 100644 --- a/nova/tests/functional/api_sample_tests/test_config_drive.py +++ b/nova/tests/functional/api_sample_tests/test_config_drive.py @@ -41,7 +41,6 @@ class ConfigDriveSampleJsonTest(test_servers.ServersSampleBase): def setUp(self): super(ConfigDriveSampleJsonTest, self).setUp() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) fake.stub_out_image_service(self) def test_config_drive_show(self): diff --git a/nova/tests/functional/api_sample_tests/test_volumes.py b/nova/tests/functional/api_sample_tests/test_volumes.py index 9ae6a5d23f..bd907ca451 100644 --- a/nova/tests/functional/api_sample_tests/test_volumes.py +++ b/nova/tests/functional/api_sample_tests/test_volumes.py @@ -146,7 +146,6 @@ class VolumesSampleJsonTest(test_servers.ServersSampleBase): def setUp(self): super(VolumesSampleJsonTest, self).setUp() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.stub_out("nova.volume.cinder.API.delete", self._stub_volume_delete) diff --git a/nova/tests/unit/api/openstack/compute/test_auth.py b/nova/tests/unit/api/openstack/compute/test_auth.py index ae5c6552c4..7a0ecaad42 100644 --- a/nova/tests/unit/api/openstack/compute/test_auth.py +++ b/nova/tests/unit/api/openstack/compute/test_auth.py @@ -40,7 +40,6 @@ class TestNoAuthMiddleware(testscenarios.WithScenarios, test.NoDBTestCase): def setUp(self): super(TestNoAuthMiddleware, self).setUp() - fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_networking(self) api_v21 = openstack_api.FaultWrapper( self.auth_middleware( diff --git a/nova/tests/unit/api/openstack/compute/test_config_drive.py b/nova/tests/unit/api/openstack/compute/test_config_drive.py index de11079193..652cf2409e 100644 --- a/nova/tests/unit/api/openstack/compute/test_config_drive.py +++ b/nova/tests/unit/api/openstack/compute/test_config_drive.py @@ -44,7 +44,6 @@ class ConfigDriveTestV21(test.TestCase): def setUp(self): super(ConfigDriveTestV21, self).setUp() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) fake.stub_out_image_service(self) self._setup_wsgi() diff --git a/nova/tests/unit/api/openstack/compute/test_flavors.py b/nova/tests/unit/api/openstack/compute/test_flavors.py index 96df807953..2351ad566a 100644 --- a/nova/tests/unit/api/openstack/compute/test_flavors.py +++ b/nova/tests/unit/api/openstack/compute/test_flavors.py @@ -121,7 +121,6 @@ class FlavorsTestV21(test.TestCase): super(FlavorsTestV21, self).setUp() self.flags(osapi_compute_extension=[]) fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.compute.flavors, "get_all_flavors_sorted_list", fake_get_all_flavors_sorted_list) self.stubs.Set(nova.compute.flavors, diff --git a/nova/tests/unit/api/openstack/compute/test_images.py b/nova/tests/unit/api/openstack/compute/test_images.py index 177d914c6a..40d08749fc 100644 --- a/nova/tests/unit/api/openstack/compute/test_images.py +++ b/nova/tests/unit/api/openstack/compute/test_images.py @@ -52,7 +52,6 @@ class ImagesControllerTestV21(test.NoDBTestCase): super(ImagesControllerTestV21, self).setUp() self.flags(api_servers=['http://localhost:9292'], group='glance') fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fakes.stub_out_compute_api_snapshot(self.stubs) fakes.stub_out_compute_api_backup(self.stubs) diff --git a/nova/tests/unit/api/openstack/compute/test_keypairs.py b/nova/tests/unit/api/openstack/compute/test_keypairs.py index 3bf30fd3fd..be67e858e3 100644 --- a/nova/tests/unit/api/openstack/compute/test_keypairs.py +++ b/nova/tests/unit/api/openstack/compute/test_keypairs.py @@ -78,7 +78,6 @@ class KeypairsTestV21(test.TestCase): def setUp(self): super(KeypairsTestV21, self).setUp() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.stub_out("nova.db.key_pair_get_all_by_user", db_key_pair_get_all_by_user) diff --git a/nova/tests/unit/api/openstack/compute/test_limits.py b/nova/tests/unit/api/openstack/compute/test_limits.py index 256ae8343a..b6d0dc8eb7 100644 --- a/nova/tests/unit/api/openstack/compute/test_limits.py +++ b/nova/tests/unit/api/openstack/compute/test_limits.py @@ -25,7 +25,6 @@ from oslo_serialization import jsonutils from oslo_utils import encodeutils import webob -from nova.api.openstack.compute.legacy_v2 import limits from nova.api.openstack.compute import limits as limits_v21 from nova.api.openstack.compute import views from nova.api.openstack import wsgi @@ -42,7 +41,6 @@ class BaseLimitTestSuite(test.NoDBTestCase): def setUp(self): super(BaseLimitTestSuite, self).setUp() self.time = 0.0 - self.stubs.Set(limits.Limit, "_get_time", self._get_time) self.absolute_limits = {} def stub_get_project_quotas(context, project_id, usages=True): diff --git a/nova/tests/unit/api/openstack/compute/test_multinic.py b/nova/tests/unit/api/openstack/compute/test_multinic.py index e4fcbf5224..ee48e422ba 100644 --- a/nova/tests/unit/api/openstack/compute/test_multinic.py +++ b/nova/tests/unit/api/openstack/compute/test_multinic.py @@ -59,7 +59,6 @@ class FixedIpTestV21(test.NoDBTestCase): def setUp(self): super(FixedIpTestV21, self).setUp() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.stub_out('nova.compute.api.API.add_fixed_ip', compute_api_add_fixed_ip) self.stub_out('nova.compute.api.API.remove_fixed_ip', diff --git a/nova/tests/unit/api/openstack/compute/test_multiple_create.py b/nova/tests/unit/api/openstack/compute/test_multiple_create.py index 4cad859150..50913db569 100644 --- a/nova/tests/unit/api/openstack/compute/test_multiple_create.py +++ b/nova/tests/unit/api/openstack/compute/test_multiple_create.py @@ -112,7 +112,6 @@ class MultiCreateExtensionTestV21(test.TestCase): def project_get_networks(context, user_id): return dict(id='1', host='localhost') - fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fake.stub_out_image_service(self) fakes.stub_out_nw_api(self) diff --git a/nova/tests/unit/api/openstack/compute/test_networks.py b/nova/tests/unit/api/openstack/compute/test_networks.py index 70cfbdecf5..530f7230b8 100644 --- a/nova/tests/unit/api/openstack/compute/test_networks.py +++ b/nova/tests/unit/api/openstack/compute/test_networks.py @@ -247,7 +247,6 @@ class NetworkCreateExceptionsTestV21(test.TestCase): super(NetworkCreateExceptionsTestV21, self).setUp() self._setup() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.new_network = copy.deepcopy(NEW_NETWORK) def _setup(self): @@ -315,7 +314,6 @@ class NetworksTestV21(test.NoDBTestCase): self.fake_network_api = FakeNetworkAPI() self._setup() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.new_network = copy.deepcopy(NEW_NETWORK) self.non_admin_req = fakes.HTTPRequest.blank( '', project_id=fakes.FAKE_PROJECT_ID) @@ -482,7 +480,6 @@ class NetworksAssociateTestV21(test.NoDBTestCase): self.fake_network_api = FakeNetworkAPI() self._setup() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.admin_req = fakes.HTTPRequest.blank('', use_admin_context=True) def _setup(self): diff --git a/nova/tests/unit/api/openstack/compute/test_serversV21.py b/nova/tests/unit/api/openstack/compute/test_serversV21.py index 16489c66a6..06264157e1 100644 --- a/nova/tests/unit/api/openstack/compute/test_serversV21.py +++ b/nova/tests/unit/api/openstack/compute/test_serversV21.py @@ -194,7 +194,6 @@ class ControllerTest(test.TestCase): def setUp(self): super(ControllerTest, self).setUp() self.flags(verbose=True, use_ipv6=False) - fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fake.stub_out_image_service(self) return_server = fakes.fake_compute_get() @@ -2418,7 +2417,6 @@ class ServersControllerCreateTest(test.TestCase): def project_get_networks(context, user_id): return dict(id='1', host='localhost') - fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fake.stub_out_image_service(self) self.stubs.Set(uuid, 'uuid4', fake_gen_uuid) diff --git a/nova/tests/unit/api/openstack/compute/test_snapshots.py b/nova/tests/unit/api/openstack/compute/test_snapshots.py index 0da352b3fe..6f8f3a2e79 100644 --- a/nova/tests/unit/api/openstack/compute/test_snapshots.py +++ b/nova/tests/unit/api/openstack/compute/test_snapshots.py @@ -32,7 +32,6 @@ class SnapshotApiTestV21(test.NoDBTestCase): def setUp(self): super(SnapshotApiTestV21, self).setUp() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(cinder.API, "create_snapshot", fakes.stub_snapshot_create) self.stubs.Set(cinder.API, "create_snapshot_force", diff --git a/nova/tests/unit/api/openstack/compute/test_urlmap.py b/nova/tests/unit/api/openstack/compute/test_urlmap.py index 751450aa64..9c836e59bd 100644 --- a/nova/tests/unit/api/openstack/compute/test_urlmap.py +++ b/nova/tests/unit/api/openstack/compute/test_urlmap.py @@ -24,7 +24,6 @@ import nova.tests.unit.image.fake class UrlmapTest(test.NoDBTestCase): def setUp(self): super(UrlmapTest, self).setUp() - fakes.stub_out_rate_limiting(self.stubs) nova.tests.unit.image.fake.stub_out_image_service(self) def tearDown(self): diff --git a/nova/tests/unit/api/openstack/compute/test_user_data.py b/nova/tests/unit/api/openstack/compute/test_user_data.py index 970d91c139..74a038e229 100644 --- a/nova/tests/unit/api/openstack/compute/test_user_data.py +++ b/nova/tests/unit/api/openstack/compute/test_user_data.py @@ -118,7 +118,6 @@ class ServersControllerCreateTest(test.TestCase): def project_get_networks(context, user_id): return dict(id='1', host='localhost') - fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fake.stub_out_image_service(self) fakes.stub_out_nw_api(self) diff --git a/nova/tests/unit/api/openstack/compute/test_volumes.py b/nova/tests/unit/api/openstack/compute/test_volumes.py index 2c1140f168..3f676f7b19 100644 --- a/nova/tests/unit/api/openstack/compute/test_volumes.py +++ b/nova/tests/unit/api/openstack/compute/test_volumes.py @@ -227,7 +227,6 @@ class VolumeApiTestV21(test.NoDBTestCase): def setUp(self): super(VolumeApiTestV21, self).setUp() fakes.stub_out_networking(self) - fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(cinder.API, "delete", fakes.stub_volume_delete) self.stubs.Set(cinder.API, "get", fakes.stub_volume_get) diff --git a/nova/tests/unit/api/openstack/fakes.py b/nova/tests/unit/api/openstack/fakes.py index 96f8698824..2b5685e41f 100644 --- a/nova/tests/unit/api/openstack/fakes.py +++ b/nova/tests/unit/api/openstack/fakes.py @@ -29,7 +29,6 @@ from nova.api import auth as api_auth from nova.api import openstack as openstack_api from nova.api.openstack import api_version_request as api_version from nova.api.openstack import compute -from nova.api.openstack.compute.legacy_v2 import limits from nova.api.openstack.compute import versions from nova.api.openstack import urlmap from nova.api.openstack import wsgi as os_wsgi @@ -75,9 +74,8 @@ def wsgi_app_v21(fake_auth_context=None, init_only=None, v2_compatible=False): ctxt = fake_auth_context else: ctxt = context.RequestContext('fake', 'fake', auth_token=True) - api_v21 = openstack_api.FaultWrapper(api_auth.InjectContext(ctxt, - limits.RateLimitingMiddleware(inner_app_v21))) - + api_v21 = openstack_api.FaultWrapper( + api_auth.InjectContext(ctxt, inner_app_v21)) mapper = urlmap.URLMap() mapper['/v2'] = api_v21 mapper['/v2.1'] = api_v21 @@ -107,16 +105,6 @@ def stub_out_key_pair_funcs(stubs, have_key_pair=True, **kwargs): stubs.Set(nova.db, 'key_pair_get_all_by_user', no_key_pair) -def stub_out_rate_limiting(stubs): - def fake_rate_init(self, app): - super(limits.RateLimitingMiddleware, self).__init__(app) - self.application = app - - v2_limits = nova.api.openstack.compute.legacy_v2.limits - stubs.Set(v2_limits.RateLimitingMiddleware, '__init__', fake_rate_init) - stubs.Set(v2_limits.RateLimitingMiddleware, '__call__', fake_wsgi) - - def stub_out_instance_quota(test, allowed, quota, resource='instances'): def fake_reserve(context, **deltas): requested = deltas.pop(resource, 0) |