summaryrefslogtreecommitdiff
path: root/nova/tests/unit/cmd/test_nova_api.py
diff options
context:
space:
mode:
authorArtom Lifshitz <alifshit@redhat.com>2016-06-28 21:28:48 +0000
committerDan Smith <dansmith@redhat.com>2016-06-29 20:55:16 -0700
commite83e114e1b00ec882276380be2331bebc79c833b (patch)
tree448eda1a52f733d4cffd4bb5bdcdeab09c1d5ee0 /nova/tests/unit/cmd/test_nova_api.py
parent9464c2ac1bfe05bdc2caf331c6b32e954b6a5177 (diff)
downloadnova-e83e114e1b00ec882276380be2331bebc79c833b.tar.gz
Device tagging API support
This patch allows the user to specify a tag for a virtual network interface and/or block device mapping when booting an instance. Implements: blueprint bp/virt-device-role-tagging Change-Id: I89247200f4cf1f644daf476727b4a6acb22b0cf6
Diffstat (limited to 'nova/tests/unit/cmd/test_nova_api.py')
-rw-r--r--nova/tests/unit/cmd/test_nova_api.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/nova/tests/unit/cmd/test_nova_api.py b/nova/tests/unit/cmd/test_nova_api.py
index d9477afbb8..c613c1c0e8 100644
--- a/nova/tests/unit/cmd/test_nova_api.py
+++ b/nova/tests/unit/cmd/test_nova_api.py
@@ -22,10 +22,12 @@ from nova import test
# required because otherwise oslo early parse_args dies
@mock.patch.object(config, 'parse_args', new=lambda *args, **kwargs: None)
+# required so we don't set the global service version cache
+@mock.patch('nova.objects.Service.enable_min_version_cache')
class TestNovaAPI(test.NoDBTestCase):
@mock.patch('nova.service.process_launcher')
- def test_with_ec2(self, launcher):
+ def test_with_ec2(self, launcher, version_cache):
"""Ensure that we don't explode if enabled_apis is wrong.
If the end user hasn't updated their config, an ec2 entry
@@ -40,8 +42,9 @@ class TestNovaAPI(test.NoDBTestCase):
# collide on ports.
self.flags(osapi_compute_listen_port=0)
api.main()
+ version_cache.assert_called_once_with()
- def test_continues_on_failure(self):
+ def test_continues_on_failure(self, version_cache):
count = [1, 2]
fake_server = mock.MagicMock()
@@ -65,9 +68,10 @@ class TestNovaAPI(test.NoDBTestCase):
launcher = mock_service.process_launcher.return_value
launcher.launch_service.assert_called_once_with(
fake_server, workers=123)
+ self.assertFalse(version_cache.called)
@mock.patch('sys.exit')
- def test_fails_if_none_started(self, mock_exit):
+ def test_fails_if_none_started(self, mock_exit, version_cache):
mock_exit.side_effect = test.TestingException
self.flags(enabled_apis=[])
with mock.patch.object(api, 'service') as mock_service:
@@ -75,9 +79,10 @@ class TestNovaAPI(test.NoDBTestCase):
mock_exit.assert_called_once_with(1)
launcher = mock_service.process_launcher.return_value
self.assertFalse(launcher.wait.called)
+ self.assertFalse(version_cache.called)
@mock.patch('sys.exit')
- def test_fails_if_all_failed(self, mock_exit):
+ def test_fails_if_all_failed(self, mock_exit, version_cache):
mock_exit.side_effect = test.TestingException
self.flags(enabled_apis=['foo', 'bar'])
with mock.patch.object(api, 'service') as mock_service:
@@ -87,3 +92,4 @@ class TestNovaAPI(test.NoDBTestCase):
mock_exit.assert_called_once_with(1)
launcher = mock_service.process_launcher.return_value
self.assertFalse(launcher.wait.called)
+ self.assertFalse(version_cache.called)