Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Nov 5, 2018
1 parent b7f250d commit c2d6f28
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/RootPart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1550,11 +1550,11 @@ def MountPartitions(root_device_current)
#
# /dev/disk/by-id/dm-name-cr_home / auto 0 0
#
# And the fstab device is searched by that name:
# and the fstab device is searched by that name:
#
# devicegraph.find_by_any_name("/dev/disk/by-id/dm-name-cr_home")
#
# the proper encryption device could be found if there is a encrypttion device where
# The proper encryption device could be found if there is a encrypttion device where
#
# encryption.crypttab_name #=> "cr_home"
crypttab_path = File.join(Installation.destdir, "/etc/crypttab")
Expand Down
54 changes: 54 additions & 0 deletions test/root_part_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,25 @@
end

describe "#MountFSTab" do
before do
stub_storage(scenario)
# Mock the system lookup executed as last resort when the devicegraph
# doesn't contain the searched information
allow(Y2Storage::BlkDevice).to receive(:find_by_any_name)
end

let(:scenario) { "two-disks-two-btrfs.xml" }

let(:fstab) do
[
{
"file"=>"/home", "mntops"=>"defaults", "vfstype"=>"ext4", "spec"=> device_spec
}
]
end

let(:device_spec) { nil }

it "mounts /dev, /proc and /sys" do
allow(subject).to receive(:AddMountedPartition)

Expand All @@ -247,6 +266,41 @@
fstab = []
subject.MountFSTab(fstab, "")
end

context "when the device spec has UUID= format" do
let(:device_spec) { "UUID=111-222-333" }

it "tries to mount by using UUID= spec" do
expect(subject).to receive(:FsckAndMount)
.with("/home", "UUID=111-222-333", anything, anything)

subject.MountFSTab(fstab, "")
end
end

context "when the device spec does not have UUID= format" do
context "and a device with such spec is not found" do
let(:device_spec) { "/dev/sdc1" }

it "tries to mount by using the given device spec" do
expect(subject).to receive(:FsckAndMount)
.with("/home", "/dev/sdc1", anything, anything)

subject.MountFSTab(fstab, "")
end
end

context "and a device with such spec is found" do
let(:device_spec) { "/dev/sda2" }

it "tries to mount by using its udev uuid name" do
expect(subject).to receive(:FsckAndMount)
.with("/home", "/dev/disk/by-uuid/d6e5c710-3067-48de-8363-433e54a9d0b5", anything, anything)

subject.MountFSTab(fstab, "")
end
end
end
end

describe "#inject_intsys_files" do
Expand Down

0 comments on commit c2d6f28

Please sign in to comment.