diff --git a/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py b/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py index 91a51cc4a3..b8c363015f 100644 --- a/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py +++ b/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py @@ -84,7 +84,9 @@ def get_boot_file_paths_mocked(): assert addupgradebootentry.run.args[1] == run_args.args_add assert api.produce.model_instances == [ LateTargetKernelCmdlineArgTasks(to_remove=[KernelCmdlineArg(key='debug'), - KernelCmdlineArg(key='enforcing', value='0')]) + KernelCmdlineArg(key='enforcing', value='0'), + KernelCmdlineArg(key='plymouth.enable', value='0'), + KernelCmdlineArg(key='rd.plymouth', value='0')]) ] if run_args.args_zipl: @@ -104,15 +106,16 @@ def get_boot_file_paths_mocked(): CurrentActorMocked(envars={'LEAPP_DEBUG': str(int(is_leapp_invoked_with_debug))})) addupgradebootentry.add_boot_entry() + assert len(api.produce.model_instances) == 1 + produced_msg = api.produce.model_instances[0] + assert isinstance(produced_msg, LateTargetKernelCmdlineArgTasks) + + debug_kernel_cmline_arg = KernelCmdlineArg(key='debug') if is_leapp_invoked_with_debug: - expected_args_to_remove = [KernelCmdlineArg(key='debug'), KernelCmdlineArg(key='enforcing', value='0')] + assert debug_kernel_cmline_arg in produced_msg.to_remove else: - expected_args_to_remove = [KernelCmdlineArg(key='enforcing', value='0')] - - expected_produced_messages = [LateTargetKernelCmdlineArgTasks(to_remove=expected_args_to_remove)] - - assert api.produce.model_instances == expected_produced_messages + assert debug_kernel_cmline_arg not in produced_msg.to_remove def test_add_boot_entry_configs(monkeypatch): @@ -133,7 +136,9 @@ def get_boot_file_paths_mocked(): assert addupgradebootentry.run.args[3] == run_args_add + ['-c', CONFIGS[1]] assert api.produce.model_instances == [ LateTargetKernelCmdlineArgTasks(to_remove=[KernelCmdlineArg(key='debug'), - KernelCmdlineArg(key='enforcing', value='0')]) + KernelCmdlineArg(key='enforcing', value='0'), + KernelCmdlineArg(key='plymouth.enable', value='0'), + KernelCmdlineArg(key='rd.plymouth', value='0')]) ] @@ -183,7 +188,7 @@ def test_fix_grub_config_error(monkeypatch, error_type, test_file_name): (False, False), ) ) -def test_collect_boot_args(monkeypatch, is_debug_enabled, network_enablement_type): +def test_collect_upgrade_kernel_args(monkeypatch, is_debug_enabled, network_enablement_type): env_vars = {'LEAPP_DEBUG': str(int(is_debug_enabled))} if network_enablement_type: env_vars['LEAPP_DEVEL_INITRAM_NETWORK'] = network_enablement_type @@ -192,7 +197,8 @@ def test_collect_boot_args(monkeypatch, is_debug_enabled, network_enablement_typ monkeypatch.setattr(addupgradebootentry, 'construct_cmdline_args_for_livemode', lambda *args: {'livemodearg': 'value'}) - args = addupgradebootentry.collect_boot_args(livemode_enabled=True) + arg_set = addupgradebootentry.collect_upgrade_kernel_args(livemode_enabled=True) + args = dict(arg_set) assert args['enforcing'] == '0' assert args['rd.plymouth'] == '0' @@ -320,16 +326,3 @@ def readlink_mock(path): uuid = addupgradebootentry._get_device_uuid(path) assert uuid == 'MY_UUID1' - - -@pytest.mark.parametrize( - ('args', 'expected_result'), - ( - ([('argA', 'val'), ('argB', 'valB'), ('argC', None), ], 'argA=val argB=valB argC'), - ([('argA', ('val1', 'val2'))], 'argA=val1 argA=val2') - ) -) -def test_format_grubby_args_from_args_dict(args, expected_result): - actual_result = addupgradebootentry.format_grubby_args_from_args_dict(dict(args)) - - assert actual_result == expected_result