inspec/test/unit/utils/bsd_mount_parser_test.rb
Joseph Benden 1fdecc6680 Add FreeBSD support for ZFS datasets and pools
The following new resources have been added; however, they
presently only support FreeBSD and similar.

* `zfs_dataset`: tests if a named ZFS dataset is present
  and/or has certain properties.
* `zfs_pool`: tests if a named ZFS pool is present and/or
  has certain properties.

Additionally, the `mount` resource has been reworked to
include support for FreeBSD; while the existing class
was renamed to LinuxMountParser.

Unit-tests were added for all of the above.

Signed-off-by: Joseph Benden <joe@benden.us>
2017-02-22 10:29:49 -07:00

27 lines
687 B
Ruby

# encoding: utf-8
# author: Joseph Benden
require 'helper'
describe BsdMountParser do
let (:parser) { Class.new() { include BsdMountParser }.new }
describe '#parse_mount_options' do
it 'parses nil content' do
parser.parse_mount_options(nil).must_equal({})
end
it 'parses an empty mount line' do
parser.parse_mount_options('').must_equal({})
end
it 'parses a valid mount line' do
info = {
:device => 'tank/tmp',
:type => 'zfs',
:options => ['local', 'noexec', 'nosuid', 'nfsv4acls'],
}
parser.parse_mount_options('tank/tmp on /tmp (zfs, local, noexec, nosuid, nfsv4acls)').must_equal(info)
end
end
end