aboutsummaryrefslogtreecommitdiff
path: root/spec/classes/tftp_spec.rb
diff options
context:
space:
mode:
authorNan Liu <nan@puppetlabs.com>2012-05-14 11:10:55 -0700
committerNan Liu <nan@puppetlabs.com>2012-05-14 11:18:06 -0700
commit50fcf03f10e27c10efeac2eb29615078e7b0881f (patch)
tree61b2392303a2f4094d4712864a552d5f3c8f66ab /spec/classes/tftp_spec.rb
parentedd39b0301a7db0af5098baf7a0b228036038493 (diff)
downloadpuppet-tftp-50fcf03f10e27c10efeac2eb29615078e7b0881f.tar.gz
puppet-tftp-50fcf03f10e27c10efeac2eb29615078e7b0881f.tar.bz2
(#14465) Add inetd option tftpd.
This adds the ability to use inetd for tftpd service. This merges the functionality provided in the puppet-tftp module to puppetlabs-tftp.
Diffstat (limited to 'spec/classes/tftp_spec.rb')
-rw-r--r--spec/classes/tftp_spec.rb45
1 files changed, 44 insertions, 1 deletions
diff --git a/spec/classes/tftp_spec.rb b/spec/classes/tftp_spec.rb
index 3e17286..016130d 100644
--- a/spec/classes/tftp_spec.rb
+++ b/spec/classes/tftp_spec.rb
@@ -8,21 +8,64 @@ describe 'tftp', :type => :class do
it { should contain_file('/etc/default/tftpd-hpa') }
it { should contain_package('tftpd-hpa') }
it { should contain_service('tftpd-hpa').with({
+ 'ensure' => 'running',
+ 'enable' => true,
'hasstatus' => false,
'provider' => nil,
}) }
end
describe 'when deploying on ubuntu' do
- let(:facts) { { :operatingsystem => 'ubuntu',
+ let(:facts) { { :operatingsystem => 'Ubuntu',
:path => '/usr/local/bin:/usr/bin:/bin', } }
it { should contain_package('tftpd-hpa') }
it { should contain_file('/etc/default/tftpd-hpa') }
it { should contain_service('tftpd-hpa').with({
+ 'ensure' => 'running',
+ 'enable' => true,
'hasstatus' => true,
'provider' => 'upstart',
}) }
end
+ describe 'when deploying with inetd' do
+ let(:facts) { { :operatingsystem => 'Debian',
+ :path => '/usr/local/bin:/usr/bin:/bin', } }
+ let(:params) { { :inetd => true, } }
+
+ it { should contain_package('tftpd-hpa') }
+ it { should contain_file('/etc/default/tftpd-hpa') }
+ it { should contain_class('inetd') }
+ it { should contain_augeas('inetd_tftp').with({
+ 'changes' => [
+ "ins tftp after /files/etc/inetd.conf",
+ "set /files/etc/inetd.conf/tftp/socket dgram",
+ "set /files/etc/inetd.conf/tftp/protocol udp",
+ "set /files/etc/inetd.conf/tftp/wait wait",
+ "set /files/etc/inetd.conf/tftp/user tftp",
+ "set /files/etc/inetd.conf/tftp/command /usr/libexec/tftpd",
+ "set /files/etc/inetd.conf/tftp/arguments/1 tftpd",
+ "set /files/etc/inetd.conf/tftp/arguments/2 --address",
+ "set /files/etc/inetd.conf/tftp/arguments/3 0.0.0.0:69",
+ "set /files/etc/inetd.conf/tftp/arguments/4 --secure",
+ "set /files/etc/inetd.conf/tftp/arguments/5 /srv/tftp",
+ ],
+ }) }
+ it { should contain_service('tftpd-hpa').with({
+ 'ensure' => 'stopped',
+ 'enable' => false,
+ 'hasstatus' => false,
+ 'provider' => nil,
+ }) }
+ end
+
+ describe 'when deploying with inetd and custom options' do
+ let(:facts) { { :operatingsystem => 'Debian',
+ :path => '/usr/local/bin:/usr/bin:/bin', } }
+ let(:params) { { :inetd => true,
+ :options => '--timeout 5 --secure', } }
+
+ it { expect { should contain_class('tftp') }.to raise_error(Puppet::Error) }
+ end
end