mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
CFINSPEC-96: Add unit test for zfs resource
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
3449285273
commit
038d284f32
1 changed files with 33 additions and 0 deletions
33
test/unit/resources/zfs_test.rb
Normal file
33
test/unit/resources/zfs_test.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
require "inspec/globals"
|
||||
require "#{Inspec.src_root}/test/helper"
|
||||
require_relative "../../../lib/inspec/resources/zfs"
|
||||
|
||||
describe Inspec::Resources::MyCustomResource do
|
||||
# freebsd
|
||||
it "checks zfs pool properties on freebsd" do
|
||||
resource = MockLoader.new("freebsd10".to_sym).load_resource("zfs", "tank")
|
||||
_(resource.exists?).must_equal true
|
||||
_(resource.has_property?({ "health" => "ONLINE", "failmode" => "continue", "feature@sha512" => "enabled" })).must_equal true
|
||||
end
|
||||
|
||||
# ubuntu
|
||||
it "checks zfs pool properties on ubuntu" do
|
||||
resource = MockLoader.new("ubuntu".to_sym).load_resource("zfs", "tank")
|
||||
_(resource.exists?).must_equal true
|
||||
_(resource.has_property?({ "guid" => "4711279777582057513", "feature@extensible_dataset" => "enabled", "feature@sha512" => "enabled" })).must_equal true
|
||||
end
|
||||
|
||||
# ubuntu
|
||||
it "checks zfs pool properties on ubuntu providing empty input" do
|
||||
resource = MockLoader.new("ubuntu".to_sym).load_resource("zfs", "tank")
|
||||
ex = _ { resource.has_property?({}) }.must_raise(Inspec::Exceptions::ResourceSkipped)
|
||||
_(ex.message).must_include "Provide a valid key-value pair of the zfs properties."
|
||||
end
|
||||
|
||||
# windows
|
||||
it "checks zfs poop properties on windows" do
|
||||
resource = MockLoader.new("windows".to_sym).load_resource("zfs", "tank")
|
||||
_(resource.resource_skipped?).must_equal true
|
||||
_(resource.resource_failed?).must_equal true
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue