summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests
diff options
context:
space:
mode:
authorArne Wiebalck <Arne.Wiebalck@cern.ch>2020-05-05 16:45:51 +0200
committerArne Wiebalck <Arne.Wiebalck@cern.ch>2020-06-30 18:31:58 +0200
commitc5022790b3dca80c009e914aa07f3f879cd159b4 (patch)
treef0e31c2fd8a0d29e9c8994f8c6b848a08bbccfcd /ironic_python_agent/tests
parente00fe3b85dedb912a1d23fcb1e35f5481bd460d1 (diff)
downloadironic-python-agent-c5022790b3dca80c009e914aa07f3f879cd159b4.tar.gz
Mount all vfat partitions before calling grub2
In order to ensure grub2 finds all files it needs, mount all vfat partitions specified in the deployed image. Story: #2007618 Task: #39629 Change-Id: Ie5b6e0abc3f266409562f9ecb26538126b667056
Diffstat (limited to 'ironic_python_agent/tests')
-rw-r--r--ironic_python_agent/tests/unit/extensions/test_image.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_image.py b/ironic_python_agent/tests/unit/extensions/test_image.py
index 546d1819..937bb348 100644
--- a/ironic_python_agent/tests/unit/extensions/test_image.py
+++ b/ironic_python_agent/tests/unit/extensions/test_image.py
@@ -361,6 +361,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
self.fake_dir + '/run'),
mock.call('mount', '-t', 'sysfs', 'none',
self.fake_dir + '/sys'),
+ mock.call(('chroot %s /bin/sh -c "mount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call(('chroot %s /bin/sh -c '
'"grub-install %s"' %
(self.fake_dir, self.fake_dev)), shell=True,
@@ -372,6 +376,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
+ mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/dev',
attempts=3, delay_on_retry=True),
mock.call('umount', self.fake_dir + '/proc',
@@ -412,6 +420,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
self.fake_dir + '/run'),
mock.call('mount', '-t', 'sysfs', 'none',
self.fake_dir + '/sys'),
+ mock.call(('chroot %s /bin/sh -c "mount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call(('chroot %s /bin/sh -c '
'"grub-install %s"' %
(self.fake_dir, self.fake_prep_boot_part)),
@@ -424,6 +436,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
+ mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/dev',
attempts=3, delay_on_retry=True),
mock.call('umount', self.fake_dir + '/proc',
@@ -472,6 +488,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
self.fake_dir + '/run'),
mock.call('mount', '-t', 'sysfs', 'none',
self.fake_dir + '/sys'),
+ mock.call(('chroot %s /bin/sh -c "mount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('mount', self.fake_efi_system_part,
self.fake_dir + '/boot/efi'),
mock.call(('chroot %s /bin/sh -c "grub-install"' %
@@ -496,6 +516,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/boot/efi',
attempts=3, delay_on_retry=True),
+ mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/dev',
attempts=3, delay_on_retry=True),
mock.call('umount', self.fake_dir + '/proc',
@@ -549,6 +573,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
self.fake_dir + '/run'),
mock.call('mount', '-t', 'sysfs', 'none',
self.fake_dir + '/sys'),
+ mock.call(('chroot %s /bin/sh -c "mount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('mount', self.fake_efi_system_part,
self.fake_dir + '/boot/efi'),
mock.call(('chroot %s /bin/sh -c "grub-install"' %
@@ -582,6 +610,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
mock_get_part_uuid.side_effect = [self.fake_root_part,
self.fake_efi_system_part]
mock_is_md_device.side_effect = [False, False]
+ environ_mock.get.return_value = '/sbin'
mock_md_get_raid_devices.return_value = {}
def mount_raise_func(*args, **kwargs):
@@ -595,6 +624,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
efi_system_part_uuid=self.fake_efi_system_part_uuid)
expected = [mock.call('mount', '/dev/fake2', self.fake_dir),
+ mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/dev',
attempts=3, delay_on_retry=True),
mock.call('umount', self.fake_dir + '/proc',
@@ -848,6 +881,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
self.fake_dir + '/run'),
mock.call('mount', '-t', 'sysfs', 'none',
self.fake_dir + '/sys'),
+ mock.call(('chroot %s /bin/sh -c "mount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('mount', '/dev/sda1',
self.fake_dir + '/boot/efi'),
mock.call(('chroot %s /bin/sh -c "grub-install"' %
@@ -886,6 +923,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/boot/efi',
attempts=3, delay_on_retry=True),
+ mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/dev',
attempts=3, delay_on_retry=True),
mock.call('umount', self.fake_dir + '/proc',
@@ -952,6 +993,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
self.fake_dir + '/run'),
mock.call('mount', '-t', 'sysfs', 'none',
self.fake_dir + '/sys'),
+ mock.call(('chroot %s /bin/sh -c "mount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call(('chroot %s /bin/sh -c '
'"grub-install %s"' %
(self.fake_dir, '/dev/sda')), shell=True,
@@ -968,6 +1013,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
+ mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
+ (self.fake_dir)), shell=True,
+ env_variables={
+ 'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call('umount', self.fake_dir + '/dev',
attempts=3, delay_on_retry=True),
mock.call('umount', self.fake_dir + '/proc',