return result
+def check_nova_notify():
+ result = checks.nova_notify_supported()
+ if not result:
+ LOG.error(_('Nova notifcations are enabled, but novaclient is not '
+ 'installed. Either disable nova notifications or install '
+ 'python-novaclient.'))
+ return result
+
+
# Define CLI opts to test specific features, with a calback for the test
OPTS = [
BoolOptCallback('ovs_vxlan', check_ovs_vxlan, default=False,
help=_('Check for vxlan support')),
BoolOptCallback('ovs_patch', check_ovs_patch, default=False,
help=_('Check for patch port support')),
+ BoolOptCallback('nova_notify', check_nova_notify, default=False,
+ help=_('Check for nova notification support')),
]
cfg.CONF.set_override('ovs_patch', True)
if not cfg.CONF.OVS.use_veth_interconnection:
cfg.CONF.set_override('ovs_patch', True)
+ if (cfg.CONF.notify_nova_on_port_status_changes or
+ cfg.CONF.notify_nova_on_port_data_changes):
+ cfg.CONF.set_override('nova_notify', True)
def all_tests_passed():
from neutron.tests import base
-class OVSSanityTestCase(base.BaseTestCase):
+class SanityTestCase(base.BaseTestCase):
+ """Sanity checks that do not require root access.
+
+ Tests that just call checks.some_function() are to ensure that
+ neutron-sanity-check runs without throwing an exception, as in the case
+ where someone modifies the API without updating the check script.
+ """
+
+ def setUp(self):
+ super(SanityTestCase, self).setUp()
+
+ def test_nova_notify_runs(self):
+ checks.nova_notify_supported()
+
+
+class SanityTestCaseRoot(base.BaseTestCase):
+ """Sanity checks that require root access.
+
+ Tests that just call checks.some_function() are to ensure that
+ neutron-sanity-check runs without throwing an exception, as in the case
+ where someone modifies the API without updating the check script.
+ """
def setUp(self):
- super(OVSSanityTestCase, self).setUp()
+ super(SanityTestCaseRoot, self).setUp()
self.root_helper = 'sudo'
+ self.check_sudo_enabled()
def check_sudo_enabled(self):
if os.environ.get('OS_SUDO_TESTING') not in base.TRUE_STRING:
self.skipTest('testing with sudo is not enabled')
def test_ovs_vxlan_support_runs(self):
- """This test just ensures that the test in neutron-sanity-check
- can run through without error, without mocking anything out
- """
- self.check_sudo_enabled()
checks.vxlan_supported(self.root_helper)
def test_ovs_patch_support_runs(self):
- """This test just ensures that the test in neutron-sanity-check
- can run through without error, without mocking anything out
- """
- self.check_sudo_enabled()
checks.patch_supported(self.root_helper)