Ensure that oslo_utils.fileutils is mocked

During unit test execution, container spawn will attempt to ensure
that the instances directory exists using fileutils.ensure_tree.

This breaks when the tests are run on a read-only filesystem.

Generally mock fileutils in the driver module to ensure that this
does not happen.

Change-Id: If2c6010136bd8c7b2ccd59418084a55445aa4e08
This commit is contained in:
James Page 2016-07-20 11:56:41 +01:00
parent c9b2950723
commit a95592f3a1
1 changed files with 4 additions and 0 deletions

View File

@ -144,6 +144,10 @@ class LXDDriverTest(test.NoDBTestCase):
network_info = [mock.Mock()]
block_device_info = mock.Mock()
# NOTE: mock out fileutils to ensure that unit tests don't try
# to manipulate the filesystem (breaks in package builds).
driver.fileutils = mock.Mock()
lxd_driver = driver.LXDDriver(None)
lxd_driver.init_host(None)
# XXX: rockstar (6 Jul 2016) - There are a number of XXX comments