nova-net: Add TODOs for remaining nova-network functional tests
These are for the few tests that can't be converted since they're for nova-network. The following APIs have no neutron equivalent and therefore can't be converted: - POST /os-security-group-default-rules Raises 'HTTPNotImplemented' from the neutron security group driver - GET /os-security-group-default-rules Raises 'HTTPNotImplemented' from the neutron security group driver - GET /os-security-group-default-rules/{id} Raises 'HTTPNotImplemented' from the neutron security group driver - POST /os-tenant-networks Raises 'NotImplemented' from the neutron network driver - DELETE /os-tenant-networks/{id} Raises 'NotImplemented' from the neutron network driver - POST /os-networks Raises 'NotImplemented' from the neutron network driver - POST /os-networks/add Raises 'NotImplemented' from the neutron network driver - POST /os-networks/{id}/action Raises 'NotImplemented' from the neutron network driver - DELETE /os-networks/{id} Raises 'NotImplemented' from the neutron network driver The following work but need to be converted separately. We'll do that later when we remove the nova-network side of the APIs. - GET /os-networks - GET /os-networks/{id} - GET /os-tenant-networks Change-Id: Ide357a4e1479cacc8fcee80893dfbffb65ce8712 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
@@ -122,6 +122,8 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
|
|||||||
|
|
||||||
super(ApiSampleTestBaseV21, self)._setup_services()
|
super(ApiSampleTestBaseV21, self)._setup_services()
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove once we remove the few remaining
|
||||||
|
# nova-network-only APIs
|
||||||
if not self.USE_NEUTRON:
|
if not self.USE_NEUTRON:
|
||||||
# self.network is only setup if USE_NEUTRON=False
|
# self.network is only setup if USE_NEUTRON=False
|
||||||
self.useFixture(test.SampleNetworks(host=self.network.host))
|
self.useFixture(test.SampleNetworks(host=self.network.host))
|
||||||
|
@@ -39,8 +39,9 @@ def _fixtures_passthrough(method_name):
|
|||||||
return call
|
return call
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove the parts of this test that are nova-network only
|
||||||
class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||||
USE_NEUTRON = False
|
USE_NEUTRON = False # partially nova-net only
|
||||||
ADMIN_API = True
|
ADMIN_API = True
|
||||||
sample_dir = "os-networks"
|
sample_dir = "os-networks"
|
||||||
|
|
||||||
@@ -59,21 +60,25 @@ class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||||||
self.stub_out("nova.network.api.API.add_network_to_project",
|
self.stub_out("nova.network.api.API.add_network_to_project",
|
||||||
_fixtures_passthrough('add_network_to_project'))
|
_fixtures_passthrough('add_network_to_project'))
|
||||||
|
|
||||||
|
# TODO(stephenfin): Rework this to work with neutron
|
||||||
def test_network_list(self):
|
def test_network_list(self):
|
||||||
response = self._do_get('os-networks')
|
response = self._do_get('os-networks')
|
||||||
self._verify_response('networks-list-resp', {}, response, 200)
|
self._verify_response('networks-list-resp', {}, response, 200)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Rework this to work with neutron
|
||||||
def test_network_show(self):
|
def test_network_show(self):
|
||||||
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
|
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
|
||||||
response = self._do_get('os-networks/%s' % uuid)
|
response = self._do_get('os-networks/%s' % uuid)
|
||||||
self._verify_response('network-show-resp', {}, response, 200)
|
self._verify_response('network-show-resp', {}, response, 200)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Rework this to work with neutron
|
||||||
@mock.patch('nova.network.api.API.get', side_effect=exception.Unauthorized)
|
@mock.patch('nova.network.api.API.get', side_effect=exception.Unauthorized)
|
||||||
def test_network_show_token_expired(self, mock_get):
|
def test_network_show_token_expired(self, mock_get):
|
||||||
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
|
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
|
||||||
response = self._do_get('os-networks/%s' % uuid)
|
response = self._do_get('os-networks/%s' % uuid)
|
||||||
self.assertEqual(401, response.status_code)
|
self.assertEqual(401, response.status_code)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
@mock.patch('nova.network.api.API.create',
|
@mock.patch('nova.network.api.API.create',
|
||||||
side_effect=exception.Forbidden)
|
side_effect=exception.Forbidden)
|
||||||
def test_network_create_forbidden(self, mock_create):
|
def test_network_create_forbidden(self, mock_create):
|
||||||
@@ -81,17 +86,20 @@ class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||||||
'network-create-req', {})
|
'network-create-req', {})
|
||||||
self.assertEqual(403, response.status_code)
|
self.assertEqual(403, response.status_code)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
def test_network_create(self):
|
def test_network_create(self):
|
||||||
response = self._do_post("os-networks",
|
response = self._do_post("os-networks",
|
||||||
'network-create-req', {})
|
'network-create-req', {})
|
||||||
self._verify_response('network-create-resp', {}, response, 200)
|
self._verify_response('network-create-resp', {}, response, 200)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
def test_network_add(self):
|
def test_network_add(self):
|
||||||
response = self._do_post("os-networks/add",
|
response = self._do_post("os-networks/add",
|
||||||
'network-add-req', {})
|
'network-add-req', {})
|
||||||
self.assertEqual(202, response.status_code)
|
self.assertEqual(202, response.status_code)
|
||||||
self.assertEqual("", response.text)
|
self.assertEqual("", response.text)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
def test_network_delete(self):
|
def test_network_delete(self):
|
||||||
response = self._do_delete('os-networks/always_delete')
|
response = self._do_delete('os-networks/always_delete')
|
||||||
self.assertEqual(202, response.status_code)
|
self.assertEqual(202, response.status_code)
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||||
USE_NEUTRON = False
|
USE_NEUTRON = False # nova-net only
|
||||||
ADMIN_API = True
|
ADMIN_API = True
|
||||||
sample_dir = "os-networks-associate"
|
sample_dir = "os-networks-associate"
|
||||||
|
|
||||||
|
@@ -15,9 +15,10 @@
|
|||||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
class SecurityGroupDefaultRulesSampleJsonTest(
|
class SecurityGroupDefaultRulesSampleJsonTest(
|
||||||
api_sample_base.ApiSampleTestBaseV21):
|
api_sample_base.ApiSampleTestBaseV21):
|
||||||
USE_NEUTRON = False
|
USE_NEUTRON = False # nova-net only
|
||||||
ADMIN_API = True
|
ADMIN_API = True
|
||||||
sample_dir = 'os-security-group-default-rules'
|
sample_dir = 'os-security-group-default-rules'
|
||||||
|
|
||||||
|
@@ -23,8 +23,9 @@ from nova.tests.functional.api_sample_tests import api_sample_base
|
|||||||
CONF = nova.conf.CONF
|
CONF = nova.conf.CONF
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove the parts of this test that are nova-network only
|
||||||
class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||||
USE_NEUTRON = False
|
USE_NEUTRON = False # partially nova-net only
|
||||||
ADMIN_API = True
|
ADMIN_API = True
|
||||||
sample_dir = "os-tenant-networks"
|
sample_dir = "os-tenant-networks"
|
||||||
|
|
||||||
@@ -43,14 +44,17 @@ class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||||||
self.stub_out("nova.quota.QuotaEngine.commit", fake)
|
self.stub_out("nova.quota.QuotaEngine.commit", fake)
|
||||||
self.stub_out("nova.quota.QuotaEngine.rollback", fake)
|
self.stub_out("nova.quota.QuotaEngine.rollback", fake)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Rework this to work with neutron
|
||||||
def test_list_networks(self):
|
def test_list_networks(self):
|
||||||
response = self._do_get('os-tenant-networks')
|
response = self._do_get('os-tenant-networks')
|
||||||
self._verify_response('networks-list-res', {}, response, 200)
|
self._verify_response('networks-list-res', {}, response, 200)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
def test_create_network(self):
|
def test_create_network(self):
|
||||||
response = self._do_post('os-tenant-networks', "networks-post-req", {})
|
response = self._do_post('os-tenant-networks', "networks-post-req", {})
|
||||||
self._verify_response('networks-post-res', {}, response, 200)
|
self._verify_response('networks-post-res', {}, response, 200)
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this API since it's nova-network only
|
||||||
def test_delete_network(self):
|
def test_delete_network(self):
|
||||||
response = self._do_post('os-tenant-networks', "networks-post-req", {})
|
response = self._do_post('os-tenant-networks', "networks-post-req", {})
|
||||||
net = jsonutils.loads(response.content)
|
net = jsonutils.loads(response.content)
|
||||||
|
@@ -79,6 +79,8 @@ class _IntegratedTestBase(test.TestCase):
|
|||||||
# Override this in subclasses which use the legacy nova-network service.
|
# Override this in subclasses which use the legacy nova-network service.
|
||||||
# New tests should rely on Neutron and old ones migrated to use this since
|
# New tests should rely on Neutron and old ones migrated to use this since
|
||||||
# nova-network is deprecated.
|
# nova-network is deprecated.
|
||||||
|
# TODO(stephenfin): Remove once we remove the few remaining
|
||||||
|
# nova-network-only APIs
|
||||||
USE_NEUTRON = True
|
USE_NEUTRON = True
|
||||||
# This indicates whether to include the project ID in the URL for API
|
# This indicates whether to include the project ID in the URL for API
|
||||||
# requests through OSAPIFixture. Overridden by subclasses.
|
# requests through OSAPIFixture. Overridden by subclasses.
|
||||||
@@ -87,7 +89,6 @@ class _IntegratedTestBase(test.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(_IntegratedTestBase, self).setUp()
|
super(_IntegratedTestBase, self).setUp()
|
||||||
|
|
||||||
# TODO(mriedem): Fix the functional tests to work with Neutron.
|
|
||||||
self.flags(use_neutron=self.USE_NEUTRON)
|
self.flags(use_neutron=self.USE_NEUTRON)
|
||||||
|
|
||||||
# NOTE(mikal): this is used to stub away privsep helpers
|
# NOTE(mikal): this is used to stub away privsep helpers
|
||||||
|
@@ -37,6 +37,7 @@ def create_request_body():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(stephenfin): Remove this test since it's nova-network only
|
||||||
class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
|
class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
|
||||||
"""Tests for port interfaces command.
|
"""Tests for port interfaces command.
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
api_major_version = 'v2.1'
|
api_major_version = 'v2.1'
|
||||||
USE_NEUTRON = False
|
USE_NEUTRON = False # nova-net only
|
||||||
_image_ref_parameter = 'imageRef'
|
_image_ref_parameter = 'imageRef'
|
||||||
_flavor_ref_parameter = 'flavorRef'
|
_flavor_ref_parameter = 'flavorRef'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user