urandomfix_spec.rb 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. require 'spec_helper'
  2. describe 'jdk7::urandomfix' , :type => :class do
  3. it { should contain_package('rng-tools').with_ensure('present') }
  4. describe "Windows" do
  5. let(:facts) {{ :kernel => 'Windows',
  6. :operatingsystem => 'Windows'}}
  7. it do
  8. expect { should contain_exec("set urandom /etc/sysconfig/rngd")
  9. }.to raise_error(Puppet::Error, /Unrecognized operating system/)
  10. end
  11. end
  12. describe "SunOS" do
  13. let(:facts) {{ :kernel => 'SunOS',
  14. :operatingsystem => 'Solaris'}}
  15. it do
  16. expect { should contain_exec("set urandom /etc/sysconfig/rngd")
  17. }.to raise_error(Puppet::Error, /Unrecognized operating system/)
  18. end
  19. end
  20. describe "CentOS" do
  21. let(:facts) {{ :operatingsystem => 'CentOS' ,
  22. :kernel => 'Linux',
  23. :osfamily => 'RedHat' }}
  24. describe "on operatingsystem CentOS" do
  25. it do
  26. should contain_exec("set urandom /etc/sysconfig/rngd").with({
  27. 'user' => 'root',
  28. })
  29. end
  30. it do
  31. should contain_service("start rngd service").with({
  32. 'ensure' => true,
  33. 'enable' => true,
  34. })
  35. end
  36. it do
  37. should contain_exec("chkconfig rngd").with({
  38. 'user' => 'root',
  39. 'command' => "chkconfig --add rngd",
  40. })
  41. end
  42. end
  43. end
  44. ['Ubuntu','Debian','SLES'].each do |system|
  45. let(:facts) {{ :operatingsystem => system ,
  46. :kernel => 'Linux',
  47. :osfamily => 'Debian' }}
  48. describe "on operatingsystem #{system}" do
  49. it do
  50. should contain_exec("set urandom /etc/default/rng-tools").with({
  51. 'user' => 'root',
  52. })
  53. end
  54. it do
  55. should contain_service("start rng-tools service").with({
  56. 'ensure' => true,
  57. 'enable' => true,
  58. })
  59. end
  60. end
  61. end
  62. end