Browse Source

Merge "nova-net: Add TODOs for remaining nova-network functional tests"

changes/10/686810/9
Zuul 2 weeks ago
parent
commit
e9d7b82282
7 changed files with 24 additions and 6 deletions
  1. +2
    -0
      nova/tests/functional/api_sample_tests/api_sample_base.py
  2. +9
    -1
      nova/tests/functional/api_sample_tests/test_networks.py
  3. +2
    -1
      nova/tests/functional/api_sample_tests/test_networks_associate.py
  4. +2
    -1
      nova/tests/functional/api_sample_tests/test_security_group_default_rules.py
  5. +5
    -1
      nova/tests/functional/api_sample_tests/test_tenant_networks.py
  6. +2
    -1
      nova/tests/functional/integrated_helpers.py
  7. +2
    -1
      nova/tests/functional/wsgi/test_interfaces.py

+ 2
- 0
nova/tests/functional/api_sample_tests/api_sample_base.py 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))

+ 9
- 1
nova/tests/functional/api_sample_tests/test_networks.py 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)

+ 2
- 1
nova/tests/functional/api_sample_tests/test_networks_associate.py 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"


+ 2
- 1
nova/tests/functional/api_sample_tests/test_security_group_default_rules.py 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'


+ 5
- 1
nova/tests/functional/api_sample_tests/test_tenant_networks.py 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)

+ 2
- 1
nova/tests/functional/integrated_helpers.py View File

@@ -223,6 +223,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.
@@ -231,7 +233,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

+ 2
- 1
nova/tests/functional/wsgi/test_interfaces.py 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'


Loading…
Cancel
Save