diff options
author | Ales Kozumplik <akozumpl@redhat.com> | 2011-08-12 14:05:51 +0200 |
---|---|---|
committer | Ales Kozumplik <akozumpl@redhat.com> | 2011-08-16 13:04:26 +0200 |
commit | 625aa598345e83658c203c14781102e63c7ef6fa (patch) | |
tree | 61579625fb3799dbed7f5d1b3e8568661aef0434 /tests | |
parent | 4ac57face300a9a965fc1aa1b04e275bd747188f (diff) | |
download | anaconda-625aa598345e83658c203c14781102e63c7ef6fa.tar.gz anaconda-625aa598345e83658c203c14781102e63c7ef6fa.tar.xz anaconda-625aa598345e83658c203c14781102e63c7ef6fa.zip |
Copy /etc/multipath/wwids to the sysimage.
/etc/multipath/wwids is a list of activated multipaths generated by the
multipath tools. If it is missing in the sysimage it will be missing in
the dracut initramfs and that, in rare cases, can cause race between mpath
and lvm during boot.
This is a merge froh rhel6-branch but includes a unit tests of the new
iutil.copy_to_sysimage().
Resolves: rhbz#701371
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mock/__init__.py | 1 | ||||
-rw-r--r-- | tests/mock/disk.py | 2 | ||||
-rw-r--r-- | tests/pyanaconda_test/iutil_test.py | 29 |
3 files changed, 31 insertions, 1 deletions
diff --git a/tests/mock/__init__.py b/tests/mock/__init__.py index 900bef386..3fd749a9a 100644 --- a/tests/mock/__init__.py +++ b/tests/mock/__init__.py @@ -91,3 +91,4 @@ class TestCase(unittest.TestCase): os.listdir = disk.os_listdir os.path.exists = disk.os_path_exists os.path.isdir = disk.os_path_isdir + os.access = disk.os_access
\ No newline at end of file diff --git a/tests/mock/disk.py b/tests/mock/disk.py index 3ee98aab2..926fe8fa6 100644 --- a/tests/mock/disk.py +++ b/tests/mock/disk.py @@ -125,4 +125,4 @@ class DiskIO(object): raise OSError("[Errno 2] No such file or directory: '%s'" % (path,)) def os_access(self, path, mode): - return self.path_exists(path) + return self.os_path_exists(path) diff --git a/tests/pyanaconda_test/iutil_test.py b/tests/pyanaconda_test/iutil_test.py new file mode 100644 index 000000000..ba1114ec1 --- /dev/null +++ b/tests/pyanaconda_test/iutil_test.py @@ -0,0 +1,29 @@ +import mock + +class IutilTest(mock.TestCase): + def setUp(self): + self.setupModules( + ['_isys', 'logging', 'pyanaconda.anaconda_log', 'block']) + + import pyanaconda + pyanaconda.anaconda_log = mock.Mock() + + def tearDown(self): + self.tearDownModules() + + def copy_to_sysimage_test(self): + from pyanaconda import iutil + fs = mock.DiskIO() + self.take_over_io(fs, iutil) + self.assertEqual(iutil.copy_to_sysimage("/etc/securetty", "/sysimage"), + False) + + fs["/etc/securetty"] = "tty1" + iutil.os.makedirs = mock.Mock() + iutil.shutil.copy = mock.Mock() + self.assertEqual(iutil.copy_to_sysimage("/etc/securetty", + "/sysimage/subdir"), + True) + iutil.os.makedirs.assert_called_with("/sysimage/subdir/etc") + iutil.shutil.copy.assert_called_with("/etc/securetty", + "/sysimage/subdir/etc/securetty") |