serverspec 1.16.0 → 2.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -2
  3. data/Rakefile +20 -25
  4. data/lib/serverspec.rb +0 -3
  5. data/lib/serverspec/helper/os.rb +0 -3
  6. data/lib/serverspec/helper/type.rb +3 -3
  7. data/lib/serverspec/matchers.rb +1 -7
  8. data/lib/serverspec/matchers/have_rule.rb +1 -1
  9. data/lib/serverspec/setup.rb +12 -11
  10. data/lib/serverspec/type/file.rb +0 -15
  11. data/lib/serverspec/type/iis_app_pool.rb +0 -28
  12. data/lib/serverspec/type/iis_website.rb +0 -12
  13. data/lib/serverspec/type/interface.rb +0 -3
  14. data/lib/serverspec/type/user.rb +0 -4
  15. data/lib/serverspec/version.rb +1 -1
  16. data/serverspec.gemspec +4 -3
  17. data/wercker.yml +9 -9
  18. metadata +36 -471
  19. data/lib/serverspec/matchers/belong_to_primary_group.rb +0 -5
  20. data/lib/serverspec/matchers/have_site_application.rb +0 -18
  21. data/lib/serverspec/matchers/have_site_bindings.rb +0 -22
  22. data/lib/serverspec/matchers/have_virtual_dir.rb +0 -14
  23. data/lib/serverspec/type/ip6tables.rb +0 -13
  24. data/lib/serverspec/type/ppa.rb +0 -13
  25. data/lib/serverspec/type/windows_scheduled_task.rb +0 -9
  26. data/spec/aix/command_spec.rb +0 -65
  27. data/spec/aix/cron_spec.rb +0 -21
  28. data/spec/aix/default_gateway_spec.rb +0 -16
  29. data/spec/aix/file_spec.rb +0 -404
  30. data/spec/aix/group_spec.rb +0 -21
  31. data/spec/aix/host_spec.rb +0 -58
  32. data/spec/aix/package_spec.rb +0 -100
  33. data/spec/aix/php_config_spec.rb +0 -36
  34. data/spec/aix/port_spec.rb +0 -30
  35. data/spec/aix/process_spec.rb +0 -29
  36. data/spec/aix/routing_table_spec.rb +0 -120
  37. data/spec/aix/service_spec.rb +0 -93
  38. data/spec/aix/user_spec.rb +0 -57
  39. data/spec/arch/file_spec.rb +0 -413
  40. data/spec/arch/package_spec.rb +0 -100
  41. data/spec/arch/service_spec.rb +0 -84
  42. data/spec/backend/cmd/configuration_spec.rb +0 -9
  43. data/spec/backend/exec/configuration_spec.rb +0 -61
  44. data/spec/backend/powershell/script_helper_spec.rb +0 -105
  45. data/spec/backend/ssh/configuration_spec.rb +0 -184
  46. data/spec/backend/winrm/configuration_spec.rb +0 -9
  47. data/spec/darwin/command_spec.rb +0 -65
  48. data/spec/darwin/cron_spec.rb +0 -21
  49. data/spec/darwin/default_gateway_spec.rb +0 -16
  50. data/spec/darwin/file_spec.rb +0 -413
  51. data/spec/darwin/group_spec.rb +0 -21
  52. data/spec/darwin/host_spec.rb +0 -58
  53. data/spec/darwin/mail_alias_spec.rb +0 -12
  54. data/spec/darwin/package_spec.rb +0 -82
  55. data/spec/darwin/php_config_spec.rb +0 -36
  56. data/spec/darwin/port_spec.rb +0 -30
  57. data/spec/darwin/process_spec.rb +0 -29
  58. data/spec/darwin/routing_table_spec.rb +0 -120
  59. data/spec/darwin/service_spec.rb +0 -91
  60. data/spec/darwin/user_spec.rb +0 -57
  61. data/spec/debian/cgroup_spec.rb +0 -14
  62. data/spec/debian/command_spec.rb +0 -65
  63. data/spec/debian/cron_spec.rb +0 -21
  64. data/spec/debian/default_gateway_spec.rb +0 -16
  65. data/spec/debian/file_spec.rb +0 -413
  66. data/spec/debian/group_spec.rb +0 -22
  67. data/spec/debian/host_spec.rb +0 -58
  68. data/spec/debian/interface_spec.rb +0 -24
  69. data/spec/debian/ip6tables_spec.rb +0 -21
  70. data/spec/debian/iptables_spec.rb +0 -21
  71. data/spec/debian/kernel_module_spec.rb +0 -12
  72. data/spec/debian/linux_kernel_parameter_spec.rb +0 -36
  73. data/spec/debian/lxc_spec.rb +0 -22
  74. data/spec/debian/mail_alias_spec.rb +0 -12
  75. data/spec/debian/package_spec.rb +0 -130
  76. data/spec/debian/php_config_spec.rb +0 -36
  77. data/spec/debian/port_spec.rb +0 -40
  78. data/spec/debian/process_spec.rb +0 -29
  79. data/spec/debian/routing_table_spec.rb +0 -120
  80. data/spec/debian/selinux_spec.rb +0 -18
  81. data/spec/debian/service_spec.rb +0 -93
  82. data/spec/debian/user_spec.rb +0 -57
  83. data/spec/debian/zfs_spec.rb +0 -18
  84. data/spec/fedora/cgroup_spec.rb +0 -14
  85. data/spec/fedora/command_spec.rb +0 -67
  86. data/spec/fedora/cron_spec.rb +0 -21
  87. data/spec/fedora/default_gateway_spec.rb +0 -16
  88. data/spec/fedora/file_spec.rb +0 -413
  89. data/spec/fedora/group_spec.rb +0 -21
  90. data/spec/fedora/host_spec.rb +0 -58
  91. data/spec/fedora/interface_spec.rb +0 -24
  92. data/spec/fedora/ip6tables_spec.rb +0 -21
  93. data/spec/fedora/iptables_spec.rb +0 -21
  94. data/spec/fedora/kernel_module_spec.rb +0 -12
  95. data/spec/fedora/linux_kernel_parameter_spec.rb +0 -36
  96. data/spec/fedora/lxc_spec.rb +0 -22
  97. data/spec/fedora/mail_alias_spec.rb +0 -12
  98. data/spec/fedora/package_spec.rb +0 -118
  99. data/spec/fedora/php_config_spec.rb +0 -36
  100. data/spec/fedora/port_spec.rb +0 -30
  101. data/spec/fedora/process_spec.rb +0 -41
  102. data/spec/fedora/routing_table_spec.rb +0 -120
  103. data/spec/fedora/selinux_spec.rb +0 -18
  104. data/spec/fedora/user_spec.rb +0 -57
  105. data/spec/fedora/yumrepo_spec.rb +0 -25
  106. data/spec/fedora/zfs_spec.rb +0 -18
  107. data/spec/freebsd/command_spec.rb +0 -65
  108. data/spec/freebsd/cron_spec.rb +0 -21
  109. data/spec/freebsd/default_gateway_spec.rb +0 -16
  110. data/spec/freebsd/file_spec.rb +0 -385
  111. data/spec/freebsd/group_spec.rb +0 -21
  112. data/spec/freebsd/host_spec.rb +0 -58
  113. data/spec/freebsd/package_spec.rb +0 -96
  114. data/spec/freebsd/php_config_spec.rb +0 -36
  115. data/spec/freebsd/port_spec.rb +0 -30
  116. data/spec/freebsd/process_spec.rb +0 -29
  117. data/spec/freebsd/routing_table_spec.rb +0 -120
  118. data/spec/freebsd/service_spec.rb +0 -93
  119. data/spec/freebsd/user_spec.rb +0 -57
  120. data/spec/freebsd10/package_spec.rb +0 -13
  121. data/spec/gentoo/cgroup_spec.rb +0 -14
  122. data/spec/gentoo/command_spec.rb +0 -65
  123. data/spec/gentoo/cron_spec.rb +0 -21
  124. data/spec/gentoo/default_gateway_spec.rb +0 -16
  125. data/spec/gentoo/file_spec.rb +0 -413
  126. data/spec/gentoo/group_spec.rb +0 -21
  127. data/spec/gentoo/host_spec.rb +0 -58
  128. data/spec/gentoo/interface_spec.rb +0 -24
  129. data/spec/gentoo/ip6tables_spec.rb +0 -21
  130. data/spec/gentoo/iptables_spec.rb +0 -21
  131. data/spec/gentoo/kernel_module_spec.rb +0 -12
  132. data/spec/gentoo/linux_kernel_parameter_spec.rb +0 -36
  133. data/spec/gentoo/lxc_spec.rb +0 -22
  134. data/spec/gentoo/mail_alias_spec.rb +0 -12
  135. data/spec/gentoo/package_spec.rb +0 -91
  136. data/spec/gentoo/php_config_spec.rb +0 -36
  137. data/spec/gentoo/port_spec.rb +0 -30
  138. data/spec/gentoo/process_spec.rb +0 -29
  139. data/spec/gentoo/routing_table_spec.rb +0 -120
  140. data/spec/gentoo/selinux_spec.rb +0 -18
  141. data/spec/gentoo/service_spec.rb +0 -93
  142. data/spec/gentoo/user_spec.rb +0 -57
  143. data/spec/gentoo/zfs_spec.rb +0 -18
  144. data/spec/nixos/file_spec.rb +0 -421
  145. data/spec/nixos/package_spec.rb +0 -109
  146. data/spec/nixos/service_spec.rb +0 -40
  147. data/spec/plamo/cgroup_spec.rb +0 -14
  148. data/spec/plamo/command_spec.rb +0 -65
  149. data/spec/plamo/cron_spec.rb +0 -21
  150. data/spec/plamo/default_gateway_spec.rb +0 -16
  151. data/spec/plamo/file_spec.rb +0 -413
  152. data/spec/plamo/group_spec.rb +0 -22
  153. data/spec/plamo/host_spec.rb +0 -58
  154. data/spec/plamo/interface_spec.rb +0 -24
  155. data/spec/plamo/ip6tables_spec.rb +0 -21
  156. data/spec/plamo/iptables_spec.rb +0 -21
  157. data/spec/plamo/kernel_module_spec.rb +0 -12
  158. data/spec/plamo/linux_kernel_parameter_spec.rb +0 -36
  159. data/spec/plamo/lxc_spec.rb +0 -22
  160. data/spec/plamo/mail_alias_spec.rb +0 -12
  161. data/spec/plamo/package_spec.rb +0 -100
  162. data/spec/plamo/php_config_spec.rb +0 -36
  163. data/spec/plamo/port_spec.rb +0 -30
  164. data/spec/plamo/routing_table_spec.rb +0 -120
  165. data/spec/plamo/selinux_spec.rb +0 -18
  166. data/spec/plamo/service_spec.rb +0 -84
  167. data/spec/plamo/user_spec.rb +0 -57
  168. data/spec/plamo/zfs_spec.rb +0 -18
  169. data/spec/redhat/cgroup_spec.rb +0 -14
  170. data/spec/redhat/command_spec.rb +0 -67
  171. data/spec/redhat/cron_spec.rb +0 -21
  172. data/spec/redhat/default_gateway_spec.rb +0 -16
  173. data/spec/redhat/file_spec.rb +0 -418
  174. data/spec/redhat/group_spec.rb +0 -21
  175. data/spec/redhat/host_spec.rb +0 -64
  176. data/spec/redhat/interface_spec.rb +0 -24
  177. data/spec/redhat/ip6tables_spec.rb +0 -21
  178. data/spec/redhat/iptables_spec.rb +0 -21
  179. data/spec/redhat/kernel_module_spec.rb +0 -12
  180. data/spec/redhat/linux_kernel_parameter_spec.rb +0 -36
  181. data/spec/redhat/lxc_spec.rb +0 -22
  182. data/spec/redhat/mail_alias_spec.rb +0 -12
  183. data/spec/redhat/package_spec.rb +0 -118
  184. data/spec/redhat/php_config_spec.rb +0 -36
  185. data/spec/redhat/port_spec.rb +0 -30
  186. data/spec/redhat/process_spec.rb +0 -41
  187. data/spec/redhat/routing_table_spec.rb +0 -120
  188. data/spec/redhat/selinux_spec.rb +0 -18
  189. data/spec/redhat/service_spec.rb +0 -93
  190. data/spec/redhat/user_spec.rb +0 -57
  191. data/spec/redhat/yumrepo_spec.rb +0 -25
  192. data/spec/redhat/zfs_spec.rb +0 -18
  193. data/spec/redhat7/service_spec.rb +0 -21
  194. data/spec/smartos/mail_alias_spec.rb +0 -12
  195. data/spec/smartos/process_spec.rb +0 -29
  196. data/spec/solaris/command_spec.rb +0 -65
  197. data/spec/solaris/cron_spec.rb +0 -21
  198. data/spec/solaris/default_gateway_spec.rb +0 -16
  199. data/spec/solaris/file_spec.rb +0 -413
  200. data/spec/solaris/group_spec.rb +0 -21
  201. data/spec/solaris/host_spec.rb +0 -58
  202. data/spec/solaris/ipfilter_spec.rb +0 -8
  203. data/spec/solaris/ipnat_spec.rb +0 -8
  204. data/spec/solaris/mail_alias_spec.rb +0 -12
  205. data/spec/solaris/package_spec.rb +0 -100
  206. data/spec/solaris/php_config_spec.rb +0 -36
  207. data/spec/solaris/port_spec.rb +0 -30
  208. data/spec/solaris/process_spec.rb +0 -29
  209. data/spec/solaris/routing_table_spec.rb +0 -120
  210. data/spec/solaris/service_spec.rb +0 -93
  211. data/spec/solaris/svcprop_spec.rb +0 -13
  212. data/spec/solaris/user_spec.rb +0 -57
  213. data/spec/solaris/zfs_spec.rb +0 -18
  214. data/spec/solaris10/file_spec.rb +0 -395
  215. data/spec/solaris10/group_spec.rb +0 -21
  216. data/spec/solaris10/mail_alias_spec.rb +0 -12
  217. data/spec/solaris10/package_spec.rb +0 -85
  218. data/spec/solaris10/php_config_spec.rb +0 -36
  219. data/spec/solaris10/user_spec.rb +0 -57
  220. data/spec/solaris11/command_spec.rb +0 -65
  221. data/spec/solaris11/cron_spec.rb +0 -21
  222. data/spec/solaris11/default_gateway_spec.rb +0 -16
  223. data/spec/solaris11/file_spec.rb +0 -413
  224. data/spec/solaris11/group_spec.rb +0 -21
  225. data/spec/solaris11/host_spec.rb +0 -58
  226. data/spec/solaris11/ipfilter_spec.rb +0 -8
  227. data/spec/solaris11/ipnat_spec.rb +0 -8
  228. data/spec/solaris11/mail_alias_spec.rb +0 -12
  229. data/spec/solaris11/package_spec.rb +0 -100
  230. data/spec/solaris11/php_config_spec.rb +0 -36
  231. data/spec/solaris11/port_spec.rb +0 -12
  232. data/spec/solaris11/routing_table_spec.rb +0 -120
  233. data/spec/solaris11/service_spec.rb +0 -93
  234. data/spec/solaris11/svcprop_spec.rb +0 -13
  235. data/spec/solaris11/user_spec.rb +0 -57
  236. data/spec/solaris11/zfs_spec.rb +0 -18
  237. data/spec/support/powershell_command_runner.rb +0 -52
  238. data/spec/ubuntu/ppa_spec.rb +0 -25
  239. data/spec/windows/command_spec.rb +0 -67
  240. data/spec/windows/file_spec.rb +0 -161
  241. data/spec/windows/group_spec.rb +0 -28
  242. data/spec/windows/port_spec.rb +0 -31
  243. data/spec/windows/service_spec.rb +0 -31
  244. data/spec/windows/user_spec.rb +0 -44
  245. data/spec/windows/windows_hot_fix_spec.rb +0 -25
  246. data/spec/windows/windows_registry_key_spec.rb +0 -66
@@ -1,120 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::Fedora
4
-
5
- describe routing_table do
6
- let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
7
- it { should have_entry( :destination => '192.168.100.0/24' ) }
8
- its(:command) { should eq "ip route | grep -E '^192.168.100.0/24 |^default '" }
9
- end
10
-
11
- describe routing_table do
12
- let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
13
- it { should_not have_entry( :destination => '192.168.100.100/24' ) }
14
- its(:command) { should eq "ip route | grep -E '^192.168.100.100/24 |^default '" }
15
- end
16
-
17
- describe routing_table do
18
- let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
19
- it do
20
- should have_entry(
21
- :destination => '192.168.100.0/24',
22
- :gateway => '192.168.100.1'
23
- )
24
- end
25
-
26
- it do
27
- should have_entry(
28
- :destination => '192.168.100.0/24',
29
- :gateway => '192.168.100.1',
30
- :interface => 'eth1'
31
- )
32
- end
33
-
34
- it do
35
- should_not have_entry(
36
- :gateway => '192.168.100.1',
37
- :interface => 'eth1'
38
- )
39
- end
40
-
41
- it do
42
- should_not have_entry(
43
- :destination => '192.168.100.0/32',
44
- :gateway => '192.168.100.1',
45
- :interface => 'eth1'
46
- )
47
- end
48
- end
49
-
50
- describe routing_table do
51
- let(:stdout) { "192.168.200.0/24 via 192.168.200.1 dev eth0 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
52
- it { should have_entry( :destination => '192.168.200.0/24' ) }
53
- it { should_not have_entry( :destination => '192.168.200.200/24' ) }
54
-
55
- it do
56
- should have_entry(
57
- :destination => '192.168.200.0/24',
58
- :gateway => '192.168.200.1'
59
- )
60
- end
61
-
62
- it do
63
- should have_entry(
64
- :destination => '192.168.200.0/24',
65
- :gateway => '192.168.200.1',
66
- :interface => 'eth0'
67
- )
68
- end
69
-
70
- it do
71
- should_not have_entry(
72
- :gateway => '192.168.200.1',
73
- :interface => 'eth0'
74
- )
75
- end
76
-
77
- it do
78
- should_not have_entry(
79
- :destination => '192.168.200.0/32',
80
- :gateway => '192.168.200.1',
81
- :interface => 'eth0'
82
- )
83
- end
84
- end
85
-
86
- describe routing_table do
87
- let(:stdout) { "default via 10.0.2.2 dev eth0 \r\n" }
88
- it { should have_entry( :destination => 'default' ) }
89
- it { should_not have_entry( :destination => 'defaulth' ) }
90
-
91
- it do
92
- should have_entry(
93
- :destination => 'default',
94
- :gateway => '10.0.2.2'
95
- )
96
- end
97
-
98
- it do
99
- should have_entry(
100
- :destination => 'default',
101
- :gateway => '10.0.2.2',
102
- :interface => 'eth0'
103
- )
104
- end
105
-
106
- it do
107
- should_not have_entry(
108
- :gateway => '10.0.2.2',
109
- :interface => 'eth0'
110
- )
111
- end
112
-
113
- it do
114
- should_not have_entry(
115
- :destination => 'default',
116
- :gateway => '10.0.2.1',
117
- :interface => 'eth0'
118
- )
119
- end
120
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::Fedora
4
-
5
- describe selinux do
6
- it { should be_enforcing }
7
- its(:command) { should eq "getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config" }
8
- end
9
-
10
- describe selinux do
11
- it { should be_permissive }
12
- its(:command) { should eq "getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config" }
13
- end
14
-
15
- describe selinux do
16
- it { should be_disabled }
17
- its(:command) { should eq "test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
18
- end
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::Fedora
4
-
5
- describe user('root') do
6
- it { should exist }
7
- its(:command) { should eq "id root" }
8
- end
9
-
10
- describe user('invalid-user') do
11
- it { should_not exist }
12
- end
13
-
14
- describe user('root') do
15
- it { should belong_to_group 'root' }
16
- its(:command) { should eq "id root | awk '{print $3}' | grep -- root" }
17
- end
18
-
19
- describe user('root') do
20
- it { should_not belong_to_group 'invalid-group' }
21
- end
22
-
23
- describe user('root') do
24
- it { should have_uid 0 }
25
- its(:command) { should eq "id root | grep -- \\^uid\\=0\\(" }
26
- end
27
-
28
- describe user('root') do
29
- it { should_not have_uid 'invalid-uid' }
30
- end
31
-
32
- describe user('root') do
33
- it { should have_login_shell '/bin/bash' }
34
- its(:command) { should eq "getent passwd root | cut -f 7 -d ':' | grep -w -- /bin/bash" }
35
- end
36
-
37
- describe user('root') do
38
- it { should_not have_login_shell 'invalid-login-shell' }
39
- end
40
-
41
- describe user('root') do
42
- it { should have_home_directory '/root' }
43
- its(:command) { should eq "getent passwd root | cut -f 6 -d ':' | grep -w -- /root" }
44
- end
45
-
46
- describe user('root') do
47
- it { should_not have_home_directory 'invalid-home-directory' }
48
- end
49
-
50
- describe user('root') do
51
- it { should have_authorized_key 'ssh-rsa ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH foo@bar.local' }
52
- its(:command) { should eq "grep -w -- ssh-rsa\\ ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH ~root/.ssh/authorized_keys" }
53
- end
54
-
55
- describe user('root') do
56
- it { should_not have_authorized_key 'invalid-key' }
57
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::Fedora
4
-
5
- describe 'Serverspec yumrepo matchers of Red Hat family' do
6
- describe 'exist' do
7
- describe yumrepo('epel') do
8
- it { should exist }
9
- end
10
-
11
- describe yumrepo('invalid-repository') do
12
- it { should_not exist }
13
- end
14
- end
15
-
16
- describe 'be_enabled' do
17
- describe yumrepo('epel') do
18
- it { should be_enabled }
19
- end
20
-
21
- describe yumrepo('invalid-repository') do
22
- it { should_not be_enabled }
23
- end
24
- end
25
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::Fedora
4
-
5
- describe zfs('rpool') do
6
- it { should exist }
7
- its(:command) { should eq "zfs list -H rpool" }
8
- end
9
-
10
- describe zfs('rpool') do
11
- it { should have_property 'mountpoint' => '/rpool' }
12
- its(:command) { should eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
13
- end
14
-
15
- describe zfs('rpool') do
16
- it { should have_property 'mountpoint' => '/rpool', 'compression' => 'off' }
17
- its(:command) { should eq "zfs list -H -o compression rpool | grep -- \\^off\\$ && zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
18
- end
@@ -1,65 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::FreeBSD
4
-
5
- describe command('cat /etc/resolv.conf') do
6
- let(:stdout) { "nameserver 127.0.0.1\r\n" }
7
- it { should return_stdout("nameserver 127.0.0.1") }
8
- its(:command) { should eq 'cat /etc/resolv.conf' }
9
- end
10
-
11
- describe 'complete matching of stdout' do
12
- context command('cat /etc/resolv.conf') do
13
- let(:stdout) { "foocontent-should-be-includedbar\r\n" }
14
- it { should_not return_stdout('content-should-be-included') }
15
- end
16
- end
17
-
18
- describe 'regexp matching of stdout' do
19
- context command('cat /etc/resolv.conf') do
20
- let(:stdout) { "nameserver 127.0.0.1\r\n" }
21
- it { should return_stdout(/127\.0\.0\.1/) }
22
- end
23
- end
24
-
25
- describe command('cat /etc/resolv.conf') do
26
- let(:stderr) { "No such file or directory\r\n" }
27
- it { should return_stderr("No such file or directory") }
28
- its(:command) { should eq 'cat /etc/resolv.conf' }
29
- end
30
-
31
- describe 'complete matching of stderr' do
32
- context command('cat /etc/resolv.conf') do
33
- let(:stderr) { "No such file or directory\r\n" }
34
- it { should_not return_stderr('file') }
35
- end
36
- end
37
-
38
- describe 'regexp matching of stderr' do
39
- context command('cat /etc/resolv.conf') do
40
- let(:stderr) { "No such file or directory\r\n" }
41
- it { should return_stderr(/file/) }
42
- end
43
- end
44
-
45
- describe command('cat /etc/resolv.conf') do
46
- it { should return_exit_status 0 }
47
- its(:command) { should eq 'cat /etc/resolv.conf' }
48
- end
49
-
50
- describe command('ls -al /') do
51
- let(:stdout) { <<EOF
52
- total 88
53
- drwxr-xr-x 23 root root 4096 Oct 10 17:19 .
54
- drwxr-xr-x 23 root root 4096 Oct 10 17:19 ..
55
- drwxr-xr-x 2 root root 4096 Sep 11 16:43 bin
56
- drwxr-xr-x 3 root root 4096 Sep 23 18:14 boot
57
- drwxr-xr-x 14 root root 4260 Oct 14 16:14 dev
58
- drwxr-xr-x 104 root root 4096 Oct 14 17:34 etc
59
- drwxr-xr-x 8 root root 4096 Oct 1 15:09 home
60
- EOF
61
- }
62
-
63
- its(:stdout) { should match /bin/ }
64
- its(:stdout) { should eq stdout }
65
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::FreeBSD
4
-
5
- describe cron do
6
- it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
7
- its(:command) { should eq 'crontab -l | grep -v "#" -- | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' }
8
- end
9
-
10
- describe cron do
11
- it { should_not have_entry 'invalid entry' }
12
- end
13
-
14
- describe cron do
15
- it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') }
16
- its(:command) { should eq 'crontab -u root -l | grep -v "#" | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' }
17
- end
18
-
19
- describe cron do
20
- it { should_not have_entry('* * * * * /usr/local/bin/batch.sh').with_user('invalid-user') }
21
- end
@@ -1,16 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::FreeBSD
4
-
5
- describe default_gateway do
6
- let(:stdout) { "default via 192.168.1.1 dev eth1 \r\n" }
7
-
8
- its(:ipaddress) { should eq '192.168.1.1' }
9
- its(:command) { should eq "ip route | grep -E '^default |^default '" }
10
-
11
- its(:interface) { should eq 'eth1' }
12
- its(:command) { should eq "ip route | grep -E '^default |^default '" }
13
-
14
- its(:ipaddress) { should_not eq '192.168.1.2' }
15
- its(:interface) { should_not eq 'eth0' }
16
- end
@@ -1,385 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::FreeBSD
4
-
5
- describe file('/etc/ssh/sshd_config') do
6
- it { should be_file }
7
- its(:command) { should eq "test -f /etc/ssh/sshd_config" }
8
- end
9
-
10
- describe file('/etc/invalid_file') do
11
- it { should_not be_file }
12
- end
13
-
14
- describe file('/etc/ssh') do
15
- it { should be_directory }
16
- its(:command) { should eq "test -d /etc/ssh" }
17
- end
18
-
19
- describe file('/etc/invalid_directory') do
20
- it { should_not be_directory }
21
- end
22
-
23
- describe file('/var/run/unicorn.sock') do
24
- it { should be_socket }
25
- its(:command) { should eq "test -S /var/run/unicorn.sock" }
26
- end
27
-
28
- describe file('/etc/invalid_socket') do
29
- it { should_not be_socket }
30
- end
31
-
32
- describe file('/etc/ssh/sshd_config') do
33
- it { should contain 'This is the sshd server system-wide configuration file' }
34
- its(:command) { should eq "grep -q -- This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config || grep -qF -- This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config" }
35
- end
36
-
37
- describe file('/etc/ssh/sshd_config') do
38
- it { should contain /^This is the sshd server system-wide configuration file/ }
39
- its(:command) { should eq "grep -q -- \\^This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config || grep -qF -- \\^This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config" }
40
- end
41
-
42
- describe file('/etc/ssh/sshd_config') do
43
- it { should_not contain 'This is invalid text!!' }
44
- end
45
-
46
- describe file('Gemfile') do
47
- it { should contain('rspec').from(/^group :test do/).to(/^end/) }
48
- its(:command) { should eq "sed -n /\\^group\\ :test\\ do/,/\\^end/p Gemfile | grep -q -- rspec - || sed -n /\\^group\\ :test\\ do/,/\\^end/p Gemfile | grep -qF -- rspec -" }
49
- end
50
-
51
- describe file('/etc/ssh/sshd_config') do
52
- it { should_not contain('This is invalid text!!').from(/^group :test do/).to(/^end/) }
53
- end
54
-
55
- describe file('Gemfile') do
56
- it { should contain('rspec').after(/^group :test do/) }
57
- its(:command) { should eq "sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -q -- rspec - || sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -qF -- rspec -" }
58
- end
59
-
60
- describe file('/etc/ssh/sshd_config') do
61
- it { should_not contain('This is invalid text!!').after(/^group :test do/) }
62
- end
63
-
64
- describe file('Gemfile') do
65
- it { should contain('rspec').before(/^end/) }
66
- its(:command) { should eq "sed -n 1,/\\^end/p Gemfile | grep -q -- rspec - || sed -n 1,/\\^end/p Gemfile | grep -qF -- rspec -" }
67
- end
68
-
69
- describe file('/etc/ssh/sshd_config') do
70
- it { should_not contain('This is invalid text!!').before(/^end/) }
71
- end
72
-
73
- describe file('/etc/passwd') do
74
- it { should be_mode 644 }
75
- its(:command) { should eq "stat -f%Lp /etc/passwd | grep -- \\^644\\$" }
76
- end
77
-
78
- describe file('/etc/passwd') do
79
- it { should_not be_mode 'invalid' }
80
- end
81
-
82
- describe file('/etc/passwd') do
83
- it { should be_owned_by 'root' }
84
- its(:command) { should eq "stat -f%Su /etc/passwd | grep -- \\^root\\$" }
85
- end
86
-
87
- describe file('/etc/passwd') do
88
- it { should_not be_owned_by 'invalid-owner' }
89
- end
90
-
91
- describe file('/etc/passwd') do
92
- it { should be_grouped_into 'root' }
93
- its(:command) { should eq "stat -f%Sg /etc/passwd | grep -- \\^root\\$" }
94
- end
95
-
96
- describe file('/etc/passwd') do
97
- it { should_not be_grouped_into 'invalid-group' }
98
- end
99
-
100
- describe file('/etc/pam.d/system-auth') do
101
- it { should be_linked_to '/etc/pam.d/system-auth-ac' }
102
- its(:command) { should eq "stat -f%Y /etc/pam.d/system-auth | grep -- \"./etc/pam.d/system-auth-ac.\"" }
103
- end
104
-
105
- describe file('dummy-link') do
106
- it { should_not be_linked_to '/invalid/target' }
107
- end
108
-
109
- describe file('/dev') do
110
- let(:stdout) { "755\r\n" }
111
- it { should be_readable }
112
- its(:command) { should eq "stat -f%Lp /dev" }
113
- end
114
-
115
- describe file('/dev') do
116
- let(:stdout) { "333\r\n" }
117
- it { should_not be_readable }
118
- end
119
-
120
- describe file('/dev') do
121
- let(:stdout) { "400\r\n" }
122
- it { should be_readable.by('owner') }
123
- end
124
-
125
- describe file('/dev') do
126
- let(:stdout) { "044\r\n" }
127
- it { should_not be_readable.by('owner') }
128
- end
129
-
130
- describe file('/dev') do
131
- let(:stdout) { "040\r\n" }
132
- it { should be_readable.by('group') }
133
- end
134
-
135
- describe file('/dev') do
136
- let(:stdout) { "404\r\n" }
137
- it { should_not be_readable.by('group') }
138
- end
139
-
140
- describe file('/dev') do
141
- let(:stdout) { "044\r\n" }
142
- it { should be_readable.by('others') }
143
- end
144
-
145
- describe file('/dev') do
146
- let(:stdout) { "443\r\n" }
147
- it { should_not be_readable.by('others') }
148
- end
149
-
150
- describe file('/dev') do
151
- let(:stdout) { "755\r\n" }
152
- it { should be_writable }
153
- its(:command) { should eq "stat -f%Lp /dev" }
154
- end
155
-
156
- describe file('/dev') do
157
- let(:stdout) { "555\r\n" }
158
- it { should_not be_writable }
159
- end
160
-
161
- describe file('/dev') do
162
- let(:stdout) { "200\r\n" }
163
- it { should be_writable.by('owner') }
164
- end
165
-
166
- describe file('/dev') do
167
- let(:stdout) { "555\r\n" }
168
- it { should_not be_writable.by('owner') }
169
- end
170
-
171
- describe file('/dev') do
172
- let(:stdout) { "030\r\n" }
173
- it { should be_writable.by('group') }
174
- end
175
-
176
- describe file('/dev') do
177
- let(:stdout) { "555\r\n" }
178
- it { should_not be_writable.by('group') }
179
- end
180
-
181
- describe file('/dev') do
182
- let(:stdout) { "666\r\n" }
183
- it { should be_writable.by('others') }
184
- end
185
-
186
- describe file('/dev') do
187
- let(:stdout) { "555\r\n" }
188
- it { should_not be_writable.by('others') }
189
- end
190
-
191
- describe file('/dev') do
192
- let(:stdout) { "755\r\n" }
193
- it { should be_executable }
194
- end
195
-
196
- describe file('/dev') do
197
- let(:stdout) { "666\r\n" }
198
- it { should_not be_executable }
199
- end
200
-
201
- describe file('/dev') do
202
- let(:stdout) { "100\r\n" }
203
- it { should be_executable.by('owner') }
204
- end
205
-
206
- describe file('/dev') do
207
- let(:stdout) { "666\r\n" }
208
- it { should_not be_executable.by('owner') }
209
- end
210
-
211
- describe file('/dev') do
212
- let(:stdout) { "070\r\n" }
213
- it { should be_executable.by('group') }
214
- end
215
-
216
- describe file('/dev') do
217
- let(:stdout) { "666\r\n" }
218
- it { should_not be_executable.by('group') }
219
- end
220
-
221
- describe file('/dev') do
222
- let(:stdout) { "001\r\n" }
223
- it { should be_executable.by('others') }
224
- end
225
-
226
- describe file('/dev') do
227
- let(:stdout) { "666\r\n" }
228
- it { should_not be_executable.by('others') }
229
- end
230
-
231
- describe file('/') do
232
- it { should be_mounted }
233
- its(:command) { should eq "mount | grep -w -- on\\ /" }
234
- end
235
-
236
- describe file('/etc/invalid-mount') do
237
- it { should_not be_mounted }
238
- end
239
-
240
- describe file('/') do
241
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
242
- it { should be_mounted.with( :type => 'ext4' ) }
243
- end
244
-
245
- describe file('/') do
246
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
247
- it { should be_mounted.with( :type => 'ext4', :options => { :rw => true } ) }
248
- end
249
-
250
- describe file('/') do
251
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
252
- it { should be_mounted.with( :type => 'ext4', :options => { :mode => 620 } ) }
253
- end
254
-
255
- describe file('/') do
256
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
257
- it { should be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_root' ) }
258
- end
259
-
260
- describe file('/') do
261
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
262
- it { should_not be_mounted.with( :type => 'xfs' ) }
263
- end
264
-
265
- describe file('/') do
266
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
267
- it { should_not be_mounted.with( :type => 'ext4', :options => { :rw => false } ) }
268
- end
269
-
270
- describe file('/') do
271
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
272
- it { should_not be_mounted.with( :type => 'ext4', :options => { :mode => 600 } ) }
273
- end
274
-
275
- describe file('/') do
276
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
277
- it { should_not be_mounted.with( :type => 'xfs', :device => '/dev/mapper/VolGroup-lv_root' ) }
278
- end
279
-
280
- describe file('/') do
281
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
282
- it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
283
- end
284
-
285
- describe file('/etc/invalid-mount') do
286
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
287
- it { should_not be_mounted.with( :type => 'ext4' ) }
288
- end
289
-
290
- describe file('/') do
291
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
292
- it do
293
- should be_mounted.only_with(
294
- :device => '/dev/mapper/VolGroup-lv_root',
295
- :type => 'ext4',
296
- :options => {
297
- :rw => true,
298
- :mode => 620,
299
- }
300
- )
301
- end
302
- end
303
-
304
- describe file('/') do
305
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
306
- it do
307
- should_not be_mounted.only_with(
308
- :device => '/dev/mapper/VolGroup-lv_root',
309
- :type => 'ext4',
310
- :options => {
311
- :rw => true,
312
- :mode => 620,
313
- :bind => true,
314
- }
315
- )
316
- end
317
- end
318
-
319
- describe file('/') do
320
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
321
- it do
322
- should_not be_mounted.only_with(
323
- :device => '/dev/mapper/VolGroup-lv_root',
324
- :type => 'ext4',
325
- :options => {
326
- :rw => true,
327
- }
328
- )
329
- end
330
- end
331
-
332
- describe file('/') do
333
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
334
- it do
335
- should_not be_mounted.only_with(
336
- :device => '/dev/mapper/VolGroup-lv_roooooooooot',
337
- :type => 'ext4',
338
- :options => {
339
- :rw => true,
340
- :mode => 620,
341
- }
342
- )
343
- end
344
- end
345
-
346
- describe file('/etc/invalid-mount') do
347
- let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
348
- it { should_not be_mounted.only_with( :type => 'ext4' ) }
349
- end
350
-
351
- describe file('/etc/services') do
352
- it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
353
- its(:command) { should eq "md5sum /etc/services | grep -iw -- \\^35435ea447c19f0ea5ef971837ab9ced" }
354
- end
355
-
356
- describe file('invalid-file') do
357
- it { should_not match_md5checksum 'INVALIDMD5CHECKSUM' }
358
- end
359
-
360
- describe file('/etc/services') do
361
- it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
362
- its(:command) { should eq "sha256sum /etc/services | grep -iw -- \\^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a" }
363
- end
364
-
365
- describe file('invalid-file') do
366
- it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
367
- end
368
-
369
- describe file('/etc/passwd') do
370
- let(:stdout) {<<EOF
371
- root:x:0:0:root:/root:/bin/bash
372
- bin:x:1:1:bin:/bin:/sbin/nologin
373
- daemon:x:2:2:daemon:/sbin:/sbin/nologin
374
- sync:x:5:0:sync:/sbin:/bin/sync
375
- shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
376
- halt:x:7:0:halt:/sbin:/sbin/halt
377
- mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
378
- operator:x:11:0:operator:/root:/sbin/nologin
379
- nobody:x:99:99:Nobody:/:/sbin/nologin
380
- dbus:x:81:81:System message bus:/:/sbin/nologin
381
- EOF
382
- }
383
-
384
- its(:content) { should match /root:x:0:0/ }
385
- end