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:
Stephen Finucane 2019-09-20 13:24:44 +01:00
parent 449a5e770b
commit 1dac0542ea
7 changed files with 24 additions and 6 deletions

View File

@ -122,6 +122,8 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
super(ApiSampleTestBaseV21, self)._setup_services()
# TODO(stephenfin): Remove once we remove the few remaining
# nova-network-only APIs
if not self.USE_NEUTRON:
# self.network is only setup if USE_NEUTRON=False
self.useFixture(test.SampleNetworks(host=self.network.host))

View File

@ -39,8 +39,9 @@ def _fixtures_passthrough(method_name):
return call
# TODO(stephenfin): Remove the parts of this test that are nova-network only
class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
USE_NEUTRON = False
USE_NEUTRON = False # partially nova-net only
ADMIN_API = True
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",
_fixtures_passthrough('add_network_to_project'))
# TODO(stephenfin): Rework this to work with neutron
def test_network_list(self):
response = self._do_get('os-networks')
self._verify_response('networks-list-resp', {}, response, 200)
# TODO(stephenfin): Rework this to work with neutron
def test_network_show(self):
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
response = self._do_get('os-networks/%s' % uuid)
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)
def test_network_show_token_expired(self, mock_get):
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
response = self._do_get('os-networks/%s' % uuid)
self.assertEqual(401, response.status_code)
# TODO(stephenfin): Remove this API since it's nova-network only
@mock.patch('nova.network.api.API.create',
side_effect=exception.Forbidden)
def test_network_create_forbidden(self, mock_create):
@ -81,17 +86,20 @@ class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
'network-create-req', {})
self.assertEqual(403, response.status_code)
# TODO(stephenfin): Remove this API since it's nova-network only
def test_network_create(self):
response = self._do_post("os-networks",
'network-create-req', {})
self._verify_response('network-create-resp', {}, response, 200)
# TODO(stephenfin): Remove this API since it's nova-network only
def test_network_add(self):
response = self._do_post("os-networks/add",
'network-add-req', {})
self.assertEqual(202, response.status_code)
self.assertEqual("", response.text)
# TODO(stephenfin): Remove this API since it's nova-network only
def test_network_delete(self):
response = self._do_delete('os-networks/always_delete')
self.assertEqual(202, response.status_code)

View File

@ -16,8 +16,9 @@
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):
USE_NEUTRON = False
USE_NEUTRON = False # nova-net only
ADMIN_API = True
sample_dir = "os-networks-associate"

View File

@ -15,9 +15,10 @@
from nova.tests.functional.api_sample_tests import api_sample_base
# TODO(stephenfin): Remove this API since it's nova-network only
class SecurityGroupDefaultRulesSampleJsonTest(
api_sample_base.ApiSampleTestBaseV21):
USE_NEUTRON = False
USE_NEUTRON = False # nova-net only
ADMIN_API = True
sample_dir = 'os-security-group-default-rules'

View File

@ -23,8 +23,9 @@ from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
# TODO(stephenfin): Remove the parts of this test that are nova-network only
class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
USE_NEUTRON = False
USE_NEUTRON = False # partially nova-net only
ADMIN_API = True
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.rollback", fake)
# TODO(stephenfin): Rework this to work with neutron
def test_list_networks(self):
response = self._do_get('os-tenant-networks')
self._verify_response('networks-list-res', {}, response, 200)
# TODO(stephenfin): Remove this API since it's nova-network only
def test_create_network(self):
response = self._do_post('os-tenant-networks', "networks-post-req", {})
self._verify_response('networks-post-res', {}, response, 200)
# TODO(stephenfin): Remove this API since it's nova-network only
def test_delete_network(self):
response = self._do_post('os-tenant-networks', "networks-post-req", {})
net = jsonutils.loads(response.content)

View File

@ -79,6 +79,8 @@ class _IntegratedTestBase(test.TestCase):
# 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
# nova-network is deprecated.
# TODO(stephenfin): Remove once we remove the few remaining
# nova-network-only APIs
USE_NEUTRON = True
# This indicates whether to include the project ID in the URL for API
# requests through OSAPIFixture. Overridden by subclasses.
@ -87,7 +89,6 @@ class _IntegratedTestBase(test.TestCase):
def setUp(self):
super(_IntegratedTestBase, self).setUp()
# TODO(mriedem): Fix the functional tests to work with Neutron.
self.flags(use_neutron=self.USE_NEUTRON)
# NOTE(mikal): this is used to stub away privsep helpers

View File

@ -37,6 +37,7 @@ def create_request_body():
}
# TODO(stephenfin): Remove this test since it's nova-network only
class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
"""Tests for port interfaces command.
@ -56,7 +57,7 @@ class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
"""
api_major_version = 'v2.1'
USE_NEUTRON = False
USE_NEUTRON = False # nova-net only
_image_ref_parameter = 'imageRef'
_flavor_ref_parameter = 'flavorRef'