serverspec 2.0.0.beta19 → 2.0.0.beta20
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.
- checksums.yaml +4 -4
- data/WINDOWS_SUPPORT.md +9 -13
- data/lib/serverspec/helper/type.rb +7 -9
- data/lib/serverspec/helper.rb +0 -2
- data/lib/serverspec/setup.rb +11 -7
- data/lib/serverspec/type/base.rb +15 -17
- data/lib/serverspec/type/cgroup.rb +13 -16
- data/lib/serverspec/type/command.rb +14 -17
- data/lib/serverspec/type/cron.rb +8 -9
- data/lib/serverspec/type/default_gateway.rb +14 -16
- data/lib/serverspec/type/file.rb +76 -78
- data/lib/serverspec/type/group.rb +7 -9
- data/lib/serverspec/type/host.rb +10 -12
- data/lib/serverspec/type/iis_app_pool.rb +40 -42
- data/lib/serverspec/type/iis_website.rb +28 -31
- data/lib/serverspec/type/interface.rb +10 -12
- data/lib/serverspec/type/ipfilter.rb +7 -9
- data/lib/serverspec/type/ipnat.rb +7 -9
- data/lib/serverspec/type/iptables.rb +7 -9
- data/lib/serverspec/type/kernel_module.rb +4 -6
- data/lib/serverspec/type/linux_kernel_parameter.rb +7 -9
- data/lib/serverspec/type/lxc.rb +10 -12
- data/lib/serverspec/type/mail_alias.rb +4 -6
- data/lib/serverspec/type/package.rb +48 -50
- data/lib/serverspec/type/php_config.rb +7 -9
- data/lib/serverspec/type/port.rb +28 -30
- data/lib/serverspec/type/ppa.rb +7 -9
- data/lib/serverspec/type/process.rb +20 -22
- data/lib/serverspec/type/routing_table.rb +7 -9
- data/lib/serverspec/type/selinux.rb +13 -17
- data/lib/serverspec/type/service.rb +24 -26
- data/lib/serverspec/type/user.rb +22 -30
- data/lib/serverspec/type/windows_feature.rb +4 -6
- data/lib/serverspec/type/windows_hot_fix.rb +4 -6
- data/lib/serverspec/type/windows_registry_key.rb +13 -15
- data/lib/serverspec/type/windows_scheduled_task.rb +4 -6
- data/lib/serverspec/type/yumrepo.rb +7 -9
- data/lib/serverspec/type/zfs.rb +10 -12
- data/lib/serverspec/version.rb +1 -1
- data/lib/serverspec.rb +2 -1
- data/spec/spec_helper.rb +2 -3
- data/spec/type/aix/group_spec.rb +0 -4
- data/spec/type/aix/package_spec.rb +0 -4
- data/spec/type/aix/port_spec.rb +12 -25
- data/spec/type/aix/service_spec.rb +0 -7
- data/spec/type/aix/user_spec.rb +0 -12
- data/spec/type/arch/file_spec.rb +0 -13
- data/spec/type/arch/package_spec.rb +0 -10
- data/spec/type/base/cron_spec.rb +0 -8
- data/spec/type/base/file_spec.rb +0 -53
- data/spec/type/base/group_spec.rb +0 -8
- data/spec/type/base/host_spec.rb +0 -20
- data/spec/type/base/mail_alias_spec.rb +0 -4
- data/spec/type/base/package_spec.rb +10 -38
- data/spec/type/base/port_spec.rb +19 -18
- data/spec/type/base/service_spec.rb +4 -29
- data/spec/type/base/user_spec.rb +0 -24
- data/spec/type/darwin/package_spec.rb +0 -8
- data/spec/type/darwin/port_spec.rb +17 -23
- data/spec/type/darwin/service_spec.rb +0 -12
- data/spec/type/debian/package_spec.rb +0 -12
- data/spec/type/debian/service_spec.rb +0 -8
- data/spec/type/freebsd/file_spec.rb +0 -16
- data/spec/type/freebsd/package_spec.rb +0 -8
- data/spec/type/freebsd/port_spec.rb +17 -23
- data/spec/type/freebsd/service_spec.rb +0 -4
- data/spec/type/freebsd10/package_spec.rb +0 -8
- data/spec/type/gentoo/package_spec.rb +0 -5
- data/spec/type/gentoo/service_spec.rb +0 -8
- data/spec/type/linux/file_spec.rb +0 -13
- data/spec/type/linux/iptables_spec.rb +0 -8
- data/spec/type/linux/kernel_module_spec.rb +0 -4
- data/spec/type/linux/lxc_container_spec.rb +0 -8
- data/spec/type/nixos/package_spec.rb +0 -12
- data/spec/type/openbsd/file_spec.rb +0 -30
- data/spec/type/openbsd/mail_alias_spec.rb +0 -4
- data/spec/type/openbsd/package_spec.rb +0 -9
- data/spec/type/openbsd/service_spec.rb +0 -7
- data/spec/type/openbsd/user_spec.rb +0 -8
- data/spec/type/opensuse/service_spec.rb +0 -12
- data/spec/type/plamo/package_spec.rb +0 -4
- data/spec/type/plamo/service_spec.rb +0 -4
- data/spec/type/redhat/file_spec.rb +0 -13
- data/spec/type/redhat/package_spec.rb +0 -12
- data/spec/type/redhat/service_spec.rb +0 -8
- data/spec/type/redhat/yumrepo_spec.rb +5 -19
- data/spec/type/redhat5/iptables_spec.rb +0 -8
- data/spec/type/smartos/package_spec.rb +0 -8
- data/spec/type/smartos/service_spec.rb +0 -12
- data/spec/type/solaris/cron_spec.rb +0 -8
- data/spec/type/solaris/file_spec.rb +0 -14
- data/spec/type/solaris/group_spec.rb +0 -4
- data/spec/type/solaris/host_spec.rb +3 -11
- data/spec/type/solaris/package_spec.rb +0 -4
- data/spec/type/solaris/port_spec.rb +23 -22
- data/spec/type/solaris/service_spec.rb +0 -12
- data/spec/type/solaris/user_spec.rb +0 -12
- data/spec/type/solaris10/file_spec.rb +0 -58
- data/spec/type/solaris10/group_spec.rb +0 -4
- data/spec/type/solaris10/host_spec.rb +2 -6
- data/spec/type/solaris10/package_spec.rb +0 -3
- data/spec/type/solaris10/user_spec.rb +0 -4
- data/spec/type/suse/package_spec.rb +0 -12
- data/spec/type/suse/service_spec.rb +0 -8
- data/spec/type/ubuntu/ppa_spec.rb +0 -8
- data/spec/type/ubuntu/service_spec.rb +0 -4
- data/spec/type/windows/feature_spec.rb +8 -0
- data/spec/type/windows/file_spec.rb +0 -36
- data/spec/type/windows/group_spec.rb +0 -4
- data/spec/type/windows/host_spec.rb +0 -20
- data/spec/type/windows/port_spec.rb +0 -4
- data/spec/type/windows/service_spec.rb +0 -8
- data/spec/type/windows/user_spec.rb +0 -8
- metadata +2 -5
- data/lib/serverspec/helper/properties.rb +0 -9
- data/spec/helper/properties_spec.rb +0 -11
data/lib/serverspec/type/user.rb
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
module Serverspec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
1
|
+
module Serverspec::Type
|
|
2
|
+
class User < Base
|
|
3
|
+
def exists?
|
|
4
|
+
@runner.check_user_exists(@name)
|
|
5
|
+
end
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
def belongs_to_group?(group)
|
|
8
|
+
@runner.check_user_belongs_to_group(@name, group)
|
|
9
|
+
end
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
def belongs_to_primary_group?(group)
|
|
12
|
+
@runner.check_user_belongs_to_primary_group(@name, group)
|
|
13
|
+
end
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
def has_uid?(uid)
|
|
16
|
+
@runner.check_user_has_uid(@name, uid)
|
|
17
|
+
end
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
def has_home_directory?(path)
|
|
20
|
+
@runner.check_user_has_home_directory(@name, path)
|
|
21
|
+
end
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
def has_login_shell?(shell)
|
|
24
|
+
@runner.check_user_has_login_shell(@name, shell)
|
|
25
|
+
end
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
end
|
|
27
|
+
def has_authorized_key?(key)
|
|
28
|
+
@runner.check_user_has_authorized_key(@name, key)
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
end
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
module Serverspec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@runner.check_feature_is_enabled(@name, provider)
|
|
6
|
-
end
|
|
1
|
+
module Serverspec::Type
|
|
2
|
+
class WindowsFeature < Base
|
|
3
|
+
def installed?(provider, version)
|
|
4
|
+
@runner.check_feature_is_enabled(@name, provider)
|
|
7
5
|
end
|
|
8
6
|
end
|
|
9
7
|
end
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
module Serverspec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@runner.check_hot_fix_is_installed(@name, version)
|
|
6
|
-
end
|
|
1
|
+
module Serverspec::Type
|
|
2
|
+
class WindowsHotFix < Base
|
|
3
|
+
def installed?(provider, version)
|
|
4
|
+
@runner.check_hot_fix_is_installed(@name, version)
|
|
7
5
|
end
|
|
8
6
|
end
|
|
9
7
|
end
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
module Serverspec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
1
|
+
module Serverspec::Type
|
|
2
|
+
class WindowsRegistryKey < Base
|
|
3
|
+
def exists?
|
|
4
|
+
@runner.check_registry_key_exists(@name)
|
|
5
|
+
end
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
def has_property?(property_name, property_type = :type_string)
|
|
8
|
+
@runner.check_registry_key_has_property(@name, {:name => property_name, :type => property_type})
|
|
9
|
+
end
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
def has_value?(value)
|
|
12
|
+
@runner.check_registry_key_has_value(@name, {:name => '', :type => :type_string, :value => value})
|
|
13
|
+
end
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
end
|
|
15
|
+
def has_property_value?(property_name, property_type, value)
|
|
16
|
+
@runner.check_registry_key_has_value(@name, {:name => property_name, :type => property_type, :value => value})
|
|
19
17
|
end
|
|
20
18
|
end
|
|
21
19
|
end
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
module Serverspec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@runner.check_scheduled_task_exists(@name)
|
|
6
|
-
end
|
|
1
|
+
module Serverspec::Type
|
|
2
|
+
class WindowsScheduledTask < Base
|
|
3
|
+
def exists?
|
|
4
|
+
@runner.check_scheduled_task_exists(@name)
|
|
7
5
|
end
|
|
8
6
|
end
|
|
9
7
|
end
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
module Serverspec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
1
|
+
module Serverspec::Type
|
|
2
|
+
class Yumrepo < Base
|
|
3
|
+
def exists?
|
|
4
|
+
@runner.check_yumrepo_exists(@name)
|
|
5
|
+
end
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
end
|
|
7
|
+
def enabled?
|
|
8
|
+
@runner.check_yumrepo_is_enabled(@name)
|
|
11
9
|
end
|
|
12
10
|
end
|
|
13
11
|
end
|
data/lib/serverspec/type/zfs.rb
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
module Serverspec
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
1
|
+
module Serverspec::Type
|
|
2
|
+
class Zfs < Base
|
|
3
|
+
def exists?
|
|
4
|
+
@runner.check_zfs_exists(@name)
|
|
5
|
+
end
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
def has_property?(property)
|
|
8
|
+
@runner.check_zfs_has_property(@name, property)
|
|
9
|
+
end
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
11
|
+
def to_s
|
|
12
|
+
'ZFS'
|
|
15
13
|
end
|
|
16
14
|
end
|
|
17
15
|
end
|
data/lib/serverspec/version.rb
CHANGED
data/lib/serverspec.rb
CHANGED
|
@@ -13,9 +13,10 @@ require 'rspec/core/formatters/base_formatter'
|
|
|
13
13
|
module RSpec::Core::Notifications
|
|
14
14
|
class FailedExampleNotification < ExampleNotification
|
|
15
15
|
def failure_lines
|
|
16
|
+
host = ENV['TARGET_HOST'] || Specinfra.configuration.host
|
|
16
17
|
@failure_lines ||=
|
|
17
18
|
begin
|
|
18
|
-
lines = ["On host `#{
|
|
19
|
+
lines = ["On host `#{host}`"]
|
|
19
20
|
lines << "Failure/Error: #{read_failed_line.strip}"
|
|
20
21
|
lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
|
|
21
22
|
exception.message.to_s.split("\n").each do |line|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Specinfra
|
|
|
13
13
|
CommandResult.new({
|
|
14
14
|
:stdout => ::Specinfra.configuration.stdout,
|
|
15
15
|
:stderr => ::Specinfra.configuration.stderr,
|
|
16
|
-
:exit_status =>
|
|
16
|
+
:exit_status => 0,
|
|
17
17
|
:exit_signal => nil,
|
|
18
18
|
})
|
|
19
19
|
end
|
|
@@ -23,11 +23,10 @@ module Specinfra
|
|
|
23
23
|
CommandResult.new({
|
|
24
24
|
:stdout => ::Specinfra.configuration.stdout,
|
|
25
25
|
:stderr => ::Specinfra.configuration.stderr,
|
|
26
|
-
:exit_status =>
|
|
26
|
+
:exit_status => 0,
|
|
27
27
|
:exit_signal => nil,
|
|
28
28
|
})
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
|
-
|
data/spec/type/aix/group_spec.rb
CHANGED
data/spec/type/aix/port_spec.rb
CHANGED
|
@@ -2,32 +2,19 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
set :os, :family => 'aix'
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
it('protocol: tcp') { should be_listening.with('tcp') }
|
|
10
|
-
|
|
11
|
-
it 'invalid protocol raises error' do
|
|
12
|
-
expect {
|
|
13
|
-
should be_listening.with('not implemented')
|
|
14
|
-
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it('on: 127.0.0.1') do
|
|
18
|
-
should be_listening.on('127.0.0.1')
|
|
19
|
-
end
|
|
5
|
+
describe port(80) do
|
|
6
|
+
it { should be_listening }
|
|
7
|
+
end
|
|
20
8
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
end
|
|
9
|
+
describe port(80) do
|
|
10
|
+
it { should be_listening.with('tcp') }
|
|
11
|
+
end
|
|
25
12
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
describe port(80) do
|
|
14
|
+
it { should be_listening.on('127.0.0.1') }
|
|
15
|
+
end
|
|
29
16
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
17
|
+
describe port(53) do
|
|
18
|
+
it { should be_listening.with('udp') }
|
|
33
19
|
end
|
|
20
|
+
|
|
@@ -6,14 +6,7 @@ describe service('sshd') do
|
|
|
6
6
|
it { should be_enabled }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe service('invalid-service') do
|
|
10
|
-
it { should_not be_enabled }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe service('sshd') do
|
|
14
10
|
it { should be_enabled.with_level(4) }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe service('invalid-service') do
|
|
18
|
-
it { should_not be_enabled.with_level(4) }
|
|
19
|
-
end
|
data/spec/type/aix/user_spec.rb
CHANGED
|
@@ -6,23 +6,11 @@ describe user('root') do
|
|
|
6
6
|
it { should belong_to_group 'root' }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe user('root') do
|
|
10
|
-
it { should_not belong_to_group 'invalid-group' }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe user('root') do
|
|
14
10
|
it { should have_login_shell '/bin/bash' }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe user('root') do
|
|
18
|
-
it { should_not have_login_shell 'invalid-login-shell' }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe user('root') do
|
|
22
14
|
it { should have_home_directory '/root' }
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
describe user('root') do
|
|
26
|
-
it { should_not have_home_directory 'invalid-home-directory' }
|
|
27
|
-
end
|
|
28
|
-
|
data/spec/type/arch/file_spec.rb
CHANGED
|
@@ -6,23 +6,10 @@ describe file('/tmp') do
|
|
|
6
6
|
it { should be_readable.by_user('mail') }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe file('/tmp') do
|
|
10
|
-
it { should_not be_readable.by_user('invalid-user') }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe file('/tmp') do
|
|
14
10
|
it { should be_writable.by_user('mail') }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe file('/tmp') do
|
|
18
|
-
it { should_not be_writable.by_user('invalid-user') }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
|
|
22
13
|
describe file('/tmp') do
|
|
23
14
|
it { should be_executable.by_user('mail') }
|
|
24
15
|
end
|
|
25
|
-
|
|
26
|
-
describe file('/tmp') do
|
|
27
|
-
it { should_not be_executable.by_user('invalid-user') }
|
|
28
|
-
end
|
|
@@ -2,24 +2,14 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
set :os, :family => 'arch'
|
|
4
4
|
|
|
5
|
-
=begin
|
|
6
5
|
describe package('httpd') do
|
|
7
6
|
it { should be_installed }
|
|
8
7
|
end
|
|
9
8
|
|
|
10
|
-
describe package('invalid-package') do
|
|
11
|
-
it { should_not be_installed }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
9
|
describe package('httpd') do
|
|
15
10
|
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
16
11
|
end
|
|
17
12
|
|
|
18
|
-
describe package('httpd') do
|
|
19
|
-
it { should_not be_installed.with_version('invalid-version') }
|
|
20
|
-
end
|
|
21
|
-
=end
|
|
22
|
-
|
|
23
13
|
describe package('httpd') do
|
|
24
14
|
let(:stdout) { "2.2.15\n" }
|
|
25
15
|
its(:version) { should eq '2.2.15' }
|
data/spec/type/base/cron_spec.rb
CHANGED
|
@@ -6,14 +6,6 @@ describe cron do
|
|
|
6
6
|
it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe cron do
|
|
10
|
-
it { should_not have_entry 'invalid entry' }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe cron do
|
|
14
10
|
it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') }
|
|
15
11
|
end
|
|
16
|
-
|
|
17
|
-
describe cron do
|
|
18
|
-
it { should_not have_entry('* * * * * /usr/local/bin/batch.sh').with_user('invalid-user') }
|
|
19
|
-
end
|
data/spec/type/base/file_spec.rb
CHANGED
|
@@ -6,26 +6,14 @@ describe file('/etc/ssh/sshd_config') do
|
|
|
6
6
|
it { should be_file }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe file('/etc/invalid_file') do
|
|
10
|
-
it { should_not be_file }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe file('/etc/ssh') do
|
|
14
10
|
it { should be_directory }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe file('/etc/invalid_directory') do
|
|
18
|
-
it { should_not be_directory }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe file('/var/run/unicorn.sock') do
|
|
22
14
|
it { should be_socket }
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
describe file('/etc/invalid_socket') do
|
|
26
|
-
it { should_not be_socket }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
17
|
describe file('/etc/ssh/sshd_config') do
|
|
30
18
|
it { should contain 'This is the sshd server system-wide configuration file' }
|
|
31
19
|
end
|
|
@@ -34,66 +22,34 @@ describe file('/etc/ssh/sshd_config') do
|
|
|
34
22
|
it { should contain /^This is the sshd server system-wide configuration file/ }
|
|
35
23
|
end
|
|
36
24
|
|
|
37
|
-
describe file('/etc/ssh/sshd_config') do
|
|
38
|
-
it { should_not contain 'This is invalid text!!' }
|
|
39
|
-
end
|
|
40
|
-
|
|
41
25
|
describe file('Gemfile') do
|
|
42
26
|
it { should contain('rspec').from(/^group :test do/).to(/^end/) }
|
|
43
27
|
end
|
|
44
28
|
|
|
45
|
-
describe file('/etc/ssh/sshd_config') do
|
|
46
|
-
it { should_not contain('This is invalid text!!').from(/^group :test do/).to(/^end/) }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
29
|
describe file('Gemfile') do
|
|
50
30
|
it { should contain('rspec').after(/^group :test do/) }
|
|
51
31
|
end
|
|
52
32
|
|
|
53
|
-
describe file('/etc/ssh/sshd_config') do
|
|
54
|
-
it { should_not contain('This is invalid text!!').after(/^group :test do/) }
|
|
55
|
-
end
|
|
56
|
-
|
|
57
33
|
describe file('Gemfile') do
|
|
58
34
|
it { should contain('rspec').before(/^end/) }
|
|
59
35
|
end
|
|
60
36
|
|
|
61
|
-
describe file('/etc/ssh/sshd_config') do
|
|
62
|
-
it { should_not contain('This is invalid text!!').before(/^end/) }
|
|
63
|
-
end
|
|
64
|
-
|
|
65
37
|
describe file('/etc/passwd') do
|
|
66
38
|
it { should be_mode 644 }
|
|
67
39
|
end
|
|
68
40
|
|
|
69
|
-
describe file('/etc/passwd') do
|
|
70
|
-
it { should_not be_mode 'invalid' }
|
|
71
|
-
end
|
|
72
|
-
|
|
73
41
|
describe file('/etc/passwd') do
|
|
74
42
|
it { should be_owned_by 'root' }
|
|
75
43
|
end
|
|
76
44
|
|
|
77
|
-
describe file('/etc/passwd') do
|
|
78
|
-
it { should_not be_owned_by 'invalid-owner' }
|
|
79
|
-
end
|
|
80
|
-
|
|
81
45
|
describe file('/etc/passwd') do
|
|
82
46
|
it { should be_grouped_into 'root' }
|
|
83
47
|
end
|
|
84
48
|
|
|
85
|
-
describe file('/etc/passwd') do
|
|
86
|
-
it { should_not be_grouped_into 'invalid-group' }
|
|
87
|
-
end
|
|
88
|
-
|
|
89
49
|
describe file('/etc/pam.d/system-auth') do
|
|
90
50
|
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
|
91
51
|
end
|
|
92
52
|
|
|
93
|
-
describe file('dummy-link') do
|
|
94
|
-
it { should_not be_linked_to '/invalid/target' }
|
|
95
|
-
end
|
|
96
|
-
|
|
97
53
|
describe file('/dev') do
|
|
98
54
|
let(:stdout) { "755\r\n" }
|
|
99
55
|
it { should be_readable }
|
|
@@ -219,10 +175,6 @@ describe file('/') do
|
|
|
219
175
|
it { should be_mounted }
|
|
220
176
|
end
|
|
221
177
|
|
|
222
|
-
describe file('/etc/invalid-mount') do
|
|
223
|
-
it { should_not be_mounted }
|
|
224
|
-
end
|
|
225
|
-
|
|
226
178
|
describe file('/') do
|
|
227
179
|
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
228
180
|
it { should be_mounted.with( :type => 'ext4' ) }
|
|
@@ -268,11 +220,6 @@ describe file('/') do
|
|
|
268
220
|
it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
|
|
269
221
|
end
|
|
270
222
|
|
|
271
|
-
describe file('/etc/invalid-mount') do
|
|
272
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
273
|
-
it { should_not be_mounted.with( :type => 'ext4' ) }
|
|
274
|
-
end
|
|
275
|
-
|
|
276
223
|
describe file('/') do
|
|
277
224
|
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
278
225
|
it do
|
|
@@ -6,14 +6,6 @@ describe group('root') do
|
|
|
6
6
|
it { should exist }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe group('invalid-group') do
|
|
10
|
-
it { should_not exist }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe group('root') do
|
|
14
10
|
it { should have_gid 0 }
|
|
15
11
|
end
|
|
16
|
-
|
|
17
|
-
describe group('root') do
|
|
18
|
-
it { should_not have_gid 'invalid-gid' }
|
|
19
|
-
end
|
data/spec/type/base/host_spec.rb
CHANGED
|
@@ -6,34 +6,18 @@ describe host('127.0.0.1') do
|
|
|
6
6
|
it { should be_resolvable }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe host('invalid-name') do
|
|
10
|
-
it { should_not be_resolvable }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe host('127.0.0.1') do
|
|
14
10
|
it { should be_resolvable.by('hosts') }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe host('invalid-name') do
|
|
18
|
-
it { should_not be_resolvable.by('hosts') }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe host('127.0.0.1') do
|
|
22
14
|
it { should be_resolvable.by('dns') }
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
describe host('invalid-name') do
|
|
26
|
-
it { should_not be_resolvable.by('dns') }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
17
|
describe host('127.0.0.1') do
|
|
30
18
|
it { should be_reachable }
|
|
31
19
|
end
|
|
32
20
|
|
|
33
|
-
describe host('invalid-host') do
|
|
34
|
-
it { should_not be_reachable }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
21
|
describe host('127.0.0.1') do
|
|
38
22
|
it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
|
|
39
23
|
end
|
|
@@ -46,10 +30,6 @@ describe host('127.0.0.1') do
|
|
|
46
30
|
it { should be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
|
|
47
31
|
end
|
|
48
32
|
|
|
49
|
-
describe host('invalid-host') do
|
|
50
|
-
it { should_not be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
33
|
describe host('example.jp') do
|
|
54
34
|
let(:stdout) { "1.2.3.4\r\n" }
|
|
55
35
|
its(:ipaddress) { should eq '1.2.3.4' }
|
|
@@ -3,69 +3,41 @@ require 'spec_helper'
|
|
|
3
3
|
set :os, :family => 'base'
|
|
4
4
|
|
|
5
5
|
describe package('jekyll') do
|
|
6
|
-
it { should be_installed.by(
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe package('invalid-gem') do
|
|
10
|
-
it { should_not be_installed.by('gem') }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe package('jekyll') do
|
|
14
|
-
it { should be_installed.by('gem').with_version('1.1.1') }
|
|
6
|
+
it { should be_installed.by(:gem) }
|
|
15
7
|
end
|
|
16
8
|
|
|
17
9
|
describe package('jekyll') do
|
|
18
|
-
it {
|
|
10
|
+
it { should be_installed.by(:gem).with_version('1.1.1') }
|
|
19
11
|
end
|
|
20
12
|
|
|
21
13
|
describe package('bower') do
|
|
22
|
-
it { should be_installed.by(
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe package('invalid-npm-package') do
|
|
26
|
-
it { should_not be_installed.by('npm') }
|
|
14
|
+
it { should be_installed.by(:npm) }
|
|
27
15
|
end
|
|
28
16
|
|
|
29
17
|
describe package('bower') do
|
|
30
|
-
it { should be_installed.by(
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe package('bower') do
|
|
34
|
-
it { should_not be_installed.by('npm').with_version('invalid-version') }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe package('mongo') do
|
|
38
|
-
it { should be_installed.by('pecl') }
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe package('invalid-pecl') do
|
|
42
|
-
it { should_not be_installed.by('pecl') }
|
|
18
|
+
it { should be_installed.by(:npm).with_version('0.9.2') }
|
|
43
19
|
end
|
|
44
20
|
|
|
45
21
|
describe package('mongo') do
|
|
46
|
-
it { should be_installed.by(
|
|
22
|
+
it { should be_installed.by(:pecl) }
|
|
47
23
|
end
|
|
48
24
|
|
|
49
25
|
describe package('mongo') do
|
|
50
|
-
it {
|
|
26
|
+
it { should be_installed.by(:pecl).with_version('1.4.1') }
|
|
51
27
|
end
|
|
52
28
|
|
|
53
29
|
describe package('XML_Util') do
|
|
54
|
-
it { should be_installed.by(
|
|
30
|
+
it { should be_installed.by(:pear).with_version('1.2.1') }
|
|
55
31
|
end
|
|
56
32
|
|
|
57
33
|
describe package('supervisor') do
|
|
58
|
-
it { should be_installed.by(
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe package('invalid-pip') do
|
|
62
|
-
it { should_not be_installed.by('pip').with_version('invalid-version') }
|
|
34
|
+
it { should be_installed.by(:pip).with_version('3.0') }
|
|
63
35
|
end
|
|
64
36
|
|
|
65
37
|
describe package('App::Ack') do
|
|
66
|
-
it { should be_installed.by(
|
|
38
|
+
it { should be_installed.by(:cpan) }
|
|
67
39
|
end
|
|
68
40
|
|
|
69
41
|
describe package('App::Ack') do
|
|
70
|
-
it { should be_installed.by(
|
|
42
|
+
it { should be_installed.by(:cpan).with_version('2.04') }
|
|
71
43
|
end
|