test_spec.rb 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. require 'serverspec'
  2. # Required by serverspec
  3. set :backend, :exec
  4. describe package('fastd') do
  5. it { should be_installed }
  6. end
  7. # Ansible seems to have problems to enable a service. Needs investigation
  8. describe service('fastd') do
  9. it { should be_running }
  10. # it { should be_enabled }
  11. end
  12. # Detection of running service fails in Debian 7.8. Needs investigation.
  13. #describe service('rng-tools') do
  14. # it { should be_running }
  15. # it { should be_enabled }
  16. #end
  17. describe file('/etc/fastd/fastd-blacklist.sh') do
  18. it { should exist }
  19. it { should be_executable }
  20. end
  21. describe port(10000) do
  22. it { should be_listening.with('udp6') }
  23. end
  24. describe port(10001) do
  25. it { should be_listening.with('udp6') }
  26. end
  27. describe package('rng-tools') do
  28. it { should be_installed }
  29. end
  30. describe file('/etc/default/rng-tools') do
  31. it { should exist }
  32. its(:content) { should match /HRNGDEVICE=\/dev\/urandom/ }
  33. end
  34. describe user('fastd') do
  35. it { should exist }
  36. it { should have_login_shell '/bin/false' }
  37. end
  38. describe package('batctl') do
  39. it {should be_installed }
  40. end
  41. describe kernel_module('batman_adv') do
  42. it { should be_loaded }
  43. end
  44. describe package('bird') do
  45. it { should be_installed }
  46. end
  47. describe file('/etc/bird/bird.conf') do
  48. it { should exist }
  49. its(:content) { should contain 'router id 10.42.0.1;' }
  50. end
  51. describe file('/etc/bird/bird6.conf') do
  52. it { should exist }
  53. its(:content) { should contain 'router id 10.42.0.1;' }
  54. end
  55. # At least on Ubuntu doesn't open a port. Is this a problem?
  56. #describe port(179) do
  57. # it { should be_listening.with('tcp') }
  58. # it { should be_listening.with('tcp6') }
  59. #end
  60. #describe service('bird') do
  61. # it { should be_running }
  62. # it { should be_enabled }
  63. #end
  64. #describe service('bird6') do
  65. # it { should be_running }
  66. # it { should be_enabled }
  67. #end
  68. describe interface('meshdummy0') do
  69. it { should exist }
  70. end
  71. describe interface('alfred0') do
  72. it { should exist }
  73. end
  74. describe interface('bat0') do
  75. it { should exist }
  76. end
  77. describe interface('eth0') do
  78. it { should exist }
  79. end
  80. describe interface('tap00') do
  81. it { should exist }
  82. end
  83. describe interface('tap01') do
  84. it { should exist }
  85. end
  86. describe interface('test-node02') do
  87. it { should exist }
  88. end
  89. describe interface('ffanon-uplink1') do
  90. it { should exist }
  91. end
  92. describe cron do
  93. it { should have_entry '*/5 * * * * wget -q -O /etc/fastd/fastd-blacklist.json https://raw.githubusercontent.com/ffruhr/fastdbl/master/fastd-blacklist.json' }
  94. end
  95. describe user('fritz') do
  96. it { should exist }
  97. it { should have_authorized_key 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCfO2TgNUMcY9K8N9SsAU/LfVtlloO50n6NRxDER8dCi+t1ydalTbNdEj52cIjqvIEn458cCxdCwsNYeWqSVggX7vT7a+DgYZlJcRteHcb0lPYZplPuiZe3AUE9rHH48W4xEopv7J8Wz6hLng6Gb0TQx9HeVybQ5dn6CGyt8sOCKQ== Fritz Brinkhoffs' }
  98. end
  99. describe port(67) do
  100. it { should be_listening.with('udp')}
  101. end