serverspec-cem-acpt 2.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. checksums.yaml +7 -0
  2. data/.github/stale.yml +18 -0
  3. data/.gitignore +28 -0
  4. data/.gitmodules +3 -0
  5. data/.travis.yml +25 -0
  6. data/Gemfile +9 -0
  7. data/Guardfile +4 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +36 -0
  10. data/Rakefile +31 -0
  11. data/WINDOWS_SUPPORT.md +131 -0
  12. data/appveyor.yml +70 -0
  13. data/bin/serverspec-init +7 -0
  14. data/lib/serverspec/commands/base.rb +7 -0
  15. data/lib/serverspec/helper/type.rb +25 -0
  16. data/lib/serverspec/helper.rb +8 -0
  17. data/lib/serverspec/matcher/be_enabled.rb +24 -0
  18. data/lib/serverspec/matcher/be_enforcing.rb +10 -0
  19. data/lib/serverspec/matcher/be_executable.rb +13 -0
  20. data/lib/serverspec/matcher/be_installed.rb +24 -0
  21. data/lib/serverspec/matcher/be_listening.rb +20 -0
  22. data/lib/serverspec/matcher/be_monitored_by.rb +17 -0
  23. data/lib/serverspec/matcher/be_mounted.rb +15 -0
  24. data/lib/serverspec/matcher/be_permissive.rb +10 -0
  25. data/lib/serverspec/matcher/be_reachable.rb +17 -0
  26. data/lib/serverspec/matcher/be_readable.rb +13 -0
  27. data/lib/serverspec/matcher/be_resolvable.rb +9 -0
  28. data/lib/serverspec/matcher/be_running.rb +19 -0
  29. data/lib/serverspec/matcher/be_writable.rb +13 -0
  30. data/lib/serverspec/matcher/belong_to_group.rb +5 -0
  31. data/lib/serverspec/matcher/belong_to_primary_group.rb +5 -0
  32. data/lib/serverspec/matcher/contain.rb +28 -0
  33. data/lib/serverspec/matcher/have_entry.rb +14 -0
  34. data/lib/serverspec/matcher/have_rule.rb +25 -0
  35. data/lib/serverspec/matcher/have_site_application.rb +18 -0
  36. data/lib/serverspec/matcher/have_site_bindings.rb +22 -0
  37. data/lib/serverspec/matcher/have_virtual_dir.rb +14 -0
  38. data/lib/serverspec/matcher.rb +40 -0
  39. data/lib/serverspec/power_assert.rb +14 -0
  40. data/lib/serverspec/setup.rb +351 -0
  41. data/lib/serverspec/subject.rb +12 -0
  42. data/lib/serverspec/type/base.rb +31 -0
  43. data/lib/serverspec/type/bond.rb +11 -0
  44. data/lib/serverspec/type/bridge.rb +11 -0
  45. data/lib/serverspec/type/cgroup.rb +17 -0
  46. data/lib/serverspec/type/command.rb +31 -0
  47. data/lib/serverspec/type/cron.rb +15 -0
  48. data/lib/serverspec/type/default_gateway.rb +15 -0
  49. data/lib/serverspec/type/docker_base.rb +27 -0
  50. data/lib/serverspec/type/docker_container.rb +27 -0
  51. data/lib/serverspec/type/docker_image.rb +4 -0
  52. data/lib/serverspec/type/file.rb +161 -0
  53. data/lib/serverspec/type/fstab.rb +11 -0
  54. data/lib/serverspec/type/group.rb +15 -0
  55. data/lib/serverspec/type/hadoop_config.rb +27 -0
  56. data/lib/serverspec/type/host.rb +21 -0
  57. data/lib/serverspec/type/iis_app_pool.rb +43 -0
  58. data/lib/serverspec/type/iis_website.rb +40 -0
  59. data/lib/serverspec/type/interface.rb +47 -0
  60. data/lib/serverspec/type/ip6tables.rb +13 -0
  61. data/lib/serverspec/type/ipfilter.rb +11 -0
  62. data/lib/serverspec/type/ipnat.rb +11 -0
  63. data/lib/serverspec/type/iptables.rb +11 -0
  64. data/lib/serverspec/type/json_file.rb +9 -0
  65. data/lib/serverspec/type/kernel_module.rb +7 -0
  66. data/lib/serverspec/type/kvm.rb +19 -0
  67. data/lib/serverspec/type/linux_audit_system.rb +45 -0
  68. data/lib/serverspec/type/linux_kernel_parameter.rb +10 -0
  69. data/lib/serverspec/type/lxc.rb +15 -0
  70. data/lib/serverspec/type/mail_alias.rb +7 -0
  71. data/lib/serverspec/type/mysql_config.rb +10 -0
  72. data/lib/serverspec/type/package.rb +66 -0
  73. data/lib/serverspec/type/php_config.rb +12 -0
  74. data/lib/serverspec/type/php_extension.rb +11 -0
  75. data/lib/serverspec/type/port.rb +40 -0
  76. data/lib/serverspec/type/ppa.rb +11 -0
  77. data/lib/serverspec/type/process.rb +31 -0
  78. data/lib/serverspec/type/routing_table.rb +11 -0
  79. data/lib/serverspec/type/selinux.rb +19 -0
  80. data/lib/serverspec/type/selinux_module.rb +15 -0
  81. data/lib/serverspec/type/service.rb +57 -0
  82. data/lib/serverspec/type/user.rb +47 -0
  83. data/lib/serverspec/type/windows_feature.rb +7 -0
  84. data/lib/serverspec/type/windows_firewall.rb +28 -0
  85. data/lib/serverspec/type/windows_hot_fix.rb +7 -0
  86. data/lib/serverspec/type/windows_registry_key.rb +19 -0
  87. data/lib/serverspec/type/windows_scheduled_task.rb +7 -0
  88. data/lib/serverspec/type/x509_certificate.rb +92 -0
  89. data/lib/serverspec/type/x509_private_key.rb +20 -0
  90. data/lib/serverspec/type/yumrepo.rb +11 -0
  91. data/lib/serverspec/type/zfs.rb +29 -0
  92. data/lib/serverspec/version.rb +3 -0
  93. data/lib/serverspec.rb +61 -0
  94. data/serverspec.gemspec +27 -0
  95. data/spec/helper/type_spec.rb +6 -0
  96. data/spec/spec_helper.rb +28 -0
  97. data/spec/type/aix/file_spec.rb +27 -0
  98. data/spec/type/aix/group_spec.rb +7 -0
  99. data/spec/type/aix/package_spec.rb +7 -0
  100. data/spec/type/aix/port_spec.rb +20 -0
  101. data/spec/type/aix/service_spec.rb +12 -0
  102. data/spec/type/aix/user_spec.rb +16 -0
  103. data/spec/type/arch/file_spec.rb +15 -0
  104. data/spec/type/arch/package_spec.rb +19 -0
  105. data/spec/type/arch/service_spec.rb +9 -0
  106. data/spec/type/base/command_spec.rb +106 -0
  107. data/spec/type/base/cron_spec.rb +11 -0
  108. data/spec/type/base/default_gateway_spec.rb +11 -0
  109. data/spec/type/base/file_spec.rb +418 -0
  110. data/spec/type/base/group_spec.rb +16 -0
  111. data/spec/type/base/host_spec.rb +47 -0
  112. data/spec/type/base/json_file_spec.rb +27 -0
  113. data/spec/type/base/mail_alias_spec.rb +7 -0
  114. data/spec/type/base/mysql_config_spec.rb +13 -0
  115. data/spec/type/base/package_spec.rb +51 -0
  116. data/spec/type/base/php_config_spec.rb +37 -0
  117. data/spec/type/base/php_extension_spec.rb +13 -0
  118. data/spec/type/base/port_spec.rb +34 -0
  119. data/spec/type/base/process_spec.rb +35 -0
  120. data/spec/type/base/routing_table_spec.rb +63 -0
  121. data/spec/type/base/service_spec.rb +54 -0
  122. data/spec/type/base/user_spec.rb +49 -0
  123. data/spec/type/darwin/file_spec.rb +41 -0
  124. data/spec/type/darwin/package_spec.rb +19 -0
  125. data/spec/type/darwin/port_spec.rb +27 -0
  126. data/spec/type/darwin/service_spec.rb +16 -0
  127. data/spec/type/debian/package_spec.rb +23 -0
  128. data/spec/type/debian/service_spec.rb +11 -0
  129. data/spec/type/fedora/service_spec.rb +15 -0
  130. data/spec/type/fedora15/service_spec.rb +15 -0
  131. data/spec/type/fedora20/service_spec.rb +15 -0
  132. data/spec/type/freebsd/file_spec.rb +29 -0
  133. data/spec/type/freebsd/package_spec.rb +19 -0
  134. data/spec/type/freebsd/port_spec.rb +27 -0
  135. data/spec/type/freebsd/service_spec.rb +8 -0
  136. data/spec/type/freebsd10/package_spec.rb +19 -0
  137. data/spec/type/gentoo/package_spec.rb +7 -0
  138. data/spec/type/gentoo/service_spec.rb +12 -0
  139. data/spec/type/linux/bond_spec.rb +12 -0
  140. data/spec/type/linux/bridge_spec.rb +12 -0
  141. data/spec/type/linux/cgroup_spec.rb +13 -0
  142. data/spec/type/linux/docker_container_pre_1_8_spec.rb +124 -0
  143. data/spec/type/linux/docker_container_spec.rb +131 -0
  144. data/spec/type/linux/docker_image_spec.rb +94 -0
  145. data/spec/type/linux/file_spec.rb +27 -0
  146. data/spec/type/linux/fstab_spec.rb +31 -0
  147. data/spec/type/linux/interface_spec.rb +50 -0
  148. data/spec/type/linux/ip6tables_spec.rb +19 -0
  149. data/spec/type/linux/iptables_spec.rb +11 -0
  150. data/spec/type/linux/kernel_module_spec.rb +7 -0
  151. data/spec/type/linux/kvm_guest_spec.rb +15 -0
  152. data/spec/type/linux/linux_audit_system_spec.rb +139 -0
  153. data/spec/type/linux/linux_kernel_parameter_spec.rb +33 -0
  154. data/spec/type/linux/lxc_container_spec.rb +12 -0
  155. data/spec/type/linux/selinux_module_spec.rb +15 -0
  156. data/spec/type/linux/selinux_spec.rb +23 -0
  157. data/spec/type/linux/x509_certificate_spec.rb +100 -0
  158. data/spec/type/linux/x509_private_key_spec.rb +31 -0
  159. data/spec/type/linux/zfs_spec.rb +15 -0
  160. data/spec/type/nixos/package_spec.rb +15 -0
  161. data/spec/type/nixos/service_spec.rb +9 -0
  162. data/spec/type/openbsd/file_spec.rb +134 -0
  163. data/spec/type/openbsd/interface_spec.rb +31 -0
  164. data/spec/type/openbsd/mail_alias_spec.rb +7 -0
  165. data/spec/type/openbsd/package_spec.rb +11 -0
  166. data/spec/type/openbsd/port_spec.rb +7 -0
  167. data/spec/type/openbsd/service_spec.rb +13 -0
  168. data/spec/type/openbsd/user_spec.rb +12 -0
  169. data/spec/type/opensuse/service_spec.rb +16 -0
  170. data/spec/type/plamo/package_spec.rb +8 -0
  171. data/spec/type/plamo/service_spec.rb +8 -0
  172. data/spec/type/redhat/file_spec.rb +19 -0
  173. data/spec/type/redhat/package_spec.rb +23 -0
  174. data/spec/type/redhat/service_spec.rb +11 -0
  175. data/spec/type/redhat/yumrepo_spec.rb +11 -0
  176. data/spec/type/redhat5/iptables_spec.rb +11 -0
  177. data/spec/type/redhat7/service_spec.rb +9 -0
  178. data/spec/type/smartos/package_spec.rb +19 -0
  179. data/spec/type/smartos/service_spec.rb +16 -0
  180. data/spec/type/solaris/cron_spec.rb +11 -0
  181. data/spec/type/solaris/file_spec.rb +15 -0
  182. data/spec/type/solaris/group_spec.rb +7 -0
  183. data/spec/type/solaris/host_spec.rb +19 -0
  184. data/spec/type/solaris/ipfilter_spec.rb +7 -0
  185. data/spec/type/solaris/ipnat_spec.rb +7 -0
  186. data/spec/type/solaris/package_spec.rb +7 -0
  187. data/spec/type/solaris/port_spec.rb +34 -0
  188. data/spec/type/solaris/service_spec.rb +16 -0
  189. data/spec/type/solaris/user_spec.rb +16 -0
  190. data/spec/type/solaris/zfs_spec.rb +15 -0
  191. data/spec/type/solaris10/file_spec.rb +313 -0
  192. data/spec/type/solaris10/group_spec.rb +8 -0
  193. data/spec/type/solaris10/host_spec.rb +16 -0
  194. data/spec/type/solaris10/package_spec.rb +8 -0
  195. data/spec/type/solaris10/user_spec.rb +8 -0
  196. data/spec/type/suse/package_spec.rb +23 -0
  197. data/spec/type/suse/service_spec.rb +11 -0
  198. data/spec/type/ubuntu/ppa_spec.rb +11 -0
  199. data/spec/type/ubuntu/service_spec.rb +7 -0
  200. data/spec/type/windows/command_spec.rb +64 -0
  201. data/spec/type/windows/feature_spec.rb +17 -0
  202. data/spec/type/windows/file_spec.rb +127 -0
  203. data/spec/type/windows/group_spec.rb +23 -0
  204. data/spec/type/windows/host_spec.rb +32 -0
  205. data/spec/type/windows/hot_fix_spec.rb +22 -0
  206. data/spec/type/windows/iis_app_pool_spec.rb +17 -0
  207. data/spec/type/windows/iis_webisite_spec.rb +16 -0
  208. data/spec/type/windows/package_spec.rb +10 -0
  209. data/spec/type/windows/port_spec.rb +25 -0
  210. data/spec/type/windows/registry_key_spec.rb +58 -0
  211. data/spec/type/windows/scheduled_task_spec.rb +9 -0
  212. data/spec/type/windows/service_spec.rb +30 -0
  213. data/spec/type/windows/user_spec.rb +33 -0
  214. data/wercker.yml +13 -0
  215. metadata +446 -0
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, :family => 'ubuntu'
4
+
5
+ describe service('sshd') do
6
+ it { should be_running }
7
+ end
@@ -0,0 +1,64 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+ set :os, :family => 'windows'
5
+
6
+ describe command('test_cmd /test/path/file') do
7
+ let(:stdout) { "test output 1.2.3\r\n" }
8
+ its(:stdout) { should match /test output 1.2.3/ }
9
+ end
10
+
11
+ describe 'complete matching of stdout' do
12
+ context command('test_cmd /test/path/file') do
13
+ let(:stdout) { "foocontent-should-be-includedbar\r\n" }
14
+ its(:stdout) { should_not eq 'content-should-be-included' }
15
+ end
16
+ end
17
+
18
+ describe 'regexp matching of stdout' do
19
+ context command('test_cmd /test/path/file') do
20
+ let(:stdout) { "test output 1.2.3\r\n" }
21
+ its(:stdout) { should match /1\.2\.3/ }
22
+ end
23
+ end
24
+
25
+ describe command('test_cmd /test/path/file') do
26
+ let(:stderr) { "No such file or directory\r\n" }
27
+ its(:stderr) { should match /No such file or directory/ }
28
+ end
29
+
30
+ describe 'complete matching of stderr' do
31
+ context command('test_cmd /test/path/file') do
32
+ let(:stderr) { "No such file or directory\r\n" }
33
+ its(:stderr) { should_not eq 'file' }
34
+ end
35
+ end
36
+
37
+ describe 'regexp matching of stderr' do
38
+ context command('test_cmd /test/path/file') do
39
+ let(:stderr) { "No such file or directory\r\n" }
40
+ its(:stderr) { should match /file/ }
41
+ end
42
+ end
43
+
44
+ describe command('test_cmd /test/path/file') do
45
+ its(:exit_status) { should eq 0 }
46
+ end
47
+
48
+ describe command('dir "c:\"') do
49
+ let(:stdout) { <<EOF
50
+ Directory: C:\
51
+
52
+ Mode LastWriteTime Length Name
53
+ ---- ------------- ------ ----
54
+ d-r-- 23/09/2013 10:46 AM Program Files
55
+ d-r-- 23/09/2013 1:21 PM Program Files (x86)
56
+ d---- 17/10/2013 8:46 PM temp
57
+ d-r-- 23/09/2013 11:52 AM Users
58
+ d---- 23/09/2013 1:21 PM Windows
59
+ EOF
60
+ }
61
+
62
+ its(:stdout) { should match /Program Files/ }
63
+ its(:stdout) { should eq stdout }
64
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe windows_feature('Minesweeper') do
8
+ it{ should be_installed }
9
+ end
10
+
11
+ describe windows_feature('IIS-Webserver') do
12
+ it{ should be_installed.by(:dism) }
13
+ end
14
+
15
+ describe windows_feature('Web-Webserver') do
16
+ it{ should be_installed.by(:powershell) }
17
+ end
@@ -0,0 +1,127 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe file('/some/valid/file') do
8
+ it { should be_file }
9
+ end
10
+
11
+ describe file('/some/valid/folder') do
12
+ it { should be_directory }
13
+ end
14
+
15
+ describe file('/some/file') do
16
+ it { should contain 'search text' }
17
+ end
18
+
19
+ describe file('/some/file') do
20
+ it { should contain /^search text/ }
21
+ end
22
+
23
+ describe file('Gemfile') do
24
+ it { should contain('rspec').from(/^group :test do/).to(/^end/) }
25
+ end
26
+
27
+ describe file('Gemfile') do
28
+ it { should contain('rspec').after(/^group :test do/) }
29
+ end
30
+
31
+ describe file('Gemfile') do
32
+ it { should contain('rspec').before(/end/) }
33
+ end
34
+
35
+ describe file('/some/file') do
36
+ it { should be_readable }
37
+ end
38
+
39
+ describe file('/some/file') do
40
+ it "should raise error if trying to check access by 'owner' or 'group' or 'others'" do
41
+ ['owner', 'group', 'others'].each do |access|
42
+ expect { should be_readable.by(access) }.to raise_error(RuntimeError)
43
+ end
44
+ end
45
+ end
46
+
47
+ describe file('/some/file') do
48
+ it { should be_readable.by('test.identity') }
49
+ end
50
+
51
+ describe file('/some/file') do
52
+ it { should be_readable.by_user('test.identity') }
53
+ end
54
+
55
+ describe file('/some/file') do
56
+ it { should be_writable }
57
+ end
58
+
59
+ describe file('/some/file') do
60
+ it "should raise error if trying to check access by 'owner' or 'group' or 'others'" do
61
+ ['owner', 'group', 'others'].each do |access|
62
+ expect { should be_writable.by(access) }.to raise_error(RuntimeError)
63
+ end
64
+ end
65
+ end
66
+
67
+ describe file('/some/file') do
68
+ it { should be_writable.by('test.identity') }
69
+ end
70
+
71
+ describe file('/some/file') do
72
+ it { should be_writable.by_user('test.identity') }
73
+ end
74
+
75
+ describe file('/some/file') do
76
+ it { should be_executable }
77
+ end
78
+
79
+ describe file('/some/file') do
80
+ it "should raise error if trying to check access by 'owner' or 'group' or 'others'" do
81
+ ['owner', 'group', 'others'].each do |access|
82
+ expect { should be_executable.by(access) }.to raise_error(RuntimeError)
83
+ end
84
+ end
85
+ end
86
+
87
+ describe file('/some/file') do
88
+ it { should be_executable.by('test.identity') }
89
+ end
90
+
91
+ describe file('/some/file') do
92
+ it { should be_executable.by_user('test.identity') }
93
+ end
94
+
95
+ describe file('/some/file') do
96
+ it { should be_version 1 }
97
+ end
98
+
99
+ describe file('/some/test/file') do
100
+ it "should raise error if command is not implemented" do
101
+ {
102
+ :be_socket => [],
103
+ :be_mode => 644,
104
+ :be_grouped_into => 'root',
105
+ :be_linked_to => '/some/other/file',
106
+ :be_mounted => []
107
+ }.each do |method, args|
108
+ expect { should self.send(method, *args) }.to raise_error(NotImplementedError)
109
+ end
110
+ end
111
+
112
+ it "should raise error if command is not defined" do
113
+ {
114
+ :match_md5checksum => '35435ea447c19f0ea5ef971837ab9ced',
115
+ :match_sha256checksum => '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a'
116
+ }.each do |method, args|
117
+ expect { should self.send(method, *args) }.to raise_error(NoMethodError)
118
+ end
119
+ end
120
+ end
121
+
122
+
123
+
124
+
125
+
126
+
127
+
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe group('test.group') do
8
+ it { should exist }
9
+ end
10
+
11
+ describe group('test.domain\test.group') do
12
+ it { should exist }
13
+ end
14
+
15
+ describe group('test.group') do
16
+ it "should raise error if command is not supported" do
17
+ {
18
+ :have_gid => [nil],
19
+ }.each do |method, args|
20
+ expect { should self.send(method, *args) }.to raise_error(NotImplementedError)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+ set :os, :family => 'windows'
5
+
6
+ describe host('127.0.0.1') do
7
+ it { should be_resolvable }
8
+ end
9
+
10
+ describe host('127.0.0.1') do
11
+ it { should be_resolvable.by('hosts') }
12
+ end
13
+
14
+ describe host('127.0.0.1') do
15
+ it { should be_resolvable.by('dns') }
16
+ end
17
+
18
+ describe host('127.0.0.1') do
19
+ it { should be_reachable }
20
+ end
21
+
22
+ describe host('127.0.0.1') do
23
+ it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
24
+ end
25
+
26
+ describe host('127.0.0.1') do
27
+ it { should be_reachable.with(:proto => "tcp", :port => 22, :timeout=> 1) }
28
+ end
29
+
30
+ describe host('127.0.0.1') do
31
+ it { should be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
32
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe windows_hot_fix('DESCRIPTION-OR-KB-ID') do
8
+ it { should be_installed }
9
+ end
10
+
11
+ describe windows_hot_fix('DESCRIPTION') do
12
+ it { should be_installed.with_version('KB-ID') }
13
+ end
14
+
15
+ describe windows_hot_fix('DESCRIPTION_WITH_KB123456789_INLINED') do
16
+ it { should be_installed }
17
+ end
18
+
19
+ describe windows_hot_fix('DESCRIPTION_WITH_SUFFIX_KB123456789') do
20
+ it { should be_installed }
21
+ end
22
+
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe iis_app_pool('Default App Pool') do
8
+ it { should exist }
9
+ it { should have_dotnet_version('2.0') }
10
+ it { should have_32bit_enabled }
11
+ it { should have_idle_timeout(5) }
12
+ it { should have_identity_type('foo') }
13
+ it { should have_periodic_restart(60) }
14
+ it { should have_user_profile_enabled }
15
+ it { should have_username('user') }
16
+ it { should have_managed_pipeline_mode('mode') }
17
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe iis_website('Default Website') do
8
+ it { should exist }
9
+ it { should be_enabled }
10
+ it { should be_running }
11
+ it { should be_in_app_pool('Default App Pool') }
12
+ it { should have_physical_path('C:\\inetpub\\www') }
13
+ it { should have_site_bindings('port').with_protocol('protocol').with_ipaddress('ipaddress').with_host_header('host_header') }
14
+ it { should have_virtual_dir('vdir').with_path('path') }
15
+ it { should have_site_application('app').with_pool('pool').with_physical_path('physical_path') }
16
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe package('foo') do
8
+ it { should be_installed }
9
+ end
10
+
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe port(80) do
8
+ it { should be_listening }
9
+ end
10
+
11
+ describe port(80) do
12
+ it { should be_listening.with("tcp") }
13
+ end
14
+
15
+ describe port(123) do
16
+ it { should be_listening.with("udp") }
17
+ end
18
+
19
+ describe port(80) do
20
+ it {
21
+ expect {
22
+ should be_listening.with('not implemented')
23
+ }.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
24
+ }
25
+ end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+ set :os, :family => 'windows'
5
+
6
+ describe windows_registry_key('PATH/TO/THE_KEY') do
7
+ it { should exist }
8
+ end
9
+
10
+ describe windows_registry_key('PATH/TO/THE_KEY') do
11
+ it { should have_value('Test Value') }
12
+ end
13
+
14
+ describe 'Key value types' do
15
+ context 'default type' do
16
+ describe windows_registry_key('PATH/TO/THE_KEY') do
17
+ it { should have_property('TestProperty') }
18
+ end
19
+ end
20
+
21
+ {
22
+ :type_string => 'String',
23
+ :type_binary => 'Binary',
24
+ :type_dword => 'DWord',
25
+ :type_qword => 'QWord',
26
+ :type_multistring => 'MultiString',
27
+ :type_expandstring => 'ExpandString'
28
+ }.each do |sym, type|
29
+ context "type #{type}" do
30
+ describe windows_registry_key('PATH/TO/THE_KEY') do
31
+ it { should have_property('TestProperty', sym) }
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ describe windows_registry_key('PATH/TO/THE_KEY') do
38
+ it { should have_property_value('TestProperty', :type_binary, '12a07b') }
39
+ end
40
+
41
+ describe windows_registry_key('PATH/TO/THE_KEY') do
42
+ it { should have_property_value('TestProperty', :type_dword, 'fffffd6c') }
43
+ end
44
+
45
+ describe windows_registry_key('PATH/TO/THE_KEY') do
46
+ it { should have_property_value('TestProperty', :type_qword, '1e240') }
47
+ end
48
+
49
+ describe windows_registry_key('PATH/TO/THE_KEY') do
50
+ it {
51
+ value = <<-EOF
52
+ test line1
53
+ test line2
54
+ test line3
55
+ EOF
56
+ should have_property_value('TestProperty', :type_multistring, value)
57
+ }
58
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe windows_scheduled_task('foo') do
8
+ it { should exist }
9
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe service('Test Service') do
8
+ it { should be_enabled }
9
+ end
10
+
11
+ describe service('Test Service') do
12
+ it { should be_running }
13
+ end
14
+
15
+ describe service('service') do
16
+ it { should be_installed }
17
+ end
18
+
19
+ describe service('service') do
20
+ it { should have_start_mode 'mode' }
21
+ end
22
+
23
+ describe service('Test service') do
24
+ it "should raise error if trying to check service process controller" do
25
+ expect { should be_running.under('supervisor') }.to raise_error(NotImplementedError)
26
+ end
27
+ it "should raise error if trying to check service monitoring" do
28
+ expect { should_not be_monitored_by('monit') }.to raise_error(NotImplementedError)
29
+ end
30
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ set :backend, :cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe user('test.user') do
8
+ it { should exist }
9
+ end
10
+
11
+ describe user('test.domain\test.user') do
12
+ it { should exist }
13
+ end
14
+
15
+ describe user('test.user') do
16
+ it { should belong_to_group 'test.group' }
17
+ end
18
+
19
+ describe user('test.user.domain\test.user') do
20
+ it { should belong_to_group 'test.group.domain\test.group' }
21
+ end
22
+
23
+ describe user('test.user') do
24
+ it "should raise error if command is not supported" do
25
+ {
26
+ :have_uid => [nil],
27
+ :have_login_shell => [nil],
28
+ :have_authorized_key => [nil],
29
+ }.each do |method, args|
30
+ expect { should self.send(method, *args) }.to raise_error(NotImplementedError)
31
+ end
32
+ end
33
+ end
data/wercker.yml ADDED
@@ -0,0 +1,13 @@
1
+ build:
2
+ box:
3
+ id: mizzy/wercker-serverspec
4
+ steps:
5
+ - script:
6
+ name: initialize git submodules
7
+ code: git submodule update --init --recursive
8
+ - script:
9
+ name: Run walter
10
+ code: ./$WORKING_DIR/walter -config ./$WORKING_DIR/pipeline.yml -build
11
+ after-steps:
12
+ - wantedly/pretty-slack-notify:
13
+ webhook_url: $SLACK_WEBHOOK_URL