diff --git a/package/yast2-storage-ng.changes b/package/yast2-storage-ng.changes index aec8d4b5f..5740376bc 100644 --- a/package/yast2-storage-ng.changes +++ b/package/yast2-storage-ng.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Jul 28 10:59:39 UTC 2025 - Stefan Schubert + +- Do not generate grub2 error messages and proposals if a BLS + bootlaoder (systemd-boot/grub2-bls) bootloader is the preferred + bootloader. +- Do not generate subvolumes like @/boot/grub2/x86_64-efi and + @/boot/grub2/i386-pc if a BLS bootloader is suggested. +- Do not generate /boot if a BLS bootloader is suggested. +- (bsc#1244755) +- 5.0.35 + ------------------------------------------------------------------- Thu Jul 24 10:59:19 UTC 2025 - Ancor Gonzalez Sosa diff --git a/package/yast2-storage-ng.spec b/package/yast2-storage-ng.spec index 4943c2d6b..dcf77e217 100644 --- a/package/yast2-storage-ng.spec +++ b/package/yast2-storage-ng.spec @@ -16,7 +16,7 @@ # Name: yast2-storage-ng -Version: 5.0.34 +Version: 5.0.35 Release: 0 Summary: YaST2 - Storage Configuration License: GPL-2.0-only OR GPL-3.0-only diff --git a/src/lib/y2storage/boot_requirements_checker.rb b/src/lib/y2storage/boot_requirements_checker.rb index afc99f9e2..3cb1581a3 100644 --- a/src/lib/y2storage/boot_requirements_checker.rb +++ b/src/lib/y2storage/boot_requirements_checker.rb @@ -19,6 +19,7 @@ require "yast" require "y2storage/boot_requirements_strategies" +require "y2storage/boot_requirements_strategies/bls" require "y2storage/storage_manager" require "y2storage/storage_env" @@ -140,12 +141,10 @@ def strategy_class # @return [BootRequirementsStrategies::Base] def arch_strategy_class if arch.efiboot? - if StorageEnv.instance.no_bls_bootloader || - (!arch.x86? && !Yast::Arch.aarch64) - BootRequirementsStrategies::UEFI - else - # BLS is for x86_64 and aarch64 only + if Y2Storage::BootRequirementsStrategies::Analyzer.bls_bootloader_proposed? BootRequirementsStrategies::BLS + else + BootRequirementsStrategies::UEFI end elsif arch.s390? BootRequirementsStrategies::ZIPL diff --git a/src/lib/y2storage/boot_requirements_strategies/analyzer.rb b/src/lib/y2storage/boot_requirements_strategies/analyzer.rb index 92114861a..9382a896e 100644 --- a/src/lib/y2storage/boot_requirements_strategies/analyzer.rb +++ b/src/lib/y2storage/boot_requirements_strategies/analyzer.rb @@ -22,6 +22,9 @@ require "y2storage/planned" require "y2storage/encryption_type" +Yast.import "ProductFeatures" +Yast.import "Arch" + module Y2Storage module BootRequirementsStrategies # Auxiliary class that takes information from several sources (current @@ -374,6 +377,15 @@ def encrypted_zipl? encrypted?(device_for_zipl) end + def self.bls_bootloader_proposed? + preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", + "preferred_bootloader") + Y2Storage::Arch.new.efiboot? && + (Yast::Arch.x86_64 || Yast::Arch.aarch64) && + !StorageEnv.instance.no_bls_bootloader && + ["systemd-boot", "grub2-bls"].include?(preferred_bootloader) + end + protected attr_reader :devicegraph diff --git a/src/lib/y2storage/boot_requirements_strategies/base.rb b/src/lib/y2storage/boot_requirements_strategies/base.rb index 95fb90b51..aa2e82865 100644 --- a/src/lib/y2storage/boot_requirements_strategies/base.rb +++ b/src/lib/y2storage/boot_requirements_strategies/base.rb @@ -23,6 +23,7 @@ require "y2storage/filesystems/type" require "y2storage/planned" require "y2storage/boot_requirements_strategies/analyzer" +require "y2storage/boot_requirements_strategies/bls" require "y2storage/exceptions" require "y2storage/volume_specification" require "y2storage/setup_error" @@ -84,7 +85,7 @@ def needed_partitions(target) def warnings res = [] - if !boot_readable_by_grub? + if grub_warning? && !boot_readable_by_grub? error_message = _( "The grub boot loader cannot access the file system mounted at /boot. " \ @@ -109,6 +110,13 @@ def warnings res end + # Checks if it makes sense to show grub warnings + # + # @return [Boolean] + def grub_warning? + true + end + # All fatal boot errors detected in the setup, for example, when a / partition # is missing # diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 8848fa78f..d5d1fe9a5 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -28,6 +28,20 @@ def initialize(*args) super end + # No extra /boot partition which is needed by grub2 only + def needed_partitions(target) + planned_partitions = [] + planned_partitions << efi_partition(target) if efi_missing? + planned_partitions + end + + # Checks if it makes sense to show grub warnings + # + # @return [Boolean] + def grub_warning? + false + end + protected # @return [VolumeSpecification] diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 14d698d27..79e5fb521 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -24,6 +24,7 @@ require "y2storage/boot_requirements_checker" require "y2storage/proposal_settings" require "y2storage/with_security_policies" +require "y2storage/storage_manager" # This 'import' is necessary to load the control file (/etc/YaST/control.xml) # when running in an installed system. During installation, this module @@ -78,7 +79,31 @@ def errors # # @return [Array] def warnings - boot_warnings + product_warnings + mount_warnings + security_policy_warnings + boot_warnings + product_warnings + mount_warnings + security_policy_warnings + encryption_warnings + end + + # All encryption warnings detected in the setup + # + # Argion2* needs at least 4GiB of memory. Otherwise cryptsetup could crash (bsc#1246876). + # + # @return [Array] + def encryption_warnings + return [] if DiskSize.new(StorageManager.instance.arch.ram_size) >= DiskSize.GiB(4) + + unless @encryption_warnings + @encryption_warnings = [] + @devicegraph.encryptions + .select(&:supports_pbkdf?) + .each do |e| + next unless ["argon2id", "argon2i"].include?(e.pbkdf.value) + + @encryption_warnings << SetupError.new( + message: format(_("Using %s for %s but this needs 4 GiB RAM at least."), + e.pbkdf.name, e.blk_device.name) + ) + end + end + @encryption_warnings end # All boot errors detected in the setup diff --git a/src/lib/y2storage/setup_errors_presenter.rb b/src/lib/y2storage/setup_errors_presenter.rb index 1aeef96cf..49f05bfec 100644 --- a/src/lib/y2storage/setup_errors_presenter.rb +++ b/src/lib/y2storage/setup_errors_presenter.rb @@ -60,7 +60,8 @@ def warnings_html boot_warnings_html, product_warnings_html, mount_warnings_html, - security_policy_warnings_html + security_policy_warnings_html, + encryption_warnings_html ].compact return nil if warnings.empty? @@ -68,6 +69,16 @@ def warnings_html warnings.join(Yast::HTML.Newline) end + # HTML representation for encryption warnings + # + # @return [String, nil] nil if there is no encryption warning + def encryption_warnings_html + warnings = setup_checker.encryption_warnings + header = _("There could be problems while encrypting devices:\n") + + create_html(header, warnings) + end + # HTML representation for boot warnings # # @return [String, nil] nil if there is no boot warning diff --git a/src/lib/y2storage/subvol_specification.rb b/src/lib/y2storage/subvol_specification.rb index 39a83ecb2..b12176386 100644 --- a/src/lib/y2storage/subvol_specification.rb +++ b/src/lib/y2storage/subvol_specification.rb @@ -64,8 +64,8 @@ class SubvolSpecification "var/lib/pgsql" ] - # Subvolumes, from the lists above, that contain architecture modifiers - SUBVOL_ARCHS = { + # Grub2 subvolumes, from the lists above, that contain architecture modifiers + SUBVOL_GRUB2_ARCHS = { "boot/grub2/i386-pc" => ["i386", "x86_64"], "boot/grub2/x86_64-efi" => ["x86_64"], "boot/grub2/powerpc-ieee1275" => ["ppc", "!board_powernv"], @@ -244,7 +244,8 @@ def self.fallback_list subvols.concat( NO_COW_SUBVOL_PATHS.map { |path| SubvolSpecification.new(path, copy_on_write: false) } ) - subvols.each { |subvol| subvol.archs = SUBVOL_ARCHS[subvol.path] } + + subvols.each { |subvol| subvol.archs = SUBVOL_GRUB2_ARCHS[subvol.path] } subvols.sort! end diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index ae3ceca1c..6700ef5d2 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -21,6 +21,7 @@ require "y2storage/partitioning_features" require "y2storage/subvol_specification" require "y2storage/equal_by_instance_variables" +require "y2storage/boot_requirements_strategies/bls" Yast.import "Kernel" @@ -29,6 +30,7 @@ module Y2Storage class VolumeSpecification include PartitioningFeatures include EqualByInstanceVariables + include Yast::Logger # @return [PartitionId] when the volume needs to be a partition with a specific id attr_accessor :partition_id @@ -408,6 +410,24 @@ def load_features(volume_features) # the architecture does not support to resume from swap (i.e., for s390). def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? + + return unless Y2Storage::BootRequirementsStrategies::Analyzer.bls_bootloader_proposed? + + # Removing grub2/grub2-efi specific subvolumes because they are not needed. + # Currently, the subvolumes needed for booting are directly defined in the control.xml file (or + # provided by the fallback list). But such subvolumes depend on the selected boot strategy. + # In the future, each strategy could provide its own list of subvolumes (similar to what + # happens now with the required partitions for booting). With that, control files do not have + # to provide the subvolumes for booting and there is no need for removing subvolumes here. + @subvolumes.delete_if do |subvol| + if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) + log.info "Removing grub2/grub2-efi specific subvolumes #{subvol.path} " \ + "because a BLS bootloader is default." + true + else + false + end + end end def validated_fs_type(type) diff --git a/test/support/boot_requirements_uefi.rb b/test/support/boot_requirements_uefi.rb index 7c2278541..fe20b5205 100755 --- a/test/support/boot_requirements_uefi.rb +++ b/test/support/boot_requirements_uefi.rb @@ -134,10 +134,12 @@ end end -RSpec.shared_context "BLS bootloader not disabled" do - context "and BLS installation is not explicitly disabled" do +RSpec.shared_context "BLS bootloader proposed" do + context "and BLS bootloader is proposed and possible" do before do - allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( + :bls_bootloader_proposed? + ).and_return(true) end include_examples "EFI partition for BLS bootloaders" diff --git a/test/y2storage/boot_requirements_checker_aarch64_test.rb b/test/y2storage/boot_requirements_checker_aarch64_test.rb index d9238f949..c35162a35 100755 --- a/test/y2storage/boot_requirements_checker_aarch64_test.rb +++ b/test/y2storage/boot_requirements_checker_aarch64_test.rb @@ -52,10 +52,11 @@ let(:efi_part) { find_vol("/boot/efi", checker.needed_partitions(target)) } let(:desired_efi_part) { find_vol("/boot/efi", checker.needed_partitions(:desired)) } - include_examples "BLS bootloader not disabled" - context "and BLS installation is explicitly disabled" do + context "and BLS bootloader is explicitly disabled" do before do - allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(true) + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( + :bls_bootloader_proposed? + ).and_return(false) end include_examples "minimalistic EFI partition" diff --git a/test/y2storage/boot_requirements_checker_raspi_test.rb b/test/y2storage/boot_requirements_checker_raspi_test.rb index 2fcb77823..50b840343 100755 --- a/test/y2storage/boot_requirements_checker_raspi_test.rb +++ b/test/y2storage/boot_requirements_checker_raspi_test.rb @@ -25,6 +25,10 @@ describe Y2Storage::BootRequirementsChecker do describe "#needed_partitions in a Raspberry Pi" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + end + using Y2Storage::Refinements::SizeCasts include_context "boot requirements" diff --git a/test/y2storage/boot_requirements_checker_x86_test.rb b/test/y2storage/boot_requirements_checker_x86_test.rb index 499f0d895..c3dceb83a 100755 --- a/test/y2storage/boot_requirements_checker_x86_test.rb +++ b/test/y2storage/boot_requirements_checker_x86_test.rb @@ -297,7 +297,7 @@ let(:efi_partitions) { [] } include_examples "proposed EFI partition basics" - include_examples "BLS bootloader not disabled" + include_examples "BLS bootloader proposed" context "and BLS installation is explicitly disabled" do before do diff --git a/test/y2storage/boot_requirements_strategies/analyzer_test.rb b/test/y2storage/boot_requirements_strategies/analyzer_test.rb index 33be6fd5e..71ef17a00 100755 --- a/test/y2storage/boot_requirements_strategies/analyzer_test.rb +++ b/test/y2storage/boot_requirements_strategies/analyzer_test.rb @@ -909,4 +909,93 @@ def create_filesystem(device_name, mount_point) end end end + + describe ".bls_bootloader_proposed?" do + subject { Y2Storage::BootRequirementsStrategies::Analyzer } + + describe "checking suggested bootloader" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Yast::Arch).to receive(:x86_64).and_return(true) + allow(Yast::Arch).to receive(:aarch64).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + end + + context "when a none bls bootloader is suggested" do + before do + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("grub2-efi") + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when a bls bootloader is suggested" do + before do + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("systemd-boot") + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + + describe "checking architecture" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("grub2-bls") + end + + context "when architectue is not x86_64/aarch64" do + before do + allow(Yast::Arch).to receive(:x86_64).and_return(false) + allow(Yast::Arch).to receive(:aarch64).and_return(false) + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when architectue is x86_64" do + before do + allow(Yast::Arch).to receive(:x86_64).and_return(true) + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + + describe "checking EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Yast::Arch).to receive(:aarch64).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("systemd-boot") + end + + context "when not EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + end end diff --git a/test/y2storage/boot_requirements_strategies/bls_test.rb b/test/y2storage/boot_requirements_strategies/bls_test.rb new file mode 100644 index 000000000..b4c0fdfb1 --- /dev/null +++ b/test/y2storage/boot_requirements_strategies/bls_test.rb @@ -0,0 +1,43 @@ +# Copyright (c) [2025] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require_relative "../spec_helper" +require "y2storage" + +describe Y2Storage::BootRequirementsStrategies::BLS do + subject { described_class.new(fake_devicegraph, [], "/dev/sda1") } + + before do + fake_scenario("empty_disks") + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive(:new).and_return(analyzer) + allow(analyzer).to receive(:free_mountpoint?).and_return(false) + end + + let(:analyzer) do + Y2Storage::BootRequirementsStrategies::Analyzer.new(fake_devicegraph, [], "/dev/sda1") + end + + describe ".needed_partitions" do + let(:target) { :desired } + it "does not return own /boot partition" do + ret = subject.needed_partitions(target) + expect(ret.any? { |p| p.mount_point == "/boot" }).to eq(false) + end + end +end diff --git a/test/y2storage/proposal_swap_reuse_test.rb b/test/y2storage/proposal_swap_reuse_test.rb index ac830a0a7..57e9b7be5 100755 --- a/test/y2storage/proposal_swap_reuse_test.rb +++ b/test/y2storage/proposal_swap_reuse_test.rb @@ -28,6 +28,10 @@ describe "#propose in a system with pre-existing swap partitions" do subject(:proposal) { described_class.new(settings: settings) } + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + end + include_context "proposal" let(:architecture) { :x86 } let(:settings_format) { :ng } diff --git a/test/y2storage/setup_checker_test.rb b/test/y2storage/setup_checker_test.rb index 68e27d9a9..4b5d04c4e 100755 --- a/test/y2storage/setup_checker_test.rb +++ b/test/y2storage/setup_checker_test.rb @@ -28,6 +28,11 @@ before do fake_scenario(scenario) + + allow(Yast::SCR).to receive(:Read) + # Let's assume 8 GiB of RAM + allow(Yast::SCR).to receive(:Read).with(path(".proc.meminfo")) + .and_return("memtotal" => 8388608) end let(:scenario) { "empty_hard_disk_gpt_50GiB" } diff --git a/test/y2storage/setup_errors_presenter_test.rb b/test/y2storage/setup_errors_presenter_test.rb index fcbe7f5f1..2e3bf9491 100755 --- a/test/y2storage/setup_errors_presenter_test.rb +++ b/test/y2storage/setup_errors_presenter_test.rb @@ -33,6 +33,7 @@ allow(setup_checker).to receive(:boot_warnings).and_return(boot_errors) allow(setup_checker).to receive(:product_warnings).and_return(product_errors) allow(setup_checker).to receive(:mount_warnings).and_return(mount_errors) + allow(setup_checker).to receive(:encryption_warnings).and_return(encryption_errors) allow(setup_checker).to receive(:security_policy).and_return(policy) allow(setup_checker).to receive(:security_policy_failing_rules).and_return(policy_errors) allow(setup_checker).to receive(:errors).and_return(fatal_errors) @@ -49,6 +50,8 @@ let(:mount_errors) { [] } + let(:encryption_errors) { [] } + let(:policy) { double("Y2Security::SecurityPolicies::DisaStigPolicy", name: "STIG") } let(:policy_errors) { [] } @@ -61,6 +64,7 @@ let(:product_errors) { [] } let(:mount_errors) { [] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "returns an empty string" do expect(subject.to_html).to be_empty @@ -82,15 +86,19 @@ let(:product_error2) { instance_double(Y2Storage::SetupError, message: "product error 2") } let(:product_error3) { instance_double(Y2Storage::SetupError, message: "product error 3") } let(:mount_error1) { instance_double(Y2Storage::SetupError, message: "missing option 1") } + let(:encryption_error) do + instance_double(Y2Storage::SetupError, message: "encryption error") + end let(:policy_errors) { [] } let(:boot_errors) { [boot_error1, boot_error2] } let(:product_errors) { [product_error1, product_error2, product_error3] } let(:mount_errors) { [mount_error1] } + let(:encryption_errors) { [encryption_error] } it "contains a message for each error" do - expect(subject.to_html.scan(/
  • /).size).to eq(6) + expect(subject.to_html.scan(/
  • /).size).to eq(7) end context "and there are boot errors" do @@ -98,6 +106,7 @@ let(:product_errors) { [] } let(:mount_errors) { [] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "contains a general error message for boot errors" do expect(subject.to_html).to match(/not be able to boot/) @@ -114,6 +123,10 @@ it "does not contain a general error message for policy errors" do expect(subject.to_html).to_not match(/does not comply with the STIG policy/) end + + it "does not contain a general error message for encryption errors" do + expect(subject.to_html).to_not match(/problems while encrypting devices/) + end end context "and there are product errors" do @@ -121,6 +134,7 @@ let(:product_errors) { [product_error1] } let(:mount_errors) { [] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "contains a general error message for product errors" do expect(subject.to_html).to match(/could not work/) @@ -137,6 +151,10 @@ it "does not contain a general error message for policy errors" do expect(subject.to_html).to_not match(/does not comply with the STIG policy/) end + + it "does not contain a general error message for encryption errors" do + expect(subject.to_html).to_not match(/problems while encrypting devices/) + end end context "and there are mount errors" do @@ -144,6 +162,7 @@ let(:product_errors) { [] } let(:mount_errors) { [mount_error1] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "contains a general error message for mount errors" do expect(subject.to_html).to match(/mount point during boot/) @@ -166,6 +185,7 @@ let(:boot_errors) { [] } let(:product_errors) { [] } let(:mount_errors) { [] } + let(:encryption_errors) { [] } let(:policy_errors) { [double("Y2Security::SecurityPolicies::Rule")] } it "contains a general error message for the policy" do @@ -183,12 +203,45 @@ it "does not contain a general error message for mount errors" do expect(subject.to_html).to_not match(/mount point during boot/) end + + it "does not contain a general error message for encryption errors" do + expect(subject.to_html).to_not match(/problems while encrypting devices/) + end end - context "and there are boot, product, mount errors and policies errors" do + context "and there are encryption errors" do + let(:boot_errors) { [] } + let(:product_errors) { [] } + let(:mount_errors) { [] } + let(:encryption_errors) { [encryption_error] } + let(:policy_errors) { [] } + + it "contains a general error message for encryption" do + expect(subject.to_html).to match(/problems while encrypting devices/) + end + + it "does not contain a general error message for the policy" do + expect(subject.to_html).to_not match(/does not comply with the STIG policy/) + end + + it "does not contain a general error message for boot errors" do + expect(subject.to_html).to_not match(/not be able to boot/) + end + + it "does not contain a general error message for product errors" do + expect(subject.to_html).to_not match(/could not work/) + end + + it "does not contain a general error message for mount errors" do + expect(subject.to_html).to_not match(/mount point during boot/) + end + end + + context "and there are boot, product, mount errors, encryption errors and policies errors" do let(:boot_errors) { [boot_error1] } let(:product_errors) { [product_error1] } let(:mount_errors) { [mount_error1] } + let(:encryption_errors) { [encryption_error] } let(:policy_errors) { [instance_double(Y2Storage::SetupError, message: "policy error")] } it "contains a general error message for boot errors" do @@ -206,6 +259,10 @@ it "contains a general error message for the policy" do expect(subject.to_html).to match(/does not comply with the STIG policy/) end + + it "contains a general error message for encryption" do + expect(subject.to_html).to match(/problems while encrypting devices/) + end end end end diff --git a/test/y2storage/volume_specification_test.rb b/test/y2storage/volume_specification_test.rb index 22ee4185f..ade236318 100755 --- a/test/y2storage/volume_specification_test.rb +++ b/test/y2storage/volume_specification_test.rb @@ -411,6 +411,32 @@ expect(subject.subvolumes).to_not be_empty expect(subject.subvolumes).to all(be_a(Y2Storage::SubvolSpecification)) end + context "and a BLS bootloader is not default" do + before do + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( + :bls_bootloader_proposed? + ).and_return(false) + end + + it "subvolumes contains grub2 specific entries" do + ret = subject.subvolumes.any? { |s| s.path.include?("boot/grub2") } + expect(ret).to eq(true) + end + end + + context "and a BLS bootloader is default" do + before do + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( + :bls_bootloader_proposed? + ).and_return(true) + end + + it "does not contain grub2 specific subvolumes" do + ret = subject.subvolumes.any? { |s| s.path.include?("boot/grub2") } + expect(ret).to eq(false) + end + end + end end