Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ test: setup
# python static code checks
poetry run mypy kiwi
# unit tests
poetry run bash -c 'pushd test/unit && pytest -n 5 \
poetry run bash -c 'pushd test/unit && pytest -n 8 \
--doctest-modules --no-cov-on-fail --cov=kiwi \
--cov-report=term-missing --cov-fail-under=100 \
--cov-config .coveragerc'
Expand Down
2 changes: 1 addition & 1 deletion doc/source/commands/system_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SYNOPSIS
[--add-package=<name>...]
[--add-bootstrap-package=<name>...]
[--ca-cert=<cert-file>...]
[--ca-target-distribution=<suse|redhat|debian|archlinux>]
[--ca-target-distribution=<suse,redhat,debian,archlinux>]
[--delete-package=<name>...]
[--set-container-derived-from=<uri>]
[--set-container-tag=<name>]
Expand Down
2 changes: 1 addition & 1 deletion doc/source/commands/system_prepare.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SYNOPSIS
[--add-package=<name>...]
[--add-bootstrap-package=<name>...]
[--ca-cert=<cert-file>...]
[--ca-target-distribution=<suse|redhat|debian|archlinux>]
[--ca-target-distribution=<suse,redhat,debian,archlinux>]
[--delete-package=<name>...]
[--set-container-derived-from=<uri>]
[--set-container-tag=<name>]
Expand Down
2 changes: 1 addition & 1 deletion kiwi/tasks/system_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[--add-package=<name>...]
[--add-bootstrap-package=<name>...]
[--ca-cert=<cert-file>...]
[--ca-target-distribution=<suse|redhat|debian|archlinux>]
[--ca-target-distribution=<suse,redhat,debian,archlinux>]
[--delete-package=<name>...]
[--set-container-derived-from=<uri>]
[--set-container-tag=<name>]
Expand Down
2 changes: 1 addition & 1 deletion kiwi/tasks/system_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[--add-package=<name>...]
[--add-bootstrap-package=<name>...]
[--ca-cert=<cert-file>...]
[--ca-target-distribution=<suse|redhat|debian|archlinux>]
[--ca-target-distribution=<suse,redhat,debian,archlinux>]
[--delete-package=<name>...]
[--set-container-derived-from=<uri>]
[--set-container-tag=<name>]
Expand Down
5 changes: 5 additions & 0 deletions test/unit/bootloader/config/grub2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ def test_setup_default_grub_s390_secure_execution(
grub_default.write = Mock()
mock_sysconfig.return_value = grub_default
mock_exists.return_value = True
self.bootloader.bls = True
self.bootloader.terminal_input = 'serial'
self.bootloader.terminal_output = 'gfxterm'
self.bootloader.theme = 'openSUSE'
Expand Down Expand Up @@ -754,6 +755,7 @@ def test_setup_default_grub(
grub_default.write = Mock()
mock_sysconfig.return_value = grub_default
mock_exists.return_value = True
self.bootloader.bls = True
self.bootloader.terminal_input = 'serial'
self.bootloader.terminal_output = 'gfxterm'
self.bootloader.theme = 'openSUSE'
Expand Down Expand Up @@ -794,6 +796,7 @@ def test_setup_default_grub_empty_kernelcmdline(
grub_default = MagicMock()
mock_sysconfig.return_value = grub_default
mock_exists.return_value = True
self.bootloader.bls = True
self.bootloader.terminal_input = 'serial'
self.bootloader.terminal_output = 'serial'
self.bootloader.theme = 'openSUSE'
Expand Down Expand Up @@ -840,6 +843,7 @@ def test_setup_default_grub_use_of_by_partuuid(
grub_default = MagicMock()
mock_sysconfig.return_value = grub_default
mock_exists.return_value = True
self.bootloader.bls = True
self.bootloader.terminal_input = 'serial'
self.bootloader.terminal_output = 'serial'
self.bootloader.theme = 'openSUSE'
Expand Down Expand Up @@ -889,6 +893,7 @@ def test_setup_default_grub_use_of_by_label(
self.bootloader.displayname = 'Bob'
self.bootloader.cmdline = 'abcd root=LABEL=foo console=tty0'
self.bootloader.persistency_type = 'by-label'
self.bootloader.bls = True

self.bootloader._setup_default_grub()

Expand Down
2 changes: 2 additions & 0 deletions test/unit/bootloader/config/zipl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ def test_get_template_parameters(
self.bootloader.timeout = 0
self.bootloader.disk_type = 'CDL'
self.bootloader.disk_blocksize = 4096
self.bootloader.custom_args['secure_image_file'] = \
'bootpath/kernel-filename.cc'
assert self.bootloader._get_template_parameters() == {
'secure_image_file': 'bootpath/kernel-filename.cc',
'kernel_file': 'vmlinuz',
Expand Down
44 changes: 26 additions & 18 deletions test/unit/system/setup_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,25 +374,33 @@ def side_effect(arg):
self.setup_with_real_xml.import_description()

@patch('kiwi.command.Command.run')
def test_cleanup(self, mock_command):
@patch('os.path.isdir')
@patch('kiwi.system.setup.Path.wipe')
@patch('kiwi.system.setup.MountManager')
def test_cleanup(
self,
mock_MountManager,
mock_Path_wipe,
mock_os_path_isdir,
mock_Command_run
):
image_meta = Mock()
mock_MountManager.return_value = image_meta
mock_os_path_isdir.return_value = True
self.setup.cleanup()
assert mock_command.call_args_list == [
call(
[
'chroot', 'root_dir', 'rm', '-f',
'.kconfig',
'.profile',
'config.bootoptions'
]
),
call(
command=['mountpoint', '-q', 'root_dir/image'],
raise_on_error=False
),
call(
['rm', '-r', '-f', 'root_dir/image']
)
]
mock_Command_run.assert_called_once_with(
[
'chroot', 'root_dir', 'rm', '-f',
'.kconfig',
'.profile',
'config.bootoptions'
]
)
mock_MountManager.assert_called_once_with(
device='none', mountpoint='root_dir/image'
)
image_meta.umount.assert_called_once_with()
mock_Path_wipe.assert_called_once_with('root_dir/image')

@patch('kiwi.system.setup.ArchiveTar')
@patch('kiwi.system.setup.glob.iglob')
Expand Down
2 changes: 2 additions & 0 deletions test/unit/tasks/system_build_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from ..test_helper import argv_kiwi_tests

from kiwi.defaults import Defaults
from kiwi.tasks.system_build import SystemBuildTask


Expand All @@ -22,6 +23,7 @@ def inject_fixtures(self, caplog):
self._caplog = caplog

def setup(self):
Defaults.set_platform_name('x86_64')
sys.argv = [
sys.argv[0], '--profile', 'vmxFlavour', 'system', 'build',
'--description', '../data/description',
Expand Down
2 changes: 2 additions & 0 deletions test/unit/tasks/system_prepare_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from ..test_helper import argv_kiwi_tests

from kiwi.defaults import Defaults
from kiwi.tasks.system_prepare import SystemPrepareTask


Expand All @@ -22,6 +23,7 @@ def inject_fixtures(self, caplog):
self._caplog = caplog

def setup(self):
Defaults.set_platform_name('x86_64')
sys.argv = [
sys.argv[0], '--profile', 'vmxFlavour', 'system', 'prepare',
'--description', '../data/description',
Expand Down
8 changes: 6 additions & 2 deletions test/unit/xml_state_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,8 +1244,12 @@ def test_get_build_type_bootloader_bls(self, mock_bootloader):
assert self.state.get_build_type_bootloader_bls() is False
self.bootloader.get_bls.return_value = True
assert self.state.get_build_type_bootloader_bls() is True
self.bootloader.get_bls.return_value = None
assert self.state.get_build_type_bootloader_bls() is True
# The behavior for this is different on some distributions
# because of the different default state. See
# kiwi-revert-bls-default-for-suse.patch
# As long as we cary this patch the following test is disabled
# self.bootloader.get_bls.return_value = None
# assert self.state.get_build_type_bootloader_bls() is True

@patch('kiwi.xml_parse.type_.get_bootloader')
def test_get_build_type_bootloader_console(self, mock_bootloader):
Expand Down
Loading