-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not remove an empty subvolumes list when cloning
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env rspec | ||
|
||
require_relative "test_helper" | ||
|
||
Yast.import "AutoinstPartition" | ||
|
||
describe "Yast::AutoinstPartition" do | ||
subject { Yast::AutoinstPartition } | ||
|
||
describe "#parsePartition" do | ||
let(:filesystem) { :btrfs } | ||
let(:partition) do | ||
{ | ||
"filesystem" => filesystem, | ||
"subvolumes" => [ | ||
{ "path" => ".snapshots/1" }, | ||
{ "path" => "var/lib/machines" } | ||
] | ||
} | ||
end | ||
|
||
it "filters out snapper snapshots" do | ||
parsed = subject.parsePartition(partition) | ||
|
||
expect(parsed["subvolumes"]).to eq( | ||
[{ "path" => "var/lib/machines" }] | ||
) | ||
end | ||
|
||
context "when there are no Btrfs subvolumes" do | ||
let(:partition) { { "subvolumes" => [] } } | ||
|
||
it "exports them as an empty array" do | ||
parsed = subject.parsePartition(partition) | ||
|
||
expect(parsed["subvolumes"]).to eq([]) | ||
end | ||
|
||
context "and filesystem is not Btrfs" do | ||
let(:filesystem) { :ext4 } | ||
|
||
it "does not export the subvolumes list" do | ||
parsed = subject.parsePartition(partition) | ||
|
||
expect(parsed["subvolumes"]).to eq([]) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters