serverspec 2.0.0.beta8 → 2.0.0.beta9
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/Rakefile +24 -2
- data/lib/serverspec/setup.rb +6 -8
- data/lib/serverspec/type/cgroup.rb +1 -0
- data/lib/serverspec/type/command.rb +1 -1
- data/lib/serverspec/type/cron.rb +1 -1
- data/lib/serverspec/type/default_gateway.rb +2 -2
- data/lib/serverspec/type/file.rb +21 -17
- data/lib/serverspec/type/group.rb +2 -2
- data/lib/serverspec/type/host.rb +3 -3
- data/lib/serverspec/type/iis_app_pool.rb +2 -2
- data/lib/serverspec/type/iis_website.rb +5 -5
- data/lib/serverspec/type/interface.rb +1 -1
- data/lib/serverspec/type/ipfilter.rb +1 -1
- data/lib/serverspec/type/ipnat.rb +1 -1
- data/lib/serverspec/type/iptables.rb +1 -1
- data/lib/serverspec/type/kernel_module.rb +1 -1
- data/lib/serverspec/type/lxc.rb +2 -2
- data/lib/serverspec/type/mail_alias.rb +1 -1
- data/lib/serverspec/type/package.rb +2 -7
- data/lib/serverspec/type/port.rb +1 -1
- data/lib/serverspec/type/ppa.rb +2 -2
- data/lib/serverspec/type/routing_table.rb +1 -1
- data/lib/serverspec/type/selinux.rb +3 -3
- data/lib/serverspec/type/service.rb +7 -15
- data/lib/serverspec/type/user.rb +12 -6
- data/lib/serverspec/type/windows_feature.rb +1 -1
- data/lib/serverspec/type/windows_hot_fix.rb +1 -1
- data/lib/serverspec/type/windows_registry_key.rb +4 -4
- data/lib/serverspec/type/windows_scheduled_task.rb +1 -1
- data/lib/serverspec/type/yumrepo.rb +2 -2
- data/lib/serverspec/type/zfs.rb +2 -2
- data/lib/serverspec/version.rb +1 -1
- data/serverspec.gemspec +1 -1
- data/spec/spec_helper.rb +11 -0
- data/spec/type/aix/file_spec.rb +35 -0
- data/spec/type/aix/group_spec.rb +15 -0
- data/spec/type/aix/package_spec.rb +15 -0
- data/spec/type/aix/port_spec.rb +37 -0
- data/spec/type/aix/service_spec.rb +23 -0
- data/spec/type/aix/user_spec.rb +32 -0
- data/spec/type/arch/file_spec.rb +32 -0
- data/spec/type/arch/package_spec.rb +31 -0
- data/spec/type/arch/service_spec.rb +13 -0
- data/spec/type/{command_spec.rb → base/command_spec.rb} +1 -3
- data/spec/type/{cron_spec.rb → base/cron_spec.rb} +5 -1
- data/spec/type/{default_gateway_spec.rb → base/default_gateway_spec.rb} +1 -1
- data/spec/type/{file_spec.rb → base/file_spec.rb} +23 -24
- data/spec/type/{group_spec.rb → base/group_spec.rb} +5 -1
- data/spec/type/{host_spec.rb → base/host_spec.rb} +5 -1
- data/spec/type/{mail_alias_spec.rb → base/mail_alias_spec.rb} +5 -1
- data/spec/type/{package_spec.rb → base/package_spec.rb} +3 -32
- data/spec/type/{php_config_spec.rb → base/php_config_spec.rb} +1 -1
- data/spec/type/{port_spec.rb → base/port_spec.rb} +5 -1
- data/spec/type/{process_spec.rb → base/process_spec.rb} +5 -1
- data/spec/type/{routing_table_spec.rb → base/routing_table_spec.rb} +5 -1
- data/spec/type/{service_spec.rb → base/service_spec.rb} +5 -25
- data/spec/type/{user_spec.rb → base/user_spec.rb} +5 -1
- data/spec/type/darwin/file_spec.rb +43 -0
- data/spec/type/darwin/package_spec.rb +24 -0
- data/spec/type/darwin/port_spec.rb +37 -0
- data/spec/type/darwin/service_spec.rb +32 -0
- data/spec/type/debian/package_spec.rb +39 -0
- data/spec/type/debian/service_spec.rb +23 -0
- data/spec/type/fedora/service_spec.rb +19 -0
- data/spec/type/fedora15/service_spec.rb +19 -0
- data/spec/type/fedora20/service_spec.rb +19 -0
- data/spec/type/freebsd/file_spec.rb +11 -0
- data/spec/type/freebsd/package_spec.rb +31 -0
- data/spec/type/freebsd/port_spec.rb +37 -0
- data/spec/type/freebsd/service_spec.rb +16 -0
- data/spec/type/freebsd10/package_spec.rb +31 -0
- data/spec/type/gentoo/package_spec.rb +16 -0
- data/spec/type/gentoo/service_spec.rb +24 -0
- data/spec/type/{cgroup_spec.rb → linux/cgroup_spec.rb} +1 -1
- data/spec/type/linux/file_spec.rb +38 -0
- data/spec/type/{interface_spec.rb → linux/interface_spec.rb} +5 -1
- data/spec/type/{iptables_spec.rb → linux/iptables_spec.rb} +6 -2
- data/spec/type/linux/kernel_module_spec.rb +15 -0
- data/spec/type/{linux_kernel_parameter_spec.rb → linux/linux_kernel_parameter_spec.rb} +1 -1
- data/spec/type/{lxc_spec.rb → linux/lxc_container_spec.rb} +5 -1
- data/spec/type/{selinux_spec.rb → linux/selinux_spec.rb} +5 -1
- data/spec/type/{zfs_spec.rb → linux/zfs_spec.rb} +5 -1
- data/spec/type/nixos/package_spec.rb +31 -0
- data/spec/type/nixos/service_spec.rb +13 -0
- data/spec/type/openbsd/file_spec.rb +174 -0
- data/spec/type/openbsd/interface_spec.rb +25 -0
- data/spec/type/openbsd/mail_alias_spec.rb +15 -0
- data/spec/type/openbsd/package_spec.rb +24 -0
- data/spec/type/openbsd/port_spec.rb +11 -0
- data/spec/type/openbsd/service_spec.rb +24 -0
- data/spec/type/openbsd/user_spec.rb +24 -0
- data/spec/type/opensuse/service_spec.rb +32 -0
- data/spec/type/plamo/package_spec.rb +16 -0
- data/spec/type/plamo/service_spec.rb +16 -0
- data/spec/type/redhat/file_spec.rb +36 -0
- data/spec/type/redhat/package_spec.rb +39 -0
- data/spec/type/redhat/service_spec.rb +23 -0
- data/spec/type/{yumrepo_spec.rb → redhat/yumrepo_spec.rb} +5 -1
- data/spec/type/redhat5/iptables_spec.rb +23 -0
- data/spec/type/redhat7/service_spec.rb +13 -0
- data/spec/type/smartos/package_spec.rb +31 -0
- data/spec/type/smartos/service_spec.rb +32 -0
- data/spec/type/solaris/cron_spec.rb +23 -0
- data/spec/type/solaris/file_spec.rb +33 -0
- data/spec/type/solaris/group_spec.rb +15 -0
- data/spec/type/solaris/host_spec.rb +31 -0
- data/spec/type/solaris/ipfilter_spec.rb +11 -0
- data/spec/type/solaris/ipnat_spec.rb +11 -0
- data/spec/type/solaris/package_spec.rb +15 -0
- data/spec/type/solaris/port_spec.rb +37 -0
- data/spec/type/solaris/service_spec.rb +32 -0
- data/spec/type/solaris/user_spec.rb +32 -0
- data/spec/type/solaris/zfs_spec.rb +19 -0
- data/spec/type/solaris10/file_spec.rb +391 -0
- data/spec/type/solaris10/group_spec.rb +16 -0
- data/spec/type/solaris10/host_spec.rb +24 -0
- data/spec/type/solaris10/package_spec.rb +15 -0
- data/spec/type/solaris10/user_spec.rb +16 -0
- data/spec/type/suse/package_spec.rb +39 -0
- data/spec/type/suse/service_spec.rb +23 -0
- data/spec/type/ubuntu/ppa_spec.rb +23 -0
- data/spec/type/ubuntu/service_spec.rb +15 -0
- data/spec/type/windows/command_spec.rb +65 -0
- data/spec/type/windows/feature_spec.rb +13 -0
- data/spec/type/windows/file_spec.rb +161 -0
- data/spec/type/windows/group_spec.rb +31 -0
- data/spec/type/windows/host_spec.rb +56 -0
- data/spec/type/windows/hot_fix_spec.rb +26 -0
- data/spec/type/windows/iis_app_pool_spec.rb +18 -0
- data/spec/type/windows/iis_webisite_spec.rb +30 -0
- data/spec/type/windows/package_spec.rb +14 -0
- data/spec/type/windows/port_spec.rb +33 -0
- data/spec/type/windows/registry_key_spec.rb +62 -0
- data/spec/type/windows/scheduled_task_spec.rb +13 -0
- data/spec/type/windows/service_spec.rb +42 -0
- data/spec/type/windows/user_spec.rb +45 -0
- metadata +208 -50
- data/spec/type/kernel_module_spec.rb +0 -11
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, {:family => 'openbsd'}
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('file').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Openbsd::Base::File) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe file('/etc/passwd') do
|
|
10
|
+
it { should be_mode 644 }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe file('/etc/passwd') do
|
|
14
|
+
it { should_not be_mode 'invalid' }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe file('/etc/passwd') do
|
|
18
|
+
it { should be_owned_by 'root' }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe file('/etc/passwd') do
|
|
22
|
+
it { should_not be_owned_by 'invalid-owner' }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe file('/etc/passwd') do
|
|
26
|
+
it { should be_grouped_into 'root' }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe file('/etc/passwd') do
|
|
30
|
+
it { should_not be_grouped_into 'invalid-group' }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe file('/etc/pam.d/system-auth') do
|
|
34
|
+
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe file('dummy-link') do
|
|
38
|
+
it { should_not be_linked_to '/invalid/target' }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe file('/') do
|
|
42
|
+
it { should be_mounted }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe file('/etc/invalid-mount') do
|
|
46
|
+
it { should_not be_mounted }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe file('/') do
|
|
50
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
51
|
+
it { should be_mounted.with( :type => 'ext4' ) }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe file('/') do
|
|
55
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
56
|
+
it { should be_mounted.with( :type => 'ext4', :options => { :rw => true } ) }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe file('/') do
|
|
60
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
61
|
+
it { should be_mounted.with( :type => 'ext4', :options => { :mode => 620 } ) }
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe file('/') do
|
|
65
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
66
|
+
it { should be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe file('/') do
|
|
70
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
71
|
+
it { should_not be_mounted.with( :type => 'xfs' ) }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
describe file('/') do
|
|
75
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
76
|
+
it { should_not be_mounted.with( :type => 'ext4', :options => { :rw => false } ) }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe file('/') do
|
|
80
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
81
|
+
it { should_not be_mounted.with( :type => 'ext4', :options => { :mode => 600 } ) }
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
describe file('/') do
|
|
85
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
86
|
+
it { should_not be_mounted.with( :type => 'xfs', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe file('/') do
|
|
90
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
91
|
+
it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe file('/etc/invalid-mount') do
|
|
95
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
96
|
+
it { should_not be_mounted.with( :type => 'ext4' ) }
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
describe file('/') do
|
|
100
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
101
|
+
it do
|
|
102
|
+
should be_mounted.only_with(
|
|
103
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
|
104
|
+
:type => 'ext4',
|
|
105
|
+
:options => {
|
|
106
|
+
:rw => true,
|
|
107
|
+
:mode => 620,
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
describe file('/') do
|
|
114
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
115
|
+
it do
|
|
116
|
+
should_not be_mounted.only_with(
|
|
117
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
|
118
|
+
:type => 'ext4',
|
|
119
|
+
:options => {
|
|
120
|
+
:rw => true,
|
|
121
|
+
:mode => 620,
|
|
122
|
+
:bind => true,
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
describe file('/') do
|
|
129
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
130
|
+
it do
|
|
131
|
+
should_not be_mounted.only_with(
|
|
132
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
|
133
|
+
:type => 'ext4',
|
|
134
|
+
:options => {
|
|
135
|
+
:rw => true,
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
describe file('/') do
|
|
142
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
143
|
+
it do
|
|
144
|
+
should_not be_mounted.only_with(
|
|
145
|
+
:device => '/dev/mapper/VolGroup-lv_roooooooooot',
|
|
146
|
+
:type => 'ext4',
|
|
147
|
+
:options => {
|
|
148
|
+
:rw => true,
|
|
149
|
+
:mode => 620,
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
describe file('/etc/invalid-mount') do
|
|
156
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
157
|
+
it { should_not be_mounted.only_with( :type => 'ext4' ) }
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
describe file('/etc/services') do
|
|
161
|
+
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
describe file('invalid-file') do
|
|
165
|
+
it { should_not match_md5checksum 'INVALIDMD5CHECKSUM' }
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
describe file('/etc/services') do
|
|
169
|
+
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
describe file('invalid-file') do
|
|
173
|
+
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
|
174
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'openbsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('interface').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Openbsd::Base::Interface) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe interface('eth0') do
|
|
10
|
+
let(:stdout) { '1000' }
|
|
11
|
+
its(:speed) { should eq 1000 }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe interface('eth0') do
|
|
15
|
+
it { should have_ipv4_address("192.168.10.10") }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe interface('eth0') do
|
|
19
|
+
it { should have_ipv4_address("192.168.10.10/24") }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe interface('invalid-interface') do
|
|
23
|
+
let(:stdout) { '1000' }
|
|
24
|
+
its(:speed) { should_not eq 100 }
|
|
25
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'openbsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('mail_alias').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Openbsd::Base::MailAlias) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe mail_alias('daemon') do
|
|
10
|
+
it { should be_aliased_to "root" }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe mail_alias('invalid-recipient') do
|
|
14
|
+
it { should_not be_aliased_to "foo" }
|
|
15
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'openbsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Openbsd::Base::Package) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe package('httpd') do
|
|
10
|
+
it { should be_installed }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe package('invalid-package') do
|
|
14
|
+
it { should_not be_installed }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe package('httpd') do
|
|
18
|
+
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe package('httpd') do
|
|
22
|
+
it { should_not be_installed.with_version('invalid-version') }
|
|
23
|
+
end
|
|
24
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'openbsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Openbsd::Base::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('invalid-service') do
|
|
14
|
+
it { should_not be_enabled }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe service('sshd') do
|
|
18
|
+
it { should be_running }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe service('invalid-service') do
|
|
22
|
+
it { should_not be_running }
|
|
23
|
+
end
|
|
24
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'openbsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('user').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Openbsd::Base::User) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe user('root') do
|
|
10
|
+
it { should have_login_shell '/bin/bash' }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe user('root') do
|
|
14
|
+
it { should_not have_login_shell 'invalid-login-shell' }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe user('root') do
|
|
18
|
+
it { should have_home_directory '/root' }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe user('root') do
|
|
22
|
+
it { should_not have_home_directory 'invalid-home-directory' }
|
|
23
|
+
end
|
|
24
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'opensuse'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Opensuse::Base::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('invalid-service') do
|
|
14
|
+
it { should_not be_enabled }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe service('sshd') do
|
|
18
|
+
it { should be_enabled.with_level(4) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe service('invalid-service') do
|
|
22
|
+
it { should_not be_enabled.with_level(4) }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe service('sshd') do
|
|
26
|
+
it { should be_running }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe service('invalid-service') do
|
|
30
|
+
it { should_not be_running }
|
|
31
|
+
end
|
|
32
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'plamo'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Plamo::Base::Package) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe package('httpd') do
|
|
10
|
+
it { should be_installed }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe package('invalid-package') do
|
|
14
|
+
it { should_not be_installed }
|
|
15
|
+
end
|
|
16
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'plamo'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Plamo::Base::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('invalid-service') do
|
|
14
|
+
it { should_not be_enabled }
|
|
15
|
+
end
|
|
16
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'redhat'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('file').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Redhat::Base::File) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe file('/tmp') do
|
|
10
|
+
it { should be_readable.by_user('mail') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe file('/tmp') do
|
|
14
|
+
it { should_not be_readable.by_user('invalid-user') }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe file('/tmp') do
|
|
18
|
+
it { should be_writable.by_user('mail') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe file('/tmp') do
|
|
22
|
+
it { should_not be_writable.by_user('invalid-user') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
describe file('/tmp') do
|
|
27
|
+
it { should be_executable.by_user('mail') }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe file('/tmp') do
|
|
31
|
+
it { should_not be_executable.by_user('invalid-user') }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe file('/tmp') do
|
|
35
|
+
it { should be_immutable }
|
|
36
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'redhat'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Redhat::Base::Package) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe package('httpd') do
|
|
10
|
+
it { should be_installed }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe package('invalid-package') do
|
|
14
|
+
it { should_not be_installed }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe package('invalid-package') do
|
|
18
|
+
it { should_not be_installed.by('rpm') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe package('httpd') do
|
|
22
|
+
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe package('httpd') do
|
|
26
|
+
it { should be_installed.by('rpm').with_version('2.2.15-28.el6') }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe package('httpd') do
|
|
30
|
+
it { should_not be_installed.with_version('invalid-version') }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe package('httpd') do
|
|
34
|
+
let(:stdout) { "2.2.15\n" }
|
|
35
|
+
its(:version) { should eq '2.2.15' }
|
|
36
|
+
its(:version) { should > '2.2.14' }
|
|
37
|
+
its(:version) { should < '2.2.16' }
|
|
38
|
+
its(:version) { should > '2.2.9' }
|
|
39
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'redhat'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Redhat::Base::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('invalid-service') do
|
|
14
|
+
it { should_not be_enabled }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe service('sshd') do
|
|
18
|
+
it { should be_enabled.with_level(4) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe service('invalid-service') do
|
|
22
|
+
it { should_not be_enabled.with_level(4) }
|
|
23
|
+
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
set :os, :family => 'redhat'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('yumrepo').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Redhat::Base::Yumrepo) }
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
describe 'Serverspec yumrepo matchers of Red Hat family' do
|
|
6
10
|
describe 'exist' do
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'redhat', :release => 5
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('iptables').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Redhat::V5::Iptables) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe iptables do
|
|
10
|
+
it { should have_rule '-P INPUT ACCEPT' }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe iptables do
|
|
14
|
+
it { should_not have_rule 'invalid-rule' }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe iptables do
|
|
18
|
+
it { should have_rule('-P INPUT ACCEPT').with_table('mangle').with_chain('INPUT') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe iptables do
|
|
22
|
+
it { should_not have_rule('invalid-rule').with_table('mangle').with_chain('INPUT') }
|
|
23
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'redhat', :release => 7
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Redhat::V7::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
it { should be_running }
|
|
12
|
+
end
|
|
13
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'smartos'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Smartos::Base::Package) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe package('httpd') do
|
|
10
|
+
it { should be_installed }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe package('invalid-package') do
|
|
14
|
+
it { should_not be_installed }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe package('httpd') do
|
|
18
|
+
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe package('httpd') do
|
|
22
|
+
it { should_not be_installed.with_version('invalid-version') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe package('httpd') do
|
|
26
|
+
let(:stdout) { "2.2.15\n" }
|
|
27
|
+
its(:version) { should eq '2.2.15' }
|
|
28
|
+
its(:version) { should > '2.2.14' }
|
|
29
|
+
its(:version) { should < '2.2.16' }
|
|
30
|
+
its(:version) { should > '2.2.9' }
|
|
31
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'smartos'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Smartos::Base::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('invalid-service') do
|
|
14
|
+
it { should_not be_enabled }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe service('sshd') do
|
|
18
|
+
it { should be_running }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe service('invalid-service') do
|
|
22
|
+
it { should_not be_running }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe service('sshd') do
|
|
26
|
+
it { should have_property :foo => 'bar' }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe service('invalid-service') do
|
|
30
|
+
it { should_not have_property :foo => 'bar' }
|
|
31
|
+
end
|
|
32
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'solaris'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('cron').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Solaris::Base::Cron) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe cron do
|
|
10
|
+
it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe cron do
|
|
14
|
+
it { should_not have_entry 'invalid entry' }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe cron do
|
|
18
|
+
it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe cron do
|
|
22
|
+
it { should_not have_entry('* * * * * /usr/local/bin/batch.sh').with_user('invalid-user') }
|
|
23
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'solaris'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('file').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Solaris::Base::File) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe file('/tmp') do
|
|
10
|
+
it { should be_readable.by_user('mail') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe file('/tmp') do
|
|
14
|
+
it { should_not be_readable.by_user('invalid-user') }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe file('/tmp') do
|
|
18
|
+
it { should be_writable.by_user('mail') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe file('/tmp') do
|
|
22
|
+
it { should_not be_writable.by_user('invalid-user') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
describe file('/tmp') do
|
|
27
|
+
it { should be_executable.by_user('mail') }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe file('/tmp') do
|
|
31
|
+
it { should_not be_executable.by_user('invalid-user') }
|
|
32
|
+
end
|
|
33
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'solaris'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('group').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Solaris::Base::Group) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe group('root') do
|
|
10
|
+
it { should have_gid 0 }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe group('root') do
|
|
14
|
+
it { should_not have_gid 'invalid-gid' }
|
|
15
|
+
end
|