CFINSPEC-274: Add resource_id & unit test: zfs_pool

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
Sonu Saha 2022-06-02 16:46:45 +05:30
parent 84a68668dd
commit 60f80b9f97
2 changed files with 8 additions and 0 deletions

View file

@ -31,6 +31,10 @@ module Inspec::Resources
inspec.command("#{@zpool_cmd} get -Hp all #{@zfs_pool}").exit_status == 0
end
def resource_id
@zfs_pool
end
def to_s
"ZFS Pool #{@zfs_pool}"
end

View file

@ -12,6 +12,7 @@ describe Inspec::Resources::ZfsPool do
_(tank_resource.send(:guid)).must_equal("4711279777582057513")
_(tank_resource.send(:failmode)).must_equal("continue")
_(tank_resource.send(:'feature@lz4_compress')).must_equal("active")
_(tank_resource.resource_id).must_equal "tank"
end
end
end
@ -26,6 +27,7 @@ describe Inspec::Resources::ZfsPool do
_(tank_resource.send(:guid)).must_equal("4711279777582057513")
_(tank_resource.send(:failmode)).must_equal("continue")
_(tank_resource.send(:'feature@lz4_compress')).must_equal("active")
_(tank_resource.resource_id).must_equal "tank"
end
end
end
@ -37,6 +39,7 @@ describe Inspec::Resources::ZfsPool do
it "parses the ZFS pool data properly" do
if _(tank_resource)
_(tank_resource.resource_exception_message).must_equal("zfs is not installed")
_(tank_resource.resource_id).must_equal "tank"
end
end
end
@ -45,5 +48,6 @@ describe Inspec::Resources::ZfsPool do
it "parses the ZFS pool data properly" do
resource = MockLoader.new(:macos10_16).load_resource("zfs_pool", "tank")
_(resource.resource_exception_message).must_equal "zfs is not installed"
_(resource.resource_id).must_equal "tank"
end
end