serverspec 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/serverspec/helper/type.rb +8 -2
- data/lib/serverspec/matchers/be_directory.rb +5 -1
- data/lib/serverspec/matchers/be_executable.rb +7 -3
- data/lib/serverspec/matchers/be_file.rb +5 -1
- data/lib/serverspec/matchers/be_grouped_into.rb +5 -1
- data/lib/serverspec/matchers/be_installed.rb +11 -7
- data/lib/serverspec/matchers/be_linked_to.rb +5 -1
- data/lib/serverspec/matchers/be_listening.rb +6 -2
- data/lib/serverspec/matchers/be_mode.rb +5 -1
- data/lib/serverspec/matchers/be_mounted.rb +5 -1
- data/lib/serverspec/matchers/be_owned_by.rb +5 -1
- data/lib/serverspec/matchers/be_readable.rb +7 -3
- data/lib/serverspec/matchers/be_writable.rb +7 -3
- data/lib/serverspec/matchers/contain.rb +9 -5
- data/lib/serverspec/matchers/match_md5checksum.rb +5 -1
- data/lib/serverspec/type/base.rb +14 -0
- data/lib/serverspec/type/file.rb +70 -0
- data/lib/serverspec/type/package.rb +19 -0
- data/lib/serverspec/type/port.rb +9 -0
- data/lib/serverspec/type/service.rb +1 -9
- data/lib/serverspec/version.rb +1 -1
- data/spec/darwin/file_spec.rb +40 -0
- data/spec/darwin/package_spec.rb +8 -0
- data/spec/darwin/port_spec.rb +7 -0
- data/spec/debian/file_spec.rb +39 -0
- data/spec/debian/package_spec.rb +9 -0
- data/spec/debian/port_spec.rb +7 -0
- data/spec/gentoo/file_spec.rb +40 -0
- data/spec/gentoo/package_spec.rb +9 -0
- data/spec/gentoo/port_spec.rb +7 -0
- data/spec/redhat/file_spec.rb +40 -0
- data/spec/redhat/package_spec.rb +9 -0
- data/spec/redhat/port_spec.rb +7 -0
- data/spec/solaris/file_spec.rb +40 -0
- data/spec/solaris/package_spec.rb +9 -0
- data/spec/solaris/port_spec.rb +7 -0
- data/spec/support/shared_file_examples.rb +557 -0
- data/spec/support/shared_package_examples.rb +41 -0
- data/spec/support/shared_port_examples.rb +11 -0
- metadata +42 -2
@@ -1,10 +1,16 @@
|
|
1
|
+
require 'serverspec/type/base'
|
1
2
|
require 'serverspec/type/service'
|
3
|
+
require 'serverspec/type/package'
|
4
|
+
require 'serverspec/type/port'
|
5
|
+
require 'serverspec/type/file'
|
2
6
|
|
3
7
|
module Serverspec
|
4
8
|
module Helper
|
5
9
|
module Type
|
6
|
-
|
7
|
-
|
10
|
+
%w( service package port file ).each do |type|
|
11
|
+
define_method type do |name|
|
12
|
+
self.class.const_get('Serverspec').const_get('Type').const_get(type.capitalize).new(name)
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
10
16
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
RSpec::Matchers.define :be_executable do
|
2
2
|
match do |file|
|
3
|
-
if
|
4
|
-
|
3
|
+
if file.respond_to?(:executable?)
|
4
|
+
file.executable?(@by_whom, @by_user)
|
5
5
|
else
|
6
|
-
|
6
|
+
if @by_user != nil
|
7
|
+
backend.check_access_by_user(example, file, @by_user, 'x')
|
8
|
+
else
|
9
|
+
backend.check_executable(example, file, @by_whom)
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
chain :by do |by_whom|
|
@@ -1,15 +1,19 @@
|
|
1
1
|
RSpec::Matchers.define :be_installed do
|
2
2
|
match do |name|
|
3
|
-
if
|
4
|
-
|
3
|
+
if name.respond_to?(:installed?)
|
4
|
+
name.installed?(@provider, @version)
|
5
5
|
else
|
6
|
-
|
6
|
+
if @provider.nil?
|
7
|
+
backend.check_installed(example, name)
|
8
|
+
else
|
9
|
+
check_method = "check_installed_by_#{@provider}".to_sym
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
unless backend.respond_to?(check_method)
|
12
|
+
raise ArgumentError.new("`be_installed` matcher doesn't support #{@under}")
|
13
|
+
end
|
11
14
|
|
12
|
-
|
15
|
+
backend.send(check_method, example, name, @version)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
RSpec::Matchers.define :be_listening do
|
2
2
|
match do |actual|
|
3
|
-
|
4
|
-
|
3
|
+
if actual.respond_to?(:listening?)
|
4
|
+
actual.listening?
|
5
|
+
else
|
6
|
+
port = actual.gsub(/port\s+/, '')
|
7
|
+
backend.check_listening(example, port)
|
8
|
+
end
|
5
9
|
end
|
6
10
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
RSpec::Matchers.define :be_mounted do
|
2
2
|
match do |path|
|
3
|
-
|
3
|
+
if path.respond_to?(:mounted?)
|
4
|
+
path.mounted?(@attr, @only_with)
|
5
|
+
else
|
6
|
+
backend.check_mounted(example, path, @attr, @only_with)
|
7
|
+
end
|
4
8
|
end
|
5
9
|
chain :with do |attr|
|
6
10
|
@attr = attr
|
@@ -1,9 +1,13 @@
|
|
1
1
|
RSpec::Matchers.define :be_readable do
|
2
2
|
match do |file|
|
3
|
-
if
|
4
|
-
|
3
|
+
if file.respond_to?(:readable?)
|
4
|
+
file.readable?(@by_whom, @by_user)
|
5
5
|
else
|
6
|
-
|
6
|
+
if @by_user != nil
|
7
|
+
backend.check_access_by_user(example, file, @by_user, 'r')
|
8
|
+
else
|
9
|
+
backend.check_readable(example, file, @by_whom)
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
chain :by do |by_whom|
|
@@ -1,9 +1,13 @@
|
|
1
1
|
RSpec::Matchers.define :be_writable do
|
2
2
|
match do |file|
|
3
|
-
if
|
4
|
-
|
3
|
+
if file.respond_to?(:writable?)
|
4
|
+
file.writable?(@by_whom, @by_user)
|
5
5
|
else
|
6
|
-
|
6
|
+
if @by_user != nil
|
7
|
+
backend.check_access_by_user(example, file, @by_user, 'w')
|
8
|
+
else
|
9
|
+
backend.check_writable(example, file, @by_whom)
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
chain :by do |by_whom|
|
@@ -1,12 +1,16 @@
|
|
1
1
|
RSpec::Matchers.define :contain do |pattern|
|
2
2
|
match do |file|
|
3
|
-
if (
|
4
|
-
|
3
|
+
if file.respond_to?(:contain)
|
4
|
+
file.contain(pattern, @from, @to)
|
5
5
|
else
|
6
|
-
|
6
|
+
if (@from || @to).nil?
|
7
|
+
cmd = backend.commands.check_file_contain(file, pattern)
|
8
|
+
else
|
9
|
+
cmd = backend.commands.check_file_contain_within(file, pattern, @from, @to)
|
10
|
+
end
|
11
|
+
ret = backend.run_command(cmd)
|
12
|
+
ret[:exit_status] == 0
|
7
13
|
end
|
8
|
-
ret = backend.run_command(cmd)
|
9
|
-
ret[:exit_status] == 0
|
10
14
|
end
|
11
15
|
# for contain(pattern).from(/A/).to(/B/)
|
12
16
|
chain :from do |from|
|
@@ -1,5 +1,9 @@
|
|
1
1
|
RSpec::Matchers.define :match_md5checksum do |pattern|
|
2
2
|
match do |file|
|
3
|
-
|
3
|
+
if file.respond_to?(:match_md5checksum)
|
4
|
+
file.match_md5checksum(pattern)
|
5
|
+
else
|
6
|
+
backend.check_file_md5checksum(example, file, pattern)
|
7
|
+
end
|
4
8
|
end
|
5
9
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Serverspec
|
2
|
+
module Type
|
3
|
+
class File < Base
|
4
|
+
def file?
|
5
|
+
backend.check_file(nil, @name)
|
6
|
+
end
|
7
|
+
|
8
|
+
def directory?
|
9
|
+
backend.check_directory(nil, @name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def contain(pattern, from, to)
|
13
|
+
if (@from || @to).nil?
|
14
|
+
cmd = backend.check_file_contain(nil, @name, pattern)
|
15
|
+
else
|
16
|
+
cmd = backend.check_file_contain_within(nil, @name, pattern, from, to)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def mode?(mode)
|
21
|
+
backend.check_mode(nil, @name, mode)
|
22
|
+
end
|
23
|
+
|
24
|
+
def owned_by?(owner)
|
25
|
+
backend.check_owner(nil, @name, owner)
|
26
|
+
end
|
27
|
+
|
28
|
+
def grouped_into?(group)
|
29
|
+
backend.check_grouped(nil, @name, group)
|
30
|
+
end
|
31
|
+
|
32
|
+
def linked_to?(target)
|
33
|
+
backend.check_link(nil, @name, target)
|
34
|
+
end
|
35
|
+
|
36
|
+
def readable?(by_whom, by_user)
|
37
|
+
if by_user != nil
|
38
|
+
backend.check_access_by_user(nil, @name, by_user, 'r')
|
39
|
+
else
|
40
|
+
backend.check_readable(nil, @name, by_whom)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def writable?(by_whom, by_user)
|
45
|
+
if by_user != nil
|
46
|
+
backend.check_access_by_user(nil, @name, by_user, 'w')
|
47
|
+
else
|
48
|
+
backend.check_writable(nil, @name, by_whom)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def executable?(by_whom, by_user)
|
53
|
+
if by_user != nil
|
54
|
+
backend.check_access_by_user(nil, @name, by_user, 'x')
|
55
|
+
else
|
56
|
+
backend.check_executable(nil, @name, by_whom)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def mounted?(attr, only_with)
|
61
|
+
backend.check_mounted(nil, @name, attr, only_with)
|
62
|
+
end
|
63
|
+
|
64
|
+
def match_md5checksum(md5sum)
|
65
|
+
backend.check_file_md5checksum(nil, @name, md5sum)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Serverspec
|
2
|
+
module Type
|
3
|
+
class Package < Base
|
4
|
+
def installed?(provider, version)
|
5
|
+
if provider.nil?
|
6
|
+
backend.check_installed(nil, @name)
|
7
|
+
else
|
8
|
+
check_method = "check_installed_by_#{provider}".to_sym
|
9
|
+
|
10
|
+
unless backend.respond_to?(check_method)
|
11
|
+
raise ArgumentError.new("`be_installed` matcher doesn't support #{provider}")
|
12
|
+
end
|
13
|
+
|
14
|
+
backend.send(check_method, nil, @name, version)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,10 +1,6 @@
|
|
1
1
|
module Serverspec
|
2
2
|
module Type
|
3
|
-
class Service
|
4
|
-
def initialize name
|
5
|
-
@name = name
|
6
|
-
end
|
7
|
-
|
3
|
+
class Service < Base
|
8
4
|
def enabled?
|
9
5
|
backend.check_enabled(nil, @name)
|
10
6
|
end
|
@@ -22,10 +18,6 @@ module Serverspec
|
|
22
18
|
backend.check_running(nil, @name)
|
23
19
|
end
|
24
20
|
end
|
25
|
-
|
26
|
-
def to_s
|
27
|
-
"Service #{@name}"
|
28
|
-
end
|
29
21
|
end
|
30
22
|
end
|
31
23
|
end
|
data/lib/serverspec/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::Darwin
|
4
|
+
|
5
|
+
describe 'Serverspec service matchers of Darwin family' do
|
6
|
+
it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
|
7
|
+
it_behaves_like 'support file be_directory matcher', '/etc/ssh'
|
8
|
+
it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
|
9
|
+
it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
|
10
|
+
it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
|
11
|
+
it_behaves_like 'support file contain before matcher', 'Gemfile', 'rspec', /^end/
|
12
|
+
it_behaves_like 'support file be_mode matcher', '/etc/passwd', 644
|
13
|
+
it_behaves_like 'support file be_owned_by matcher', '/etc/passwd', 'root'
|
14
|
+
it_behaves_like 'support file be_grouped_into matcher', '/etc/passwd', 'root'
|
15
|
+
it_behaves_like 'support file be_linked_to matcher', '/etc/pam.d/system-auth', '/etc/pam.d/system-auth-ac'
|
16
|
+
|
17
|
+
it_behaves_like 'support file be_readable matcher', '/dev'
|
18
|
+
it_behaves_like 'support file be_readable by owner matcher', '/dev'
|
19
|
+
it_behaves_like 'support file be_readable by group matcher', '/dev'
|
20
|
+
it_behaves_like 'support file be_readable by others matcher', '/dev'
|
21
|
+
it_behaves_like 'support file be_readable by specific user matcher', '/tmp', 'mail'
|
22
|
+
|
23
|
+
it_behaves_like 'support file be_writable matcher', '/dev'
|
24
|
+
it_behaves_like 'support file be_writable by owner matcher', '/dev'
|
25
|
+
it_behaves_like 'support file be_writable by group matcher', '/dev'
|
26
|
+
it_behaves_like 'support file be_writable by others matcher', '/dev'
|
27
|
+
it_behaves_like 'support file be_writable by specific user matcher', '/tmp', 'mail'
|
28
|
+
|
29
|
+
it_behaves_like 'support file be_executable matcher', '/dev'
|
30
|
+
it_behaves_like 'support file be_executable by owner matcher', '/dev'
|
31
|
+
it_behaves_like 'support file be_executable by group matcher', '/dev'
|
32
|
+
it_behaves_like 'support file be_executable by others matcher', '/dev'
|
33
|
+
it_behaves_like 'support file be_executable by specific user matcher', '/tmp', 'mail'
|
34
|
+
|
35
|
+
it_behaves_like 'support file be_mounted matcher', '/'
|
36
|
+
it_behaves_like 'support file be_mounted with matcher', '/'
|
37
|
+
it_behaves_like 'support file be_mounted only with matcher', '/'
|
38
|
+
|
39
|
+
it_behaves_like 'support file match_md5checksum matcher', '/etc/services', '35435ea447c19f0ea5ef971837ab9ced'
|
40
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::Darwin
|
4
|
+
|
5
|
+
describe 'Serverspec package matchers of Darwin family' do
|
6
|
+
it_behaves_like 'support package installed by gem matcher', 'jekyll'
|
7
|
+
it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
|
8
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::Debian
|
4
|
+
|
5
|
+
describe 'Serverspec service matchers of Debian family' do
|
6
|
+
it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
|
7
|
+
it_behaves_like 'support file be_directory matcher', '/etc/ssh'
|
8
|
+
it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
|
9
|
+
it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
|
10
|
+
it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
|
11
|
+
it_behaves_like 'support file contain before matcher', 'Gemfile', 'rspec', /^end/
|
12
|
+
it_behaves_like 'support file be_mode matcher', '/etc/passwd', 644
|
13
|
+
it_behaves_like 'support file be_owned_by matcher', '/etc/passwd', 'root'
|
14
|
+
it_behaves_like 'support file be_grouped_into matcher', '/etc/passwd', 'root'
|
15
|
+
it_behaves_like 'support file be_linked_to matcher', '/etc/pam.d/system-auth', '/etc/pam.d/system-auth-ac'
|
16
|
+
|
17
|
+
it_behaves_like 'support file be_readable matcher', '/dev'
|
18
|
+
it_behaves_like 'support file be_readable by owner matcher', '/dev'
|
19
|
+
it_behaves_like 'support file be_readable by group matcher', '/dev'
|
20
|
+
it_behaves_like 'support file be_readable by others matcher', '/dev'
|
21
|
+
it_behaves_like 'support file be_readable by specific user matcher', '/tmp', 'mail'
|
22
|
+
|
23
|
+
it_behaves_like 'support file be_writable matcher', '/dev'
|
24
|
+
it_behaves_like 'support file be_writable by owner matcher', '/dev'
|
25
|
+
it_behaves_like 'support file be_writable by group matcher', '/dev'
|
26
|
+
it_behaves_like 'support file be_writable by others matcher', '/dev'
|
27
|
+
it_behaves_like 'support file be_writable by specific user matcher', '/tmp', 'mail'
|
28
|
+
|
29
|
+
it_behaves_like 'support file be_executable matcher', '/dev'
|
30
|
+
it_behaves_like 'support file be_executable by owner matcher', '/dev'
|
31
|
+
it_behaves_like 'support file be_executable by group matcher', '/dev'
|
32
|
+
it_behaves_like 'support file be_executable by others matcher', '/dev'
|
33
|
+
it_behaves_like 'support file be_executable by specific user matcher', '/tmp', 'mail'
|
34
|
+
|
35
|
+
it_behaves_like 'support file be_mounted matcher', '/'
|
36
|
+
it_behaves_like 'support file be_mounted with matcher', '/'
|
37
|
+
it_behaves_like 'support file be_mounted only with matcher', '/'
|
38
|
+
|
39
|
+
it_behaves_like 'support file match_md5checksum matcher', '/etc/services', '35435ea447c19f0ea5ef971837ab9ced'end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::Debian
|
4
|
+
|
5
|
+
describe 'Serverspec package matchers of Debian family' do
|
6
|
+
it_behaves_like 'support package installed matcher', 'httpd'
|
7
|
+
it_behaves_like 'support package installed by gem matcher', 'jekyll'
|
8
|
+
it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
|
9
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::Gentoo
|
4
|
+
|
5
|
+
describe 'Serverspec service matchers of Gentoo family' do
|
6
|
+
it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
|
7
|
+
it_behaves_like 'support file be_directory matcher', '/etc/ssh'
|
8
|
+
it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
|
9
|
+
it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
|
10
|
+
it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
|
11
|
+
it_behaves_like 'support file contain before matcher', 'Gemfile', 'rspec', /^end/
|
12
|
+
it_behaves_like 'support file be_mode matcher', '/etc/passwd', 644
|
13
|
+
it_behaves_like 'support file be_owned_by matcher', '/etc/passwd', 'root'
|
14
|
+
it_behaves_like 'support file be_grouped_into matcher', '/etc/passwd', 'root'
|
15
|
+
it_behaves_like 'support file be_linked_to matcher', '/etc/pam.d/system-auth', '/etc/pam.d/system-auth-ac'
|
16
|
+
|
17
|
+
it_behaves_like 'support file be_readable matcher', '/dev'
|
18
|
+
it_behaves_like 'support file be_readable by owner matcher', '/dev'
|
19
|
+
it_behaves_like 'support file be_readable by group matcher', '/dev'
|
20
|
+
it_behaves_like 'support file be_readable by others matcher', '/dev'
|
21
|
+
it_behaves_like 'support file be_readable by specific user matcher', '/tmp', 'mail'
|
22
|
+
|
23
|
+
it_behaves_like 'support file be_writable matcher', '/dev'
|
24
|
+
it_behaves_like 'support file be_writable by owner matcher', '/dev'
|
25
|
+
it_behaves_like 'support file be_writable by group matcher', '/dev'
|
26
|
+
it_behaves_like 'support file be_writable by others matcher', '/dev'
|
27
|
+
it_behaves_like 'support file be_writable by specific user matcher', '/tmp', 'mail'
|
28
|
+
|
29
|
+
it_behaves_like 'support file be_executable matcher', '/dev'
|
30
|
+
it_behaves_like 'support file be_executable by owner matcher', '/dev'
|
31
|
+
it_behaves_like 'support file be_executable by group matcher', '/dev'
|
32
|
+
it_behaves_like 'support file be_executable by others matcher', '/dev'
|
33
|
+
it_behaves_like 'support file be_executable by specific user matcher', '/tmp', 'mail'
|
34
|
+
|
35
|
+
it_behaves_like 'support file be_mounted matcher', '/'
|
36
|
+
it_behaves_like 'support file be_mounted with matcher', '/'
|
37
|
+
it_behaves_like 'support file be_mounted only with matcher', '/'
|
38
|
+
|
39
|
+
it_behaves_like 'support file match_md5checksum matcher', '/etc/services', '35435ea447c19f0ea5ef971837ab9ced'
|
40
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::Gentoo
|
4
|
+
|
5
|
+
describe 'Serverspec package matchers of Gentoo family' do
|
6
|
+
it_behaves_like 'support package installed matcher', 'httpd'
|
7
|
+
it_behaves_like 'support package installed by gem matcher', 'jekyll'
|
8
|
+
it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
|
9
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::RedHat
|
4
|
+
|
5
|
+
describe 'Serverspec service matchers of Red Hat family' do
|
6
|
+
it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
|
7
|
+
it_behaves_like 'support file be_directory matcher', '/etc/ssh'
|
8
|
+
it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
|
9
|
+
it_behaves_like 'support file contain from to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
|
10
|
+
it_behaves_like 'support file contain after matcher', 'Gemfile', 'rspec', /^group :test do/
|
11
|
+
it_behaves_like 'support file contain before matcher', 'Gemfile', 'rspec', /^end/
|
12
|
+
it_behaves_like 'support file be_mode matcher', '/etc/passwd', 644
|
13
|
+
it_behaves_like 'support file be_owned_by matcher', '/etc/passwd', 'root'
|
14
|
+
it_behaves_like 'support file be_grouped_into matcher', '/etc/passwd', 'root'
|
15
|
+
it_behaves_like 'support file be_linked_to matcher', '/etc/pam.d/system-auth', '/etc/pam.d/system-auth-ac'
|
16
|
+
|
17
|
+
it_behaves_like 'support file be_readable matcher', '/dev'
|
18
|
+
it_behaves_like 'support file be_readable by owner matcher', '/dev'
|
19
|
+
it_behaves_like 'support file be_readable by group matcher', '/dev'
|
20
|
+
it_behaves_like 'support file be_readable by others matcher', '/dev'
|
21
|
+
it_behaves_like 'support file be_readable by specific user matcher', '/tmp', 'mail'
|
22
|
+
|
23
|
+
it_behaves_like 'support file be_writable matcher', '/dev'
|
24
|
+
it_behaves_like 'support file be_writable by owner matcher', '/dev'
|
25
|
+
it_behaves_like 'support file be_writable by group matcher', '/dev'
|
26
|
+
it_behaves_like 'support file be_writable by others matcher', '/dev'
|
27
|
+
it_behaves_like 'support file be_writable by specific user matcher', '/tmp', 'mail'
|
28
|
+
|
29
|
+
it_behaves_like 'support file be_executable matcher', '/dev'
|
30
|
+
it_behaves_like 'support file be_executable by owner matcher', '/dev'
|
31
|
+
it_behaves_like 'support file be_executable by group matcher', '/dev'
|
32
|
+
it_behaves_like 'support file be_executable by others matcher', '/dev'
|
33
|
+
it_behaves_like 'support file be_executable by specific user matcher', '/tmp', 'mail'
|
34
|
+
|
35
|
+
it_behaves_like 'support file be_mounted matcher', '/'
|
36
|
+
it_behaves_like 'support file be_mounted with matcher', '/'
|
37
|
+
it_behaves_like 'support file be_mounted only with matcher', '/'
|
38
|
+
|
39
|
+
it_behaves_like 'support file match_md5checksum matcher', '/etc/services', '35435ea447c19f0ea5ef971837ab9ced'
|
40
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::RedHat
|
4
|
+
|
5
|
+
describe 'Serverspec package matchers of Red Hat family' do
|
6
|
+
it_behaves_like 'support package installed matcher', 'httpd'
|
7
|
+
it_behaves_like 'support package installed by gem matcher', 'jekyll'
|
8
|
+
it_behaves_like 'support package installed by gem with version matcher', 'jekyll', '1.1.1'
|
9
|
+
end
|