2013-10-23 16:44:06 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'concat::setup', :type => :class do
|
|
|
|
|
2013-10-24 17:48:37 +02:00
|
|
|
shared_examples 'setup' do |concatdir|
|
2013-10-23 21:18:09 +02:00
|
|
|
concatdir = '/foo' if concatdir.nil?
|
|
|
|
|
2014-10-09 00:06:15 +02:00
|
|
|
let(:facts) do
|
|
|
|
{
|
|
|
|
:concat_basedir => concatdir,
|
|
|
|
:caller_module_name => 'Test',
|
|
|
|
:osfamily => 'Debian',
|
|
|
|
:id => 'root',
|
2014-11-15 00:53:36 +01:00
|
|
|
:is_pe => false,
|
2014-10-09 00:06:15 +02:00
|
|
|
}
|
|
|
|
end
|
2013-10-23 16:44:06 +02:00
|
|
|
|
|
|
|
it do
|
|
|
|
should contain_file("#{concatdir}/bin/concatfragments.sh").with({
|
|
|
|
:mode => '0755',
|
|
|
|
:source => 'puppet:///modules/concat/concatfragments.sh',
|
2013-10-24 00:42:44 +02:00
|
|
|
:backup => false,
|
2013-10-23 16:44:06 +02:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
[concatdir, "#{concatdir}/bin"].each do |file|
|
|
|
|
it do
|
|
|
|
should contain_file(file).with({
|
|
|
|
:ensure => 'directory',
|
2013-10-24 17:48:37 +02:00
|
|
|
:mode => '0755',
|
2013-10-24 00:42:44 +02:00
|
|
|
:backup => false,
|
2013-10-23 16:44:06 +02:00
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'facts' do
|
|
|
|
context 'concat_basedir =>' do
|
|
|
|
context '/foo' do
|
2013-10-24 17:48:37 +02:00
|
|
|
it_behaves_like 'setup', '/foo'
|
2013-10-23 16:44:06 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end # facts
|
2013-11-03 19:26:09 +01:00
|
|
|
|
|
|
|
context 'deprecated as a public class' do
|
|
|
|
it 'should create a warning' do
|
2015-01-10 01:44:58 +01:00
|
|
|
skip('rspec-puppet support for testing warning()')
|
2013-11-03 19:26:09 +01:00
|
|
|
end
|
|
|
|
end
|
2014-05-28 18:31:02 +02:00
|
|
|
|
|
|
|
context "on osfamily Solaris" do
|
|
|
|
concatdir = '/foo'
|
|
|
|
let(:facts) do
|
|
|
|
{
|
2014-10-09 00:06:15 +02:00
|
|
|
:concat_basedir => concatdir,
|
|
|
|
:caller_module_name => 'Test',
|
|
|
|
:osfamily => 'Solaris',
|
|
|
|
:id => 'root',
|
2014-11-15 00:53:36 +01:00
|
|
|
:is_pe => false,
|
2014-05-28 18:31:02 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it do
|
|
|
|
should contain_file("#{concatdir}/bin/concatfragments.rb").with({
|
|
|
|
:ensure => 'file',
|
|
|
|
:owner => 'root',
|
|
|
|
:mode => '0755',
|
|
|
|
:source => 'puppet:///modules/concat/concatfragments.rb',
|
|
|
|
:backup => false,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end # on osfamily Solaris
|
|
|
|
|
2014-07-09 05:45:16 +02:00
|
|
|
context "on osfamily windows" do
|
2014-05-28 18:31:02 +02:00
|
|
|
concatdir = '/foo'
|
|
|
|
let(:facts) do
|
|
|
|
{
|
2014-10-09 00:06:15 +02:00
|
|
|
:concat_basedir => concatdir,
|
|
|
|
:caller_module_name => 'Test',
|
|
|
|
:osfamily => 'windows',
|
|
|
|
:id => 'batman',
|
2014-11-15 00:53:36 +01:00
|
|
|
:is_pe => false,
|
2014-05-28 18:31:02 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it do
|
|
|
|
should contain_file("#{concatdir}/bin/concatfragments.rb").with({
|
|
|
|
:ensure => 'file',
|
|
|
|
:owner => nil,
|
|
|
|
:mode => nil,
|
|
|
|
:source => 'puppet:///modules/concat/concatfragments.rb',
|
|
|
|
:backup => false,
|
|
|
|
})
|
|
|
|
end
|
2014-07-09 05:45:16 +02:00
|
|
|
end # on osfamily windows
|
2013-10-23 16:44:06 +02:00
|
|
|
end
|