Esempio n. 1
0
 def test_check_image_size_without_memory_mb(self, show_mock):
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties.pop('memory_mb', None)
         agent.check_image_size(task, 'fake-image')
         self.assertFalse(show_mock.called)
Esempio n. 2
0
 def test_check_image_size_without_memory_mb(self, size_mock):
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties.pop('memory_mb', None)
         agent.check_image_size(task, 'fake-image')
         self.assertFalse(size_mock.called)
Esempio n. 3
0
 def test_check_image_size(self, size_mock):
     size_mock.return_value = 10 * 1024 * 1024
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties['memory_mb'] = 10
         agent.check_image_size(task, 'fake-image')
         size_mock.assert_called_once_with(self.context, 'fake-image')
Esempio n. 4
0
 def test_check_image_size(self, size_mock):
     size_mock.return_value = 10 * 1024 * 1024
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties['memory_mb'] = 10
         agent.check_image_size(task, 'fake-image')
         size_mock.assert_called_once_with(self.context, 'fake-image')
Esempio n. 5
0
 def test_check_image_size_raw_stream_enabled(self, show_mock):
     CONF.set_override('stream_raw_images', True, 'agent')
     # Image is bigger than memory but it's raw and will be streamed
     # so the test should pass
     show_mock.return_value = {
         'size': 15 * 1024 * 1024,
         'disk_format': 'raw',
     }
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties['memory_mb'] = 10
         agent.check_image_size(task, 'fake-image')
         show_mock.assert_called_once_with(self.context, 'fake-image')
Esempio n. 6
0
 def test_check_image_size_raw_stream_enabled(self, show_mock):
     CONF.set_override('stream_raw_images', True, 'agent')
     # Image is bigger than memory but it's raw and will be streamed
     # so the test should pass
     show_mock.return_value = {
         'size': 15 * 1024 * 1024,
         'disk_format': 'raw',
     }
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties['memory_mb'] = 10
         agent.check_image_size(task, 'fake-image')
         show_mock.assert_called_once_with(self.context, 'fake-image')