Skip to content

Commit

Permalink
Merge 7b5d028 into 75d1501
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Mar 11, 2019
2 parents 75d1501 + 7b5d028 commit 4b4fe5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/lib/y2storage/autoinst_profile/partition_section.rb
Expand Up @@ -434,12 +434,12 @@ def fixed_size?(device)

# Determines whether given partition is primary or not
#
# Always false when the partition belongs to a GPT partition table.
# Always false when the partition table does not allow extended partitions
#
# @param partition [Y2Storgae::Partition] the partition to check
# @return [Boolean] true when is a primary partition; false otherwise
def primary_partition?(partition)
return false if partition.partition_table.type.is?(:gpt)
return false unless partition.partition_table.extended_possible?

partition.type.is?(:primary)
end
Expand Down
16 changes: 8 additions & 8 deletions test/y2storage/autoinst_profile/partition_section_test.rb
Expand Up @@ -70,14 +70,6 @@ def section_for(name)
end
end

context "when the partition belongs to a GPT partition table" do
let(:dev) { device("sdh") }

it "does not include the partition_type" do
expect(section_for("sdh1").partition_type).to be_nil
end
end

context "when the partition belongs to an MD RAID" do
let(:dev) { device("sdb1") }
let(:md) { instance_double(Y2Storage::Md, name: "/dev/md0") }
Expand All @@ -91,6 +83,14 @@ def section_for(name)
expect(section.raid_name).to eq(md.name)
end
end

context "when the partition table does not have support for extended partitions" do
let(:dev) { device("sdh") }

it "does not include the partition_type" do
expect(section_for("sdh1").partition_type).to be_nil
end
end
end

context "given a disk" do
Expand Down

0 comments on commit 4b4fe5d

Please sign in to comment.