serverspec-ruby19 2.24.3

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 (205) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +8 -0
  6. data/Guardfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +26 -0
  9. data/Rakefile +30 -0
  10. data/WINDOWS_SUPPORT.md +118 -0
  11. data/appveyor.yml +56 -0
  12. data/bin/serverspec-init +7 -0
  13. data/lib/serverspec.rb +63 -0
  14. data/lib/serverspec/commands/base.rb +7 -0
  15. data/lib/serverspec/helper.rb +8 -0
  16. data/lib/serverspec/helper/type.rb +26 -0
  17. data/lib/serverspec/matcher.rb +39 -0
  18. data/lib/serverspec/matcher/be_enabled.rb +13 -0
  19. data/lib/serverspec/matcher/be_enforcing.rb +10 -0
  20. data/lib/serverspec/matcher/be_executable.rb +13 -0
  21. data/lib/serverspec/matcher/be_installed.rb +13 -0
  22. data/lib/serverspec/matcher/be_listening.rb +13 -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 +13 -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 +17 -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/power_assert.rb +14 -0
  39. data/lib/serverspec/setup.rb +338 -0
  40. data/lib/serverspec/subject.rb +12 -0
  41. data/lib/serverspec/type/base.rb +30 -0
  42. data/lib/serverspec/type/bond.rb +11 -0
  43. data/lib/serverspec/type/bridge.rb +11 -0
  44. data/lib/serverspec/type/cgroup.rb +17 -0
  45. data/lib/serverspec/type/command.rb +20 -0
  46. data/lib/serverspec/type/cron.rb +15 -0
  47. data/lib/serverspec/type/default_gateway.rb +15 -0
  48. data/lib/serverspec/type/docker_base.rb +29 -0
  49. data/lib/serverspec/type/docker_container.rb +27 -0
  50. data/lib/serverspec/type/docker_image.rb +4 -0
  51. data/lib/serverspec/type/file.rb +133 -0
  52. data/lib/serverspec/type/fstab.rb +11 -0
  53. data/lib/serverspec/type/group.rb +11 -0
  54. data/lib/serverspec/type/host.rb +21 -0
  55. data/lib/serverspec/type/iis_app_pool.rb +43 -0
  56. data/lib/serverspec/type/iis_website.rb +40 -0
  57. data/lib/serverspec/type/interface.rb +27 -0
  58. data/lib/serverspec/type/ip6tables.rb +13 -0
  59. data/lib/serverspec/type/ipfilter.rb +11 -0
  60. data/lib/serverspec/type/ipnat.rb +11 -0
  61. data/lib/serverspec/type/iptables.rb +11 -0
  62. data/lib/serverspec/type/kernel_module.rb +7 -0
  63. data/lib/serverspec/type/linux_audit_system.rb +45 -0
  64. data/lib/serverspec/type/linux_kernel_parameter.rb +10 -0
  65. data/lib/serverspec/type/lxc.rb +15 -0
  66. data/lib/serverspec/type/mail_alias.rb +7 -0
  67. data/lib/serverspec/type/mysql_config.rb +10 -0
  68. data/lib/serverspec/type/package.rb +66 -0
  69. data/lib/serverspec/type/php_config.rb +10 -0
  70. data/lib/serverspec/type/port.rb +40 -0
  71. data/lib/serverspec/type/ppa.rb +11 -0
  72. data/lib/serverspec/type/process.rb +27 -0
  73. data/lib/serverspec/type/routing_table.rb +11 -0
  74. data/lib/serverspec/type/selinux.rb +19 -0
  75. data/lib/serverspec/type/selinux_module.rb +11 -0
  76. data/lib/serverspec/type/service.rb +52 -0
  77. data/lib/serverspec/type/user.rb +43 -0
  78. data/lib/serverspec/type/windows_feature.rb +7 -0
  79. data/lib/serverspec/type/windows_hot_fix.rb +7 -0
  80. data/lib/serverspec/type/windows_registry_key.rb +19 -0
  81. data/lib/serverspec/type/windows_scheduled_task.rb +7 -0
  82. data/lib/serverspec/type/x509_certificate.rb +76 -0
  83. data/lib/serverspec/type/x509_private_key.rb +21 -0
  84. data/lib/serverspec/type/yumrepo.rb +11 -0
  85. data/lib/serverspec/type/zfs.rb +29 -0
  86. data/lib/serverspec/version.rb +3 -0
  87. data/serverspec.gemspec +28 -0
  88. data/spec/helper/type_spec.rb +6 -0
  89. data/spec/spec_helper.rb +28 -0
  90. data/spec/type/aix/file_spec.rb +31 -0
  91. data/spec/type/aix/group_spec.rb +7 -0
  92. data/spec/type/aix/package_spec.rb +7 -0
  93. data/spec/type/aix/port_spec.rb +20 -0
  94. data/spec/type/aix/service_spec.rb +12 -0
  95. data/spec/type/aix/user_spec.rb +16 -0
  96. data/spec/type/arch/file_spec.rb +15 -0
  97. data/spec/type/arch/package_spec.rb +19 -0
  98. data/spec/type/arch/service_spec.rb +9 -0
  99. data/spec/type/base/command_spec.rb +67 -0
  100. data/spec/type/base/cron_spec.rb +11 -0
  101. data/spec/type/base/default_gateway_spec.rb +11 -0
  102. data/spec/type/base/file_spec.rb +356 -0
  103. data/spec/type/base/group_spec.rb +11 -0
  104. data/spec/type/base/host_spec.rb +47 -0
  105. data/spec/type/base/mail_alias_spec.rb +7 -0
  106. data/spec/type/base/mysql_config_spec.rb +13 -0
  107. data/spec/type/base/package_spec.rb +51 -0
  108. data/spec/type/base/php_config_spec.rb +33 -0
  109. data/spec/type/base/port_spec.rb +34 -0
  110. data/spec/type/base/process_spec.rb +35 -0
  111. data/spec/type/base/routing_table_spec.rb +63 -0
  112. data/spec/type/base/service_spec.rb +49 -0
  113. data/spec/type/base/user_spec.rb +44 -0
  114. data/spec/type/darwin/file_spec.rb +41 -0
  115. data/spec/type/darwin/package_spec.rb +19 -0
  116. data/spec/type/darwin/port_spec.rb +27 -0
  117. data/spec/type/darwin/service_spec.rb +16 -0
  118. data/spec/type/debian/package_spec.rb +23 -0
  119. data/spec/type/debian/service_spec.rb +11 -0
  120. data/spec/type/fedora/service_spec.rb +15 -0
  121. data/spec/type/fedora15/service_spec.rb +15 -0
  122. data/spec/type/fedora20/service_spec.rb +15 -0
  123. data/spec/type/freebsd/file_spec.rb +29 -0
  124. data/spec/type/freebsd/package_spec.rb +19 -0
  125. data/spec/type/freebsd/port_spec.rb +27 -0
  126. data/spec/type/freebsd/service_spec.rb +8 -0
  127. data/spec/type/freebsd10/package_spec.rb +19 -0
  128. data/spec/type/gentoo/package_spec.rb +7 -0
  129. data/spec/type/gentoo/service_spec.rb +12 -0
  130. data/spec/type/linux/bond_spec.rb +12 -0
  131. data/spec/type/linux/bridge_spec.rb +12 -0
  132. data/spec/type/linux/cgroup_spec.rb +13 -0
  133. data/spec/type/linux/docker_container_pre_1_8_spec.rb +124 -0
  134. data/spec/type/linux/docker_container_spec.rb +126 -0
  135. data/spec/type/linux/docker_image_spec.rb +94 -0
  136. data/spec/type/linux/file_spec.rb +27 -0
  137. data/spec/type/linux/fstab_spec.rb +31 -0
  138. data/spec/type/linux/interface_spec.rb +30 -0
  139. data/spec/type/linux/ip6tables_spec.rb +19 -0
  140. data/spec/type/linux/iptables_spec.rb +11 -0
  141. data/spec/type/linux/kernel_module_spec.rb +7 -0
  142. data/spec/type/linux/linux_audit_system_spec.rb +139 -0
  143. data/spec/type/linux/linux_kernel_parameter_spec.rb +33 -0
  144. data/spec/type/linux/lxc_container_spec.rb +12 -0
  145. data/spec/type/linux/selinux_module_spec.rb +11 -0
  146. data/spec/type/linux/selinux_spec.rb +23 -0
  147. data/spec/type/linux/x509_certificate_spec.rb +62 -0
  148. data/spec/type/linux/x509_private_key_spec.rb +31 -0
  149. data/spec/type/linux/zfs_spec.rb +15 -0
  150. data/spec/type/nixos/package_spec.rb +15 -0
  151. data/spec/type/nixos/service_spec.rb +9 -0
  152. data/spec/type/openbsd/file_spec.rb +134 -0
  153. data/spec/type/openbsd/interface_spec.rb +21 -0
  154. data/spec/type/openbsd/mail_alias_spec.rb +7 -0
  155. data/spec/type/openbsd/package_spec.rb +11 -0
  156. data/spec/type/openbsd/port_spec.rb +7 -0
  157. data/spec/type/openbsd/service_spec.rb +13 -0
  158. data/spec/type/openbsd/user_spec.rb +12 -0
  159. data/spec/type/opensuse/service_spec.rb +16 -0
  160. data/spec/type/plamo/package_spec.rb +8 -0
  161. data/spec/type/plamo/service_spec.rb +8 -0
  162. data/spec/type/redhat/file_spec.rb +19 -0
  163. data/spec/type/redhat/package_spec.rb +23 -0
  164. data/spec/type/redhat/service_spec.rb +11 -0
  165. data/spec/type/redhat/yumrepo_spec.rb +11 -0
  166. data/spec/type/redhat5/iptables_spec.rb +11 -0
  167. data/spec/type/redhat7/service_spec.rb +9 -0
  168. data/spec/type/smartos/package_spec.rb +19 -0
  169. data/spec/type/smartos/service_spec.rb +16 -0
  170. data/spec/type/solaris/cron_spec.rb +11 -0
  171. data/spec/type/solaris/file_spec.rb +15 -0
  172. data/spec/type/solaris/group_spec.rb +7 -0
  173. data/spec/type/solaris/host_spec.rb +19 -0
  174. data/spec/type/solaris/ipfilter_spec.rb +7 -0
  175. data/spec/type/solaris/ipnat_spec.rb +7 -0
  176. data/spec/type/solaris/package_spec.rb +7 -0
  177. data/spec/type/solaris/port_spec.rb +34 -0
  178. data/spec/type/solaris/service_spec.rb +16 -0
  179. data/spec/type/solaris/user_spec.rb +16 -0
  180. data/spec/type/solaris/zfs_spec.rb +15 -0
  181. data/spec/type/solaris10/file_spec.rb +313 -0
  182. data/spec/type/solaris10/group_spec.rb +8 -0
  183. data/spec/type/solaris10/host_spec.rb +16 -0
  184. data/spec/type/solaris10/package_spec.rb +8 -0
  185. data/spec/type/solaris10/user_spec.rb +8 -0
  186. data/spec/type/suse/package_spec.rb +23 -0
  187. data/spec/type/suse/service_spec.rb +11 -0
  188. data/spec/type/ubuntu/ppa_spec.rb +11 -0
  189. data/spec/type/ubuntu/service_spec.rb +7 -0
  190. data/spec/type/windows/command_spec.rb +64 -0
  191. data/spec/type/windows/feature_spec.rb +17 -0
  192. data/spec/type/windows/file_spec.rb +120 -0
  193. data/spec/type/windows/group_spec.rb +23 -0
  194. data/spec/type/windows/host_spec.rb +32 -0
  195. data/spec/type/windows/hot_fix_spec.rb +22 -0
  196. data/spec/type/windows/iis_app_pool_spec.rb +17 -0
  197. data/spec/type/windows/iis_webisite_spec.rb +16 -0
  198. data/spec/type/windows/package_spec.rb +10 -0
  199. data/spec/type/windows/port_spec.rb +25 -0
  200. data/spec/type/windows/registry_key_spec.rb +58 -0
  201. data/spec/type/windows/scheduled_task_spec.rb +9 -0
  202. data/spec/type/windows/service_spec.rb +30 -0
  203. data/spec/type/windows/user_spec.rb +33 -0
  204. data/wercker.yml +1 -0
  205. metadata +450 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f34059b6396c3ef5089fe91c99ceca7a43ce1494
4
+ data.tar.gz: 819a0fe1d5fb1f93239fffca48e81ea379c60109
5
+ SHA512:
6
+ metadata.gz: 337c32cedd3c72ee609f39d8e41eddfb5fca88eedb12d5448159587fefc749f825d4c1704e94e42f3fe1d407633096d0b46619954bc1b9e1190f540d0c462427
7
+ data.tar.gz: 5ab7b5a19d433b2d3431f9ad6143199426d81ef21bece733c1919cc58ebee7e4e7df437b85ae990f36f554bd13cddca552418cec9d08dd65f6b080751ceaa998
@@ -0,0 +1,26 @@
1
+ *.gem
2
+ *.rbc
3
+ *.swp
4
+ .bundle
5
+ .rvmrc
6
+ .versions.conf
7
+ .config
8
+ .yardoc
9
+ .rspec
10
+ .idea/
11
+ Gemfile.lock
12
+ InstalledFiles
13
+ _yardoc
14
+ coverage
15
+ doc/
16
+ lib/bundler/man
17
+ pkg
18
+ rdoc
19
+ spec/reports
20
+ test/tmp
21
+ test/version_tmp
22
+ tmp
23
+ Vagrantfile
24
+ vendor/
25
+ .DS_Store
26
+ Gemfile.local
@@ -0,0 +1,3 @@
1
+ [submodule "integration-test"]
2
+ path = integration-test
3
+ url = https://github.com/serverspec/serverspec-integration-test.git
@@ -0,0 +1,19 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1.1
8
+
9
+ before_install:
10
+ - gem update bundler
11
+
12
+ script:
13
+ - bundle exec rake spec
14
+
15
+ sudo: false
16
+ cache: bundler
17
+ notifications:
18
+ slack:
19
+ secure: X1umGErES0zd+LXX1EqZZxrPZv2YOzbCNxiLLiSGmJLlZAEtlSkMPyr+M00Lrs2DFhn4blwKPm+5YCBvU7f9F4K5GthSl0qZYNpNX/lGNn6EGeBnzJ8rFVgwXPUv1rvrJq0NjeSGni3yAK69K/uX6QohGojAI3iI28/EbJ+uYQM=
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in serverspec.gemspec
4
+ gemspec
5
+
6
+ # Put Gemfile.local to use arbitrary gems for your use case.
7
+ path = Pathname.new("Gemfile.local")
8
+ eval(path.read) if path.exist?
@@ -0,0 +1,4 @@
1
+ guard :rspec do
2
+ watch(%r{^spec/.+/.+_spec\.rb$})
3
+ watch('spec/spec_helper.rb') { "spec" }
4
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Gosuke Miyashita
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ # Serverspec [![Gem Version](https://badge.fury.io/rb/serverspec.png)](http://badge.fury.io/rb/serverspec) [![BuildStatus](https://secure.travis-ci.org/serverspec/serverspec.png)](http://travis-ci.org/serverspec/serverspec) [![Code Climate](https://codeclimate.com/github/serverspec/serverspec.png)](https://codeclimate.com/github/serverspec/serverspec) [![wercker status](https://app.wercker.com/status/526d1ff4df6eadaa793dca1affcaed35/s/ "wercker status")](https://app.wercker.com/project/bykey/526d1ff4df6eadaa793dca1affcaed35)
2
+
3
+ RSpec tests for your servers configured by Puppet, Chef or anything else
4
+
5
+ You can see the details of serverspec on [serverspec.org](http://serverspec.org/).
6
+
7
+ ----
8
+
9
+ ## Maintenance policy of Serverspec/Specinfra
10
+
11
+ * The person who found a bug should fix the bug by themself.
12
+ * If you find a bug and cannot fix it by yourself, send a pull request and attache test code to reproduce the bug, please.
13
+ * The person who want a new feature should implement it by themself.
14
+ * For above reasons, I accept pull requests only and disable issues.
15
+ * If you'd like to discuss about a new feature before implement it, make an empty commit and send [a WIP pull request](http://ben.straub.cc/2015/04/02/wip-pull-request/). But It is better that the WIP PR has some code than an empty commit.
16
+
17
+
18
+ ----
19
+
20
+ ## Contributing
21
+
22
+ 1. Fork it
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create new Pull Request
@@ -0,0 +1,30 @@
1
+ require "bundler/gem_tasks"
2
+ begin
3
+ require "rspec/core/rake_task"
4
+ require "octorelease"
5
+ rescue LoadError
6
+ end
7
+
8
+ if defined?(RSpec)
9
+ task :spec => 'spec:all'
10
+
11
+ namespace :spec do
12
+ task :all => [ 'spec:type:all', 'spec:helper' ]
13
+
14
+ namespace :type do
15
+ oses = Dir.glob('spec/type/*').map {|d| File.basename(d)}
16
+
17
+ task :all => oses.map {|os| "spec:type:#{os}" }
18
+
19
+ oses.each do |os|
20
+ RSpec::Core::RakeTask.new(os.to_sym) do |t|
21
+ t.pattern = "spec/type/#{os}/*_spec.rb"
22
+ end
23
+ end
24
+ end
25
+
26
+ RSpec::Core::RakeTask.new(:helper) do |t|
27
+ t.pattern = "spec/helper/*_spec.rb"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,118 @@
1
+ ## Windows support
2
+
3
+ Serverspec is now providing a limited support for Microsoft Windows.
4
+
5
+ If you want to test Windows based machines you need to set the target host's OS explicitly in your `spec/spec_helper.rb`
6
+
7
+ For local testing (equivalent to the Exec option in Linux/Unix systems) simply do:
8
+
9
+ ```ruby
10
+ require 'serverspec'
11
+
12
+ set :backend, :cmd
13
+ set :os, :family => 'windows'
14
+ ```
15
+
16
+ For remote testing you have to configure Windows Remote Management in order to communicate to the target host:
17
+
18
+ ```ruby
19
+ require 'serverspec'
20
+ require 'winrm'
21
+
22
+ set :backend, :winrm
23
+ set :os, :family => 'windows'
24
+
25
+ user = <username>
26
+ pass = <password>
27
+ endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
28
+
29
+ winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
30
+ winrm.set_timeout 300 # 5 minutes max timeout for any operation
31
+ Specinfra.configuration.winrm = winrm
32
+ ```
33
+
34
+ For how to configure the guest to accept WinRM connections and the different authentication mechanisms check the Microsoft WinRM documentation and verify the ones that are supported by [WinRb/WinRM](https://github.com/WinRb/WinRM).
35
+
36
+
37
+ ###RSpec Examples for windows target hosts
38
+ ```ruby
39
+ describe file('c:/windows') do
40
+ it { should be_directory }
41
+ it { should be_readable }
42
+ it { should_not be_writable.by('Everyone') }
43
+ end
44
+
45
+ describe file('c:/temp/test.txt') do
46
+ it { should be_file }
47
+ it { should contain "some text" }
48
+ end
49
+
50
+ describe package('Adobe AIR') do
51
+ it { should be_installed}
52
+ end
53
+
54
+ describe service('DNS Client') do
55
+ it { should be_installed }
56
+ it { should be_enabled }
57
+ it { should be_running }
58
+ it { should have_start_mode("Manual") }
59
+ end
60
+
61
+ describe port(139) do
62
+ it { should be_listening }
63
+ end
64
+
65
+ describe user('some.admin') do
66
+ it { should exist }
67
+ it { should belong_to_group('Administrators')}
68
+ end
69
+
70
+ describe group('Guests') do
71
+ it { should exist }
72
+ end
73
+
74
+ describe group('MYDOMAIN\Domain Users') do
75
+ it { should exist }
76
+ end
77
+
78
+ describe command('& "ipconfig"') do
79
+ its(:stdout) { should match /IPv4 Address(\.| )*: 192\.168\.1\.100/ }
80
+ end
81
+
82
+ describe windows_registry_key('HKEY_USERS\S-1-5-21-1319311448-2088773778-316617838-32407\Test MyKey') do
83
+ it { should exist }
84
+ it { should have_property('string value') }
85
+ it { should have_property('binary value', :type_binary) }
86
+ it { should have_property('dword value', :type_dword) }
87
+ it { should have_value('test default data') }
88
+ it { should have_property_value('multistring value', :type_multistring, "test\nmulti\nstring\ndata") }
89
+ it { should have_property_value('qword value', :type_qword, 'adff32') }
90
+ it { should have_property_value('binary value', :type_binary, 'dfa0f066') }
91
+ end
92
+
93
+ describe windows_feature('Minesweeper') do
94
+ it{ should be_installed }
95
+ it{ should be_installed.by("dism") }
96
+ it{ should be_installed.by("powershell") }
97
+ end
98
+
99
+ describe iis_website("Default Website") do
100
+ it { should exist }
101
+ it { should be_enabled }
102
+ it { should be_running }
103
+ it { should be_in_app_pool "DefaultAppPool" }
104
+ it { should have_physical_path "c:/inetpub/wwwroot" }
105
+ end
106
+
107
+ describe iis_app_pool("DefaultAppPool") do
108
+ it { should exist }
109
+ it { should have_dotnet_version "2.0" }
110
+ end
111
+
112
+ ```
113
+
114
+ ###Notes:
115
+ * Not all the matchers you are used to in Linux-like OS are supported in Windows, some because of differences between the operating systems (e.g. users and permissions model), some because they haven't been yet implemented.
116
+ * All commands in the windows backend are run via powershell, so the output in case of stderr is a pretty ugly xml-like thing. Still it should contain some information to help troubleshooting.
117
+ * The *command* type is executed again through powershell, so bear that in mind if you mean to run old CMD windows batch or programs. (i.e run the command using the **Invoke-Expression** Cmdlet, or the **&** Call Operator)
118
+ * You may have to change Exectution Policy on the machine at both, machine and user level in order for tests to run: Get-ExecutionPolicy -list|%{set-executionpolicy bypass -scope $_.scope}
@@ -0,0 +1,56 @@
1
+ version: "{build}"
2
+
3
+ os: Windows Server 2012
4
+ platform:
5
+ - x64
6
+
7
+ environment:
8
+ bundle_gemfile: integration-test/Gemfile.winrm
9
+ bundler_url: https://rubygems.org/downloads/bundler-1.9.9.gem
10
+
11
+ matrix:
12
+ - ruby_version: "193"
13
+ - ruby_version: "200"
14
+ - ruby_version: "21"
15
+ - ruby_version: "22"
16
+
17
+ matrix:
18
+ allow_failures:
19
+ - ruby_version: "22" # waiting for net-ssh update
20
+
21
+ clone_depth: 5
22
+
23
+ cache:
24
+ - C:\Ruby193\lib\ruby\gems\1.9.1 -> appveyor.yml
25
+ - C:\Ruby193\bin -> appveyor.yml
26
+ - C:\Ruby200\lib\ruby\gems\2.0.0 -> appveyor.yml
27
+ - C:\Ruby200\bin -> appveyor.yml
28
+ - C:\Ruby21\lib\ruby\gems\2.1.0 -> appveyor.yml
29
+ - C:\Ruby21\bin -> appveyor.yml
30
+ - C:\Ruby22\lib\ruby\gems\2.2.0 -> appveyor.yml
31
+ - C:\Ruby22\bin -> appveyor.yml
32
+
33
+ install:
34
+ - git submodule update --init --recursive
35
+ - ps: Enable-PSRemoting -Force
36
+ - winrm quickconfig -q
37
+ - winrm set winrm/config/client @{TrustedHosts="*"}
38
+ - winrm set winrm/config/client/auth @{Basic="true"}
39
+ - winrm set winrm/config/service/auth @{Basic="true"}
40
+ - winrm set winrm/config/service @{AllowUnencrypted="true"}
41
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
42
+ - echo %PATH%
43
+ - ruby --version
44
+ - gem --version
45
+ - appveyor DownloadFile -Url %bundler_url% -FileName bundler.gem
46
+ - gem install --local bundler.gem --no-ri --no-rdoc ## appveyor often stops `gem install bundler`..?
47
+
48
+ build_script:
49
+ - ruby -rfileutils -e 'FileUtils.rm_r(File.join(Gem.dir, "cache", "bundler")) if Dir.exists?(File.join(Gem.dir, "cache", "bundler"))'
50
+ - bundle install --jobs 3 --retry 3
51
+ - net user
52
+ - net localgroup
53
+
54
+ test_script:
55
+ - net user appveyor %WINDOWS_PASSWORD% # set by webui
56
+ - bundle exec rspec -fd --backtrace -r .\integration-test\winrm\spec_helper.rb .\integration-test\winrm
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ require 'serverspec'
6
+
7
+ Serverspec::Setup.run
@@ -0,0 +1,63 @@
1
+ require 'rubygems'
2
+ require 'specinfra'
3
+ require 'rspec'
4
+ require 'rspec/its'
5
+ require 'serverspec/version'
6
+ require 'serverspec/matcher'
7
+ require 'serverspec/helper'
8
+ require 'serverspec/setup'
9
+ require 'serverspec/subject'
10
+ require 'serverspec/commands/base'
11
+ require 'rspec/core/formatters/base_formatter'
12
+ require 'specinfra/helper/set'
13
+ include Specinfra::Helper::Set
14
+
15
+ module RSpec::Core::Notifications
16
+ class FailedExampleNotification < ExampleNotification
17
+ def failure_lines
18
+ host = ENV['TARGET_HOST'] || Specinfra.configuration.host
19
+ @failure_lines ||=
20
+ begin
21
+ lines = []
22
+ lines << "On host `#{host}'" if host
23
+ lines << "Failure/Error: #{read_failed_line.strip}"
24
+ lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
25
+ exception.message.to_s.split("\n").each do |line|
26
+ lines << " #{line}" if exception.message
27
+ end
28
+ lines << " #{example.metadata[:command]}"
29
+ lines << " #{example.metadata[:stdout]}" if example.metadata[:stdout]
30
+ lines << " #{example.metadata[:stderr]}" if example.metadata[:stderr]
31
+ lines
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ # For RSpec 3.3.x
38
+ if defined?(RSpec::Core::Formatters::ExceptionPresenter)
39
+ class RSpec::Core::Formatters::ExceptionPresenter
40
+ def failure_lines
41
+ host = ENV['TARGET_HOST'] || Specinfra.configuration.host
42
+ @failure_lines ||=
43
+ begin
44
+ lines = []
45
+ lines << "On host `#{host}'" if host
46
+ error_lines = if defined?(failure_slash_error_lines)
47
+ failure_slash_error_lines
48
+ else
49
+ [failure_slash_error_line]
50
+ end
51
+ lines += error_lines if error_lines unless (description == error_lines.join(''))
52
+ lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
53
+ encoded_string(exception.message.to_s).split("\n").each do |line|
54
+ lines << " #{line}"
55
+ end
56
+ lines << " #{example.metadata[:command]}"
57
+ lines << " #{example.metadata[:stdout]}" if example.metadata[:stdout]
58
+ lines << " #{example.metadata[:stderr]}" if example.metadata[:stderr]
59
+ lines
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,7 @@
1
+ module Serverspec
2
+ module Commands
3
+ class Base < Specinfra::Command::Base
4
+ end
5
+ end
6
+ end
7
+
@@ -0,0 +1,8 @@
1
+ # Subject type helper
2
+ require 'serverspec/helper/type'
3
+ extend Serverspec::Helper::Type
4
+ class RSpec::Core::ExampleGroup
5
+ extend Serverspec::Helper::Type
6
+ include Serverspec::Helper::Type
7
+ end
8
+
@@ -0,0 +1,26 @@
1
+ module Serverspec
2
+ module Helper
3
+ module Type
4
+ types = %w(
5
+ base bridge bond cgroup command cron default_gateway file fstab
6
+ group host iis_website iis_app_pool interface ipfilter ipnat
7
+ iptables ip6tables kernel_module linux_kernel_parameter lxc
8
+ mail_alias mysql_config package php_config port ppa process
9
+ routing_table selinux selinux_module service user yumrepo
10
+ windows_feature windows_hot_fix windows_registry_key
11
+ windows_scheduled_task zfs docker_base docker_image
12
+ docker_container x509_certificate x509_private_key
13
+ linux_audit_system
14
+ )
15
+
16
+ types.each {|type| require "serverspec/type/#{type}" }
17
+
18
+ types.each do |type|
19
+ define_method type do |*args|
20
+ name = args.first
21
+ eval "Serverspec::Type::#{type.to_camel_case}.new(name)"
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end