3 describe 'systemd::dropin_file' do
4 context 'supported operating systems' do
5 on_supported_os.each do |os, facts|
9 let(:title) { 'test.conf' }
12 :unit => 'test.service',
13 :content => 'random stuff'
16 it { is_expected.to compile.with_all_deps }
18 it { is_expected.to create_file("/etc/systemd/system/#{params[:unit]}.d").with(
19 :ensure => 'directory',
22 it { is_expected.to create_file("/etc/systemd/system/#{params[:unit]}.d/#{title}").with(
24 :content => /#{params[:content]}/,
28 it { is_expected.to create_file("/etc/systemd/system/#{params[:unit]}.d/#{title}").that_notifies('Class[systemd::systemctl::daemon_reload]') }
30 context 'with a bad unit type' do
31 let(:title) { 'test.badtype' }
35 is_expected.to compile.with_all_deps
36 }.to raise_error(/expects a match for Systemd::Dropin/)
40 context 'with another drop-in file with the same filename (and content)' do
41 let(:default_params) {{
42 :filename => 'longer-timeout.conf',
43 :content => 'random stuff'
45 # Create drop-in file longer-timeout.conf for unit httpd.service
47 "systemd::dropin_file { 'httpd_longer-timeout':
48 filename => '#{default_params[:filename]}',
49 unit => 'httpd.service',
50 content => '#{default_params[:context]}',
54 # Create drop-in file longer-timeout.conf for unit ftp.service
55 let (:title) {'ftp_longer-timeout'}
57 default_params.merge({
58 :unit => 'ftp.service'
62 it { is_expected.to create_file("/etc/systemd/system/#{params[:unit]}.d/#{params[:filename]}").with(
64 :content => /#{params[:content]}/,