Sha256: 1c71a31463103153ba94930a4b15865b50a39a59d5ad737382342f0af5e7af5d

Contents?: true

Size: 1.61 KB

Versions: 36

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

zfs = Puppet::Type.type(:zfs)

describe zfs do
  properties = [:ensure, :mountpoint, :compression, :copies, :quota, :reservation, :sharenfs, :snapdir]

  properties.each do |property|
    it "should have a #{property} property" do
      expect(zfs.attrclass(property).ancestors).to be_include(Puppet::Property)
    end
  end

  parameters = [:name]

  parameters.each do |parameter|
    it "should have a #{parameter} parameter" do
      expect(zfs.attrclass(parameter).ancestors).to be_include(Puppet::Parameter)
    end
  end

  it "should autorequire the containing zfs and the zpool" do
    zfs_provider = double("zfs provider")
    allow(zfs_provider).to receive(:name).and_return(:zfs)
    allow(zfs).to receive(:defaultprovider).and_return(zfs_provider)

    zpool_provider = double("zpool provider")
    allow(zpool_provider).to receive(:name).and_return(:zpool)
    allow(Puppet::Type.type(:zpool)).to receive(:defaultprovider).and_return(zpool_provider)

    foo_pool = Puppet::Type.type(:zpool).new(:name => "foo")

    foo_bar_zfs = Puppet::Type.type(:zfs).new(:name => "foo/bar")
    foo_bar_baz_zfs = Puppet::Type.type(:zfs).new(:name => "foo/bar/baz")
    foo_bar_baz_buz_zfs = Puppet::Type.type(:zfs).new(:name => "foo/bar/baz/buz")

    Puppet::Resource::Catalog.new :testing do |conf|
      [foo_pool, foo_bar_zfs, foo_bar_baz_zfs, foo_bar_baz_buz_zfs].each { |resource| conf.add_resource resource }
    end

    req = foo_bar_baz_buz_zfs.autorequire.collect { |edge| edge.source.ref }

    [foo_pool.ref, foo_bar_zfs.ref, foo_bar_baz_zfs.ref].each { |ref| expect(req.include?(ref)).to eq(true) }
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
puppet-5.5.22 spec/unit/type/zfs_spec.rb
puppet-5.5.22-x86-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.22-x64-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.22-universal-darwin spec/unit/type/zfs_spec.rb
puppet-5.5.21 spec/unit/type/zfs_spec.rb
puppet-5.5.21-x86-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.21-x64-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.21-universal-darwin spec/unit/type/zfs_spec.rb
puppet-5.5.20 spec/unit/type/zfs_spec.rb
puppet-5.5.20-x86-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.20-x64-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.20-universal-darwin spec/unit/type/zfs_spec.rb
puppet-5.5.19 spec/unit/type/zfs_spec.rb
puppet-5.5.19-x86-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.19-x64-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.19-universal-darwin spec/unit/type/zfs_spec.rb
puppet-5.5.18 spec/unit/type/zfs_spec.rb
puppet-5.5.18-x86-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.18-x64-mingw32 spec/unit/type/zfs_spec.rb
puppet-5.5.18-universal-darwin spec/unit/type/zfs_spec.rb