summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorKaren Bruner <kmbruner@gmail.com>2016-04-21 10:22:10 -0700
committerKaren Bruner <kmbruner@gmail.com>2016-04-21 10:22:10 -0700
commit7a8fbdc0cf0b54acfec85090462b9a43812c2871 (patch)
treedcfc6543740913234cb78a4ad5cbe1f8fe1a9ba7 /spec/unit
parentb37b683c624ce598643669167dfcbb56086c14ed (diff)
downloadchef-7a8fbdc0cf0b54acfec85090462b9a43812c2871.tar.gz
add support for --layout option to mdadm resource provider
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/provider/mdadm_spec.rb9
-rw-r--r--spec/unit/resource/mdadm_spec.rb5
2 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/provider/mdadm_spec.rb b/spec/unit/provider/mdadm_spec.rb
index 421dd0c2dd..8ef884e131 100644
--- a/spec/unit/provider/mdadm_spec.rb
+++ b/spec/unit/provider/mdadm_spec.rb
@@ -76,6 +76,15 @@ describe Chef::Provider::Mdadm do
expect(@new_resource).to be_updated_by_last_action
end
+ it "should specify a layout only if set" do
+ @current_resource.exists(false)
+ @new_resource.layout("rs")
+ expected_command = "yes | mdadm --create /dev/md1 --level 5 --chunk=16 --metadata=0.90 --layout=rs --raid-devices 3 /dev/sdz1 /dev/sdz2 /dev/sdz3"
+ expect(@provider).to receive(:shell_out!).with(expected_command)
+ @provider.run_action(:create)
+ expect(@new_resource).to be_updated_by_last_action
+ end
+
it "should not specify a chunksize if raid level 1" do
@current_resource.exists(false)
@new_resource.level 1
diff --git a/spec/unit/resource/mdadm_spec.rb b/spec/unit/resource/mdadm_spec.rb
index 8eceed733e..6b75c4f972 100644
--- a/spec/unit/resource/mdadm_spec.rb
+++ b/spec/unit/resource/mdadm_spec.rb
@@ -69,6 +69,11 @@ describe Chef::Resource::Mdadm do
expect(@resource.metadata).to eql("internal")
end
+ it "should allow you to set the layout attribute" do
+ @resource.layout "f2"
+ expect(@resource.layout).to eql("f2")
+ end
+
it "should allow you to set the devices attribute" do
@resource.devices ["/dev/sda", "/dev/sdb"]
expect(@resource.devices).to eql(["/dev/sda", "/dev/sdb"])