serverspec-clc 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +26 -0
- data/.gitmodules +3 -0
- data/.travis.yml +14 -0
- data/Gemfile +8 -0
- data/Guardfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +15 -0
- data/Rakefile +30 -0
- data/WINDOWS_SUPPORT.md +116 -0
- data/bin/serverspec-init +7 -0
- data/lib/serverspec.rb +33 -0
- data/lib/serverspec/commands/base.rb +7 -0
- data/lib/serverspec/helper.rb +8 -0
- data/lib/serverspec/helper/type.rb +23 -0
- data/lib/serverspec/matcher.rb +35 -0
- data/lib/serverspec/matcher/be_enabled.rb +13 -0
- data/lib/serverspec/matcher/be_executable.rb +13 -0
- data/lib/serverspec/matcher/be_installed.rb +13 -0
- data/lib/serverspec/matcher/be_listening.rb +13 -0
- data/lib/serverspec/matcher/be_mounted.rb +15 -0
- data/lib/serverspec/matcher/be_reachable.rb +17 -0
- data/lib/serverspec/matcher/be_readable.rb +13 -0
- data/lib/serverspec/matcher/be_resolvable.rb +9 -0
- data/lib/serverspec/matcher/be_running.rb +13 -0
- data/lib/serverspec/matcher/be_writable.rb +13 -0
- data/lib/serverspec/matcher/belong_to_group.rb +5 -0
- data/lib/serverspec/matcher/belong_to_primary_group.rb +5 -0
- data/lib/serverspec/matcher/contain.rb +24 -0
- data/lib/serverspec/matcher/have_entry.rb +14 -0
- data/lib/serverspec/matcher/have_rule.rb +17 -0
- data/lib/serverspec/matcher/have_site_application.rb +18 -0
- data/lib/serverspec/matcher/have_site_bindings.rb +22 -0
- data/lib/serverspec/matcher/have_virtual_dir.rb +14 -0
- data/lib/serverspec/setup.rb +333 -0
- data/lib/serverspec/subject.rb +12 -0
- data/lib/serverspec/type/base.rb +21 -0
- data/lib/serverspec/type/cgroup.rb +17 -0
- data/lib/serverspec/type/command.rb +20 -0
- data/lib/serverspec/type/cron.rb +11 -0
- data/lib/serverspec/type/default_gateway.rb +15 -0
- data/lib/serverspec/type/file.rb +113 -0
- data/lib/serverspec/type/group.rb +11 -0
- data/lib/serverspec/type/host.rb +15 -0
- data/lib/serverspec/type/iis_app_pool.rb +43 -0
- data/lib/serverspec/type/iis_website.rb +40 -0
- data/lib/serverspec/type/interface.rb +18 -0
- data/lib/serverspec/type/ip6tables.rb +13 -0
- data/lib/serverspec/type/ipfilter.rb +11 -0
- data/lib/serverspec/type/ipnat.rb +11 -0
- data/lib/serverspec/type/iptables.rb +11 -0
- data/lib/serverspec/type/kernel_module.rb +7 -0
- data/lib/serverspec/type/linux_kernel_parameter.rb +10 -0
- data/lib/serverspec/type/lxc.rb +15 -0
- data/lib/serverspec/type/mail_alias.rb +7 -0
- data/lib/serverspec/type/package.rb +65 -0
- data/lib/serverspec/type/php_config.rb +10 -0
- data/lib/serverspec/type/port.rb +40 -0
- data/lib/serverspec/type/ppa.rb +11 -0
- data/lib/serverspec/type/process.rb +27 -0
- data/lib/serverspec/type/routing_table.rb +11 -0
- data/lib/serverspec/type/selinux.rb +19 -0
- data/lib/serverspec/type/selinux_module.rb +11 -0
- data/lib/serverspec/type/service.rb +33 -0
- data/lib/serverspec/type/user.rb +31 -0
- data/lib/serverspec/type/windows_feature.rb +7 -0
- data/lib/serverspec/type/windows_hot_fix.rb +7 -0
- data/lib/serverspec/type/windows_registry_key.rb +19 -0
- data/lib/serverspec/type/windows_scheduled_task.rb +7 -0
- data/lib/serverspec/type/yumrepo.rb +11 -0
- data/lib/serverspec/type/zfs.rb +15 -0
- data/lib/serverspec/version.rb +3 -0
- data/serverspec.gemspec +26 -0
- data/spec/helper/type_spec.rb +6 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/type/aix/file_spec.rb +31 -0
- data/spec/type/aix/group_spec.rb +7 -0
- data/spec/type/aix/package_spec.rb +7 -0
- data/spec/type/aix/port_spec.rb +20 -0
- data/spec/type/aix/service_spec.rb +12 -0
- data/spec/type/aix/user_spec.rb +16 -0
- data/spec/type/arch/file_spec.rb +15 -0
- data/spec/type/arch/package_spec.rb +19 -0
- data/spec/type/arch/service_spec.rb +9 -0
- data/spec/type/base/command_spec.rb +62 -0
- data/spec/type/base/cron_spec.rb +11 -0
- data/spec/type/base/default_gateway_spec.rb +11 -0
- data/spec/type/base/file_spec.rb +336 -0
- data/spec/type/base/group_spec.rb +11 -0
- data/spec/type/base/host_spec.rb +36 -0
- data/spec/type/base/mail_alias_spec.rb +7 -0
- data/spec/type/base/package_spec.rb +43 -0
- data/spec/type/base/php_config_spec.rb +33 -0
- data/spec/type/base/port_spec.rb +34 -0
- data/spec/type/base/process_spec.rb +35 -0
- data/spec/type/base/routing_table_spec.rb +118 -0
- data/spec/type/base/service_spec.rb +45 -0
- data/spec/type/base/user_spec.rb +31 -0
- data/spec/type/darwin/file_spec.rb +41 -0
- data/spec/type/darwin/package_spec.rb +19 -0
- data/spec/type/darwin/port_spec.rb +27 -0
- data/spec/type/darwin/service_spec.rb +16 -0
- data/spec/type/debian/package_spec.rb +23 -0
- data/spec/type/debian/service_spec.rb +11 -0
- data/spec/type/fedora/service_spec.rb +15 -0
- data/spec/type/fedora15/service_spec.rb +15 -0
- data/spec/type/fedora20/service_spec.rb +15 -0
- data/spec/type/freebsd/file_spec.rb +29 -0
- data/spec/type/freebsd/package_spec.rb +19 -0
- data/spec/type/freebsd/port_spec.rb +27 -0
- data/spec/type/freebsd/service_spec.rb +8 -0
- data/spec/type/freebsd10/package_spec.rb +19 -0
- data/spec/type/gentoo/package_spec.rb +7 -0
- data/spec/type/gentoo/service_spec.rb +12 -0
- data/spec/type/linux/cgroup_spec.rb +13 -0
- data/spec/type/linux/file_spec.rb +21 -0
- data/spec/type/linux/interface_spec.rb +25 -0
- data/spec/type/linux/ip6tables_spec.rb +19 -0
- data/spec/type/linux/iptables_spec.rb +11 -0
- data/spec/type/linux/kernel_module_spec.rb +7 -0
- data/spec/type/linux/linux_kernel_parameter_spec.rb +33 -0
- data/spec/type/linux/lxc_container_spec.rb +12 -0
- data/spec/type/linux/selinux_module_spec.rb +11 -0
- data/spec/type/linux/selinux_spec.rb +15 -0
- data/spec/type/linux/zfs_spec.rb +15 -0
- data/spec/type/nixos/package_spec.rb +15 -0
- data/spec/type/nixos/service_spec.rb +9 -0
- data/spec/type/openbsd/file_spec.rb +134 -0
- data/spec/type/openbsd/interface_spec.rb +21 -0
- data/spec/type/openbsd/mail_alias_spec.rb +7 -0
- data/spec/type/openbsd/package_spec.rb +11 -0
- data/spec/type/openbsd/port_spec.rb +7 -0
- data/spec/type/openbsd/service_spec.rb +13 -0
- data/spec/type/openbsd/user_spec.rb +12 -0
- data/spec/type/opensuse/service_spec.rb +16 -0
- data/spec/type/plamo/package_spec.rb +8 -0
- data/spec/type/plamo/service_spec.rb +8 -0
- data/spec/type/redhat/file_spec.rb +19 -0
- data/spec/type/redhat/package_spec.rb +23 -0
- data/spec/type/redhat/service_spec.rb +11 -0
- data/spec/type/redhat/yumrepo_spec.rb +11 -0
- data/spec/type/redhat5/iptables_spec.rb +11 -0
- data/spec/type/redhat7/service_spec.rb +9 -0
- data/spec/type/smartos/package_spec.rb +19 -0
- data/spec/type/smartos/service_spec.rb +16 -0
- data/spec/type/solaris/cron_spec.rb +11 -0
- data/spec/type/solaris/file_spec.rb +15 -0
- data/spec/type/solaris/group_spec.rb +7 -0
- data/spec/type/solaris/host_spec.rb +19 -0
- data/spec/type/solaris/ipfilter_spec.rb +7 -0
- data/spec/type/solaris/ipnat_spec.rb +7 -0
- data/spec/type/solaris/package_spec.rb +7 -0
- data/spec/type/solaris/port_spec.rb +34 -0
- data/spec/type/solaris/service_spec.rb +16 -0
- data/spec/type/solaris/user_spec.rb +16 -0
- data/spec/type/solaris/zfs_spec.rb +15 -0
- data/spec/type/solaris10/file_spec.rb +313 -0
- data/spec/type/solaris10/group_spec.rb +8 -0
- data/spec/type/solaris10/host_spec.rb +16 -0
- data/spec/type/solaris10/package_spec.rb +8 -0
- data/spec/type/solaris10/user_spec.rb +8 -0
- data/spec/type/suse/package_spec.rb +23 -0
- data/spec/type/suse/service_spec.rb +11 -0
- data/spec/type/ubuntu/ppa_spec.rb +11 -0
- data/spec/type/ubuntu/service_spec.rb +7 -0
- data/spec/type/windows/command_spec.rb +64 -0
- data/spec/type/windows/feature_spec.rb +17 -0
- data/spec/type/windows/file_spec.rb +121 -0
- data/spec/type/windows/group_spec.rb +23 -0
- data/spec/type/windows/host_spec.rb +32 -0
- data/spec/type/windows/hot_fix_spec.rb +22 -0
- data/spec/type/windows/iis_app_pool_spec.rb +17 -0
- data/spec/type/windows/iis_webisite_spec.rb +16 -0
- data/spec/type/windows/package_spec.rb +10 -0
- data/spec/type/windows/port_spec.rb +25 -0
- data/spec/type/windows/registry_key_spec.rb +58 -0
- data/spec/type/windows/scheduled_task_spec.rb +9 -0
- data/spec/type/windows/service_spec.rb +30 -0
- data/spec/type/windows/user_spec.rb +33 -0
- metadata +400 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 10695fdfb1ccbe23909f4195d9744b79c210f20f
|
4
|
+
data.tar.gz: 90dc82bb0f1e1557f26803dad629b14a96b8fd12
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0f9cf03ef351be5d7a69da77fa05bf31667f2403e64946008003d112f3da04bd8d60844d626bc2c829c5721403e4235fe592e1b980078b10c16ec29f96e68e6b
|
7
|
+
data.tar.gz: 8d887729246551fde0ceaca0edf8dac480df5d00bcc40d4560c393cb822737bff30ada47e3d5a9cb1018fb4672b2f63ad88ceee8442e41017258fe17ec1ebc51
|
data/.gitignore
ADDED
@@ -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
|
data/.gitmodules
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
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
|
+
## Contributing
|
10
|
+
|
11
|
+
1. Fork it
|
12
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
13
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
14
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
15
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -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
|
data/WINDOWS_SUPPORT.md
ADDED
@@ -0,0 +1,116 @@
|
|
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
|
+
```
|
14
|
+
|
15
|
+
For remote testing you have to configure Windows Remote Management in order to communicate to the target host:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'serverspec'
|
19
|
+
require 'winrm'
|
20
|
+
|
21
|
+
set :backend, :winrm
|
22
|
+
|
23
|
+
user = <username>
|
24
|
+
pass = <password>
|
25
|
+
endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
|
26
|
+
|
27
|
+
winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
|
28
|
+
winrm.set_timeout 300 # 5 minutes max timeout for any operation
|
29
|
+
Specinfra.configuration.winrm = winrm
|
30
|
+
```
|
31
|
+
|
32
|
+
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).
|
33
|
+
|
34
|
+
|
35
|
+
###RSpec Examples for windows target hosts
|
36
|
+
```ruby
|
37
|
+
describe file('c:/windows') do
|
38
|
+
it { should be_directory }
|
39
|
+
it { should be_readable }
|
40
|
+
it { should_not be_writable.by('Everyone') }
|
41
|
+
end
|
42
|
+
|
43
|
+
describe file('c:/temp/test.txt') do
|
44
|
+
it { should be_file }
|
45
|
+
it { should contain "some text" }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe package('Adobe AIR') do
|
49
|
+
it { should be_installed}
|
50
|
+
end
|
51
|
+
|
52
|
+
describe service('DNS Client') do
|
53
|
+
it { should be_installed }
|
54
|
+
it { should be_enabled }
|
55
|
+
it { should be_running }
|
56
|
+
it { should have_start_mode("Manual") }
|
57
|
+
end
|
58
|
+
|
59
|
+
describe port(139) do
|
60
|
+
it { should be_listening }
|
61
|
+
end
|
62
|
+
|
63
|
+
describe user('some.admin') do
|
64
|
+
it { should exist }
|
65
|
+
it { should belong_to_group('Administrators')}
|
66
|
+
end
|
67
|
+
|
68
|
+
describe group('Guests') do
|
69
|
+
it { should exist }
|
70
|
+
end
|
71
|
+
|
72
|
+
describe group('MYDOMAIN\Domain Users') do
|
73
|
+
it { should exist }
|
74
|
+
end
|
75
|
+
|
76
|
+
describe command('& "ipconfig"') do
|
77
|
+
it { should return_stdout(/IPv4 Address(\.| )*: 192\.168\.1\.100/) }
|
78
|
+
end
|
79
|
+
|
80
|
+
describe windows_registry_key('HKEY_USERS\S-1-5-21-1319311448-2088773778-316617838-32407\Test MyKey') do
|
81
|
+
it { should exist }
|
82
|
+
it { should have_property('string value') }
|
83
|
+
it { should have_property('binary value', :type_binary) }
|
84
|
+
it { should have_property('dword value', :type_dword) }
|
85
|
+
it { should have_value('test default data') }
|
86
|
+
it { should have_property_value('multistring value', :type_multistring, "test\nmulti\nstring\ndata") }
|
87
|
+
it { should have_property_value('qword value', :type_qword, 'adff32') }
|
88
|
+
it { should have_property_value('binary value', :type_binary, 'dfa0f066') }
|
89
|
+
end
|
90
|
+
|
91
|
+
describe windows_feature('Minesweeper') do
|
92
|
+
it{ should be_installed }
|
93
|
+
it{ should be_installed.by("dism") }
|
94
|
+
it{ should be_installed.by("powershell") }
|
95
|
+
end
|
96
|
+
|
97
|
+
describe iis_website("Default Website") do
|
98
|
+
it { should exist }
|
99
|
+
it { should be_enabled }
|
100
|
+
it { should be_running }
|
101
|
+
it { should be_in_app_pool "DefaultAppPool" }
|
102
|
+
it { should have_physical_path "c:/inetpub/wwwroot" }
|
103
|
+
end
|
104
|
+
|
105
|
+
describe iis_app_pool("DefaultAppPool") do
|
106
|
+
it { should exist }
|
107
|
+
it { should have_dotnet_version "2.0" }
|
108
|
+
end
|
109
|
+
|
110
|
+
```
|
111
|
+
|
112
|
+
###Notes:
|
113
|
+
* 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.
|
114
|
+
* 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.
|
115
|
+
* 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)
|
116
|
+
* 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}
|
data/bin/serverspec-init
ADDED
data/lib/serverspec.rb
ADDED
@@ -0,0 +1,33 @@
|
|
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
|
+
|
13
|
+
module RSpec::Core::Notifications
|
14
|
+
class FailedExampleNotification < ExampleNotification
|
15
|
+
def failure_lines
|
16
|
+
host = ENV['TARGET_HOST'] || Specinfra.configuration.host
|
17
|
+
@failure_lines ||=
|
18
|
+
begin
|
19
|
+
lines = []
|
20
|
+
lines << "On host `#{host}'" if host
|
21
|
+
lines << "Failure/Error: #{read_failed_line.strip}"
|
22
|
+
lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
|
23
|
+
exception.message.to_s.split("\n").each do |line|
|
24
|
+
lines << " #{line}" if exception.message
|
25
|
+
end
|
26
|
+
lines << " #{example.metadata[:command]}"
|
27
|
+
lines << " #{example.metadata[:stdout]}" if example.metadata[:stdout]
|
28
|
+
lines << " #{example.metadata[:stderr]}" if example.metadata[:stderr]
|
29
|
+
lines
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Serverspec
|
2
|
+
module Helper
|
3
|
+
module Type
|
4
|
+
types = %w(
|
5
|
+
base cgroup command cron default_gateway file group host
|
6
|
+
iis_website iis_app_pool interface ipfilter ipnat iptables
|
7
|
+
ip6tables kernel_module linux_kernel_parameter lxc mail_alias
|
8
|
+
package php_config port ppa process routing_table selinux
|
9
|
+
selinux_module service user yumrepo windows_feature
|
10
|
+
windows_hot_fix windows_registry_key windows_scheduled_task zfs
|
11
|
+
)
|
12
|
+
|
13
|
+
types.each {|type| require "serverspec/type/#{type}" }
|
14
|
+
|
15
|
+
types.each do |type|
|
16
|
+
define_method type do |*args|
|
17
|
+
name = args.first
|
18
|
+
eval "Serverspec::Type::#{type.to_camel_case}.new(name)"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# file
|
2
|
+
require 'serverspec/matcher/be_mounted'
|
3
|
+
require 'serverspec/matcher/contain'
|
4
|
+
require 'serverspec/matcher/be_readable'
|
5
|
+
require 'serverspec/matcher/be_writable'
|
6
|
+
require 'serverspec/matcher/be_executable'
|
7
|
+
|
8
|
+
# port
|
9
|
+
require 'serverspec/matcher/be_listening'
|
10
|
+
|
11
|
+
# host
|
12
|
+
require 'serverspec/matcher/be_resolvable'
|
13
|
+
require 'serverspec/matcher/be_reachable'
|
14
|
+
|
15
|
+
# package
|
16
|
+
require 'serverspec/matcher/be_installed'
|
17
|
+
|
18
|
+
# service
|
19
|
+
require 'serverspec/matcher/be_enabled'
|
20
|
+
require 'serverspec/matcher/be_running'
|
21
|
+
|
22
|
+
# user
|
23
|
+
require 'serverspec/matcher/belong_to_group'
|
24
|
+
require 'serverspec/matcher/belong_to_primary_group'
|
25
|
+
|
26
|
+
# ipfiter, ipnat, iptables, ip6tables
|
27
|
+
require 'serverspec/matcher/have_rule'
|
28
|
+
|
29
|
+
# cron, routing_table
|
30
|
+
require 'serverspec/matcher/have_entry'
|
31
|
+
|
32
|
+
# iis_website
|
33
|
+
require 'serverspec/matcher/have_site_application'
|
34
|
+
require 'serverspec/matcher/have_site_bindings'
|
35
|
+
require 'serverspec/matcher/have_virtual_dir'
|