diff --git a/blazar/tests/plugins/instances/test_instance_plugin.py b/blazar/tests/plugins/instances/test_instance_plugin.py index 68edae2f..9c9ea761 100644 --- a/blazar/tests/plugins/instances/test_instance_plugin.py +++ b/blazar/tests/plugins/instances/test_instance_plugin.py @@ -859,7 +859,7 @@ class TestVirtualInstancePlugin(tests.TestCase): def test_update_resources_in_active(self): def fake_host_get(host_id): return {'service_name': 'host' + host_id[-1], - 'hypervisor_hostname': 'host' + host_id[-1]} + 'hypervisor_hostname': 'hypvsr' + host_id[-1]} reservation = { 'id': 'reservation-id1', @@ -896,11 +896,11 @@ class TestVirtualInstancePlugin(tests.TestCase): 'aggregate-1', 'host' + str(i + 1), stay_in=True) mock_update_reservation_inventory.assert_any_call( - 'host1', 'reservation-id1', 1) + 'hypvsr1', 'reservation-id1', 1) mock_update_reservation_inventory.assert_any_call( - 'host2', 'reservation-id1', 1) + 'hypvsr2', 'reservation-id1', 1) mock_update_reservation_inventory.assert_any_call( - 'host3', 'reservation-id1', 2) + 'hypvsr3', 'reservation-id1', 2) def test_update_reservation(self): plugin = instance_plugin.VirtualInstancePlugin() @@ -1044,7 +1044,7 @@ class TestVirtualInstancePlugin(tests.TestCase): def test_on_start(self): def fake_host_get(host_id): return {'service_name': 'host' + host_id[-1], - 'hypervisor_hostname': 'host' + host_id[-1]} + 'hypervisor_hostname': 'hypvsr' + host_id[-1]} self.set_context(context.BlazarContext(project_id='fake-project')) plugin = instance_plugin.VirtualInstancePlugin() @@ -1081,11 +1081,11 @@ class TestVirtualInstancePlugin(tests.TestCase): 'aggregate-id1', 'host' + str(i + 1), stay_in=True) mock_update_reservation_inventory.assert_any_call( - 'host1', 'reservation-id1', 1) + 'hypvsr1', 'reservation-id1', 1) mock_update_reservation_inventory.assert_any_call( - 'host2', 'reservation-id1', 1) + 'hypvsr2', 'reservation-id1', 1) mock_update_reservation_inventory.assert_any_call( - 'host3', 'reservation-id1', 2) + 'hypvsr3', 'reservation-id1', 2) def test_on_end(self): self.set_context(context.BlazarContext(project_id='fake-project-id')) @@ -1105,8 +1105,8 @@ class TestVirtualInstancePlugin(tests.TestCase): mock_host_get = self.patch(db_api, 'host_get') mock_host_get.side_effect = [ - {'service_name': 'host1', 'hypervisor_hostname': 'host1'}, - {'service_name': 'host2', 'hypervisor_hostname': 'host2'} + {'service_name': 'host1', 'hypervisor_hostname': 'hypvsr1'}, + {'service_name': 'host2', 'hypervisor_hostname': 'hypvsr2'} ] mock_delete_reservation_inventory = self.patch( @@ -1139,7 +1139,7 @@ class TestVirtualInstancePlugin(tests.TestCase): fake.delete.assert_called_once() for i in range(2): mock_delete_reservation_inventory.assert_any_call( - 'host' + str(i + 1), 'reservation-id1') + 'hypvsr' + str(i + 1), 'reservation-id1') mock_cleanup_resources.assert_called_once_with( fake_instance_reservation) mock_delete_reservation_class.assert_called_once_with( @@ -1333,10 +1333,10 @@ class TestVirtualInstancePlugin(tests.TestCase): plugin = instance_plugin.VirtualInstancePlugin() failed_host = {'id': '1', 'service_name': 'compute-1', - 'hypervisor_hostname': 'compute-1'} + 'hypervisor_hostname': 'hypvsr-1'} new_host = {'id': '2', 'service_name': 'compute-2', - 'hypervisor_hostname': 'compute-2'} + 'hypervisor_hostname': 'hypvsr-2'} dummy_reservation = { 'id': 'rsrv-1', 'resource_type': instances.RESOURCE_TYPE, @@ -1394,9 +1394,9 @@ class TestVirtualInstancePlugin(tests.TestCase): new_host['service_name'], stay_in=True) mock_delete_reservation_inventory.assert_called_once_with( - 'compute-1', 'rsrv-1') + 'hypvsr-1', 'rsrv-1') mock_update_reservation_inventory.assert_called_once_with( - 'compute-2', 'rsrv-1', 1, additional=True) + 'hypvsr-2', 'rsrv-1', 1, additional=True) self.assertEqual(True, result) def test_reallocate_missing_resources(self): @@ -1496,10 +1496,10 @@ class TestVirtualInstancePlugin(tests.TestCase): plugin = instance_plugin.VirtualInstancePlugin() failed_host = {'id': '1', 'service_name': 'compute-1', - 'hypervisor_hostname': 'compute-1'} + 'hypervisor_hostname': 'hypvsr-1'} new_host = {'id': '2', 'service_name': 'compute-2', - 'hypervisor_hostname': 'compute-2'} + 'hypervisor_hostname': 'hypvsr-2'} dummy_reservation = { 'id': 'rsrv-1', 'resource_type': instances.RESOURCE_TYPE, @@ -1561,9 +1561,9 @@ class TestVirtualInstancePlugin(tests.TestCase): new_host['service_name'], stay_in=True) mock_delete_reservation_inventory.assert_called_once_with( - 'compute-1', 'rsrv-1') + 'hypvsr-1', 'rsrv-1') mock_update_reservation_inventory.assert_called_once_with( - 'compute-2', 'rsrv-1', 2, additional=True) + 'hypvsr-2', 'rsrv-1', 2, additional=True) self.assertEqual(True, result) def test_reallocate_missing_resources_with_affinity(self): diff --git a/blazar/tests/plugins/oshosts/test_physical_host_plugin.py b/blazar/tests/plugins/oshosts/test_physical_host_plugin.py index 349d7b20..116596a0 100644 --- a/blazar/tests/plugins/oshosts/test_physical_host_plugin.py +++ b/blazar/tests/plugins/oshosts/test_physical_host_plugin.py @@ -118,8 +118,8 @@ class PhysicalHostPluginTestCase(tests.TestCase): self.fake_host_id = '1' self.fake_host = { 'id': self.fake_host_id, - 'hypervisor_hostname': 'foo', - 'service_name': 'foo', + 'hypervisor_hostname': 'hypvsr1', + 'service_name': 'compute1', 'vcpus': 4, 'cpu_info': 'foo', 'hypervisor_type': 'xen', @@ -218,7 +218,7 @@ class PhysicalHostPluginTestCase(tests.TestCase): self.get_extra_capabilities.return_value = {} host = self.fake_phys_plugin.create_computehost(self.fake_host) self.db_host_create.assert_called_once_with(self.fake_host) - self.prov_create.assert_called_once_with('foo') + self.prov_create.assert_called_once_with('hypvsr1') self.assertEqual(self.fake_host, host) def test_create_host_with_extra_capabilities(self): @@ -234,7 +234,7 @@ class PhysicalHostPluginTestCase(tests.TestCase): self.db_host_create.return_value = self.fake_host host = self.fake_phys_plugin.create_computehost(fake_request) self.db_host_create.assert_called_once_with(self.fake_host) - self.prov_create.assert_called_once_with('foo') + self.prov_create.assert_called_once_with('hypvsr1') self.db_host_extra_capability_create.assert_called_once_with(fake_capa) self.assertEqual(fake_host, host) @@ -273,8 +273,8 @@ class PhysicalHostPluginTestCase(tests.TestCase): self.assertRaises(db_exceptions.BlazarDBException, self.fake_phys_plugin.create_computehost, self.fake_host) - self.prov_create.assert_called_once_with('foo') - self.prov_delete.assert_called_once_with('foo') + self.prov_create.assert_called_once_with('hypvsr1') + self.prov_delete.assert_called_once_with('hypvsr1') def test_create_host_having_issue_when_storing_extra_capability(self): def fake_db_host_extra_capability_create(*args, **kwargs): @@ -380,7 +380,7 @@ class PhysicalHostPluginTestCase(tests.TestCase): self.fake_phys_plugin.delete_computehost(self.fake_host_id) self.db_host_destroy.assert_called_once_with(self.fake_host_id) - self.prov_delete.assert_called_once_with('foo') + self.prov_delete.assert_called_once_with('hypvsr1') self.get_servers_per_host.assert_called_once_with( self.fake_host["hypervisor_hostname"]) @@ -2242,7 +2242,7 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): self.host_monitor_plugin.project_domain_name) def test_notification_callback_disabled_true(self): - failed_host = {'hypervisor_hostname': 'compute-1'} + failed_host = {'hypervisor_hostname': 'hypvsr1'} event_type = 'service.update' payload = { 'nova_object.namespace': 'nova', @@ -2309,7 +2309,7 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): self.assertEqual({}, result) def test_notification_callback_recover(self): - recovered_host = {'hypervisor_hostname': 'compute-1', 'id': 1} + recovered_host = {'hypervisor_hostname': 'hypvsr1', 'id': 1} event_type = 'service.update' payload = { 'nova_object.namespace': 'nova', @@ -2348,10 +2348,10 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): def test_poll_resource_failures_state_down(self): hosts = [ {'id': '1', - 'hypervisor_hostname': 'compute-1', + 'hypervisor_hostname': 'hypvsr1', 'reservable': True}, {'id': '2', - 'hypervisor_hostname': 'compute-2', + 'hypervisor_hostname': 'hypvsr2', 'reservable': True}, ] @@ -2370,10 +2370,10 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): def test_poll_resource_failures_status_disabled(self): hosts = [ {'id': '1', - 'hypervisor_hostname': 'compute-1', + 'hypervisor_hostname': 'hypvsr1', 'reservable': True}, {'id': '2', - 'hypervisor_hostname': 'compute-2', + 'hypervisor_hostname': 'hypvsr2', 'reservable': True}, ] @@ -2392,10 +2392,10 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): def test_poll_resource_failures_nothing(self): hosts = [ {'id': '1', - 'hypervisor_hostname': 'compute-1', + 'hypervisor_hostname': 'hypvsr1', 'reservable': True}, {'id': '2', - 'hypervisor_hostname': 'compute-2', + 'hypervisor_hostname': 'hypvsr2', 'reservable': True}, ] @@ -2414,10 +2414,10 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): def test_poll_resource_failures_recover(self): hosts = [ {'id': '1', - 'hypervisor_hostname': 'compute-1', + 'hypervisor_hostname': 'hypvsr1', 'reservable': False}, {'id': '2', - 'hypervisor_hostname': 'compute-2', + 'hypervisor_hostname': 'hypvsr2', 'reservable': False}, ] @@ -2436,7 +2436,7 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): def test_handle_failures(self): failed_hosts = [ {'id': '1', - 'hypervisor_hostname': 'compute-1'} + 'hypervisor_hostname': 'hypvsr1'} ] host_update = self.patch(db_api, 'host_update') heal = self.patch(self.host_monitor_plugin, 'heal') @@ -2449,7 +2449,7 @@ class PhysicalHostMonitorPluginTestCase(tests.TestCase): def test_heal(self): failed_hosts = [ {'id': '1', - 'hypervisor_hostname': 'compute-1'} + 'hypervisor_hostname': 'hypvsr1'} ] reservation_flags = { 'rsrv-1': {'missing_resources': True}