Skip to content

Commit

Permalink
Test proposals on a system with no low/high distinction
Browse files Browse the repository at this point in the history
  • Loading branch information
ptesarik committed Feb 4, 2022
1 parent 39347f1 commit 06416f8
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions test/kdump_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,63 @@
end
end
end

context "on a system with no low/high distinction" do
let(:bootloader_kernel_params) { ["650M"] }
let(:bootloader_xen_kernel_params) { ["93M\\<4G"] }

before do
allow(Yast::Kdump.calibrator).to receive(:default_low).and_return 93
allow(Yast::Kdump.calibrator).to receive(:max_low).and_return 650
allow(Yast::Kdump.calibrator).to receive(:default_high).and_return 0
allow(Yast::Kdump.calibrator).to receive(:max_high).and_return 0
allow(Yast::Kdump.calibrator).to receive(:total_memory).and_return 2047
end

context "during autoinstallation" do
before do
allow(Yast::Mode).to receive(:autoinst).and_return true
Yast::Kdump.Import(profile)
end

let(:profile) { { "add_crash_kernel" => true } }

it "writes a proposed crashkernel in the bootloader and enables the service" do
expect(Yast::Bootloader)
.to receive(:modify_kernel_params)
.with(:common, :recovery, "crashkernel" => bootloader_kernel_params)
expect(Yast::Bootloader)
.to receive(:modify_kernel_params)
.with(:xen_host, "crashkernel" => bootloader_xen_kernel_params)
expect(Yast::Bootloader).to receive(:Write)
expect(Yast::Service).to receive(:Enable).with("kdump")

Yast::Kdump.WriteKdumpBootParameter
end
end

context "during autoupgrade" do
before do
allow(Yast::Mode).to receive(:autoupgrade).and_return true
Yast::Kdump.Import(profile)
end

let(:profile) { { "add_crash_kernel" => true } }

it "rewrites the bootloader crashkernel settings and enables the service" do
expect(Yast::Bootloader)
.to receive(:modify_kernel_params)
.with(:common, :recovery, "crashkernel" => bootloader_kernel_params)
expect(Yast::Bootloader)
.to receive(:modify_kernel_params)
.with(:xen_host, "crashkernel" => bootloader_xen_kernel_params)
expect(Yast::Bootloader).to receive(:Write)
expect(Yast::Service).to receive(:Enable).with("kdump")

Yast::Kdump.WriteKdumpBootParameter
end
end
end
end

describe ".Update" do
Expand Down

0 comments on commit 06416f8

Please sign in to comment.