diff --git a/lib/inspec/resources/zfs_pool.rb b/lib/inspec/resources/zfs_pool.rb index 1c974d44b..235192ccf 100644 --- a/lib/inspec/resources/zfs_pool.rb +++ b/lib/inspec/resources/zfs_pool.rb @@ -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 diff --git a/test/unit/resources/zfs_pool_test.rb b/test/unit/resources/zfs_pool_test.rb index 9aaa638e7..686251837 100644 --- a/test/unit/resources/zfs_pool_test.rb +++ b/test/unit/resources/zfs_pool_test.rb @@ -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