serverspec 2.0.0.beta8 → 2.0.0.beta9
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/spec/spec_helper.rb
CHANGED
@@ -18,5 +18,16 @@ module Specinfra
|
|
18
18
|
})
|
19
19
|
end
|
20
20
|
end
|
21
|
+
class Cmd < Base
|
22
|
+
def run_command cmd
|
23
|
+
CommandResult.new({
|
24
|
+
:stdout => ::Specinfra.configuration.stdout,
|
25
|
+
:stderr => ::Specinfra.configuration.stderr,
|
26
|
+
:exit_status => cmd.to_s =~ /invalid/ ? 1 : 0,
|
27
|
+
:exit_signal => nil,
|
28
|
+
})
|
29
|
+
end
|
30
|
+
end
|
21
31
|
end
|
22
32
|
end
|
33
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, {:family => 'aix'}
|
4
|
+
|
5
|
+
describe commands.command_class('file').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Aix::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 be_writable.by_user('mail') }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe file('/tmp') do
|
18
|
+
it { should be_executable.by_user('mail') }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe file('/etc/passwd') do
|
22
|
+
it 'be_mode is not implemented' do
|
23
|
+
expect {
|
24
|
+
should be_mode 644
|
25
|
+
}.to raise_error(Specinfra::Command::Base::NotImplementedError)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe file('/etc/passwd') do
|
30
|
+
it { should be_owned_by 'root' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe file('/etc/passwd') do
|
34
|
+
it { should be_grouped_into 'root' }
|
35
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'aix'
|
4
|
+
|
5
|
+
describe commands.command_class('group').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Aix::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
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'aix'
|
4
|
+
|
5
|
+
describe commands.command_class('package').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Aix::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
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'aix'
|
4
|
+
|
5
|
+
describe commands.command_class('port').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Aix::Base::Port) }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Serverspec::Type::Port do
|
10
|
+
describe port(80) do
|
11
|
+
it { should be_listening }
|
12
|
+
|
13
|
+
it('protocol: tcp') { should be_listening.with('tcp') }
|
14
|
+
|
15
|
+
it 'invalid protocol raises error' do
|
16
|
+
expect {
|
17
|
+
should be_listening.with('not implemented')
|
18
|
+
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
19
|
+
end
|
20
|
+
|
21
|
+
it('on: 127.0.0.1') do
|
22
|
+
should be_listening.on('127.0.0.1')
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'invalid local address raises error' do
|
26
|
+
expect{ should be_listening.on('') }.to raise_error(ArgumentError)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe port('invalid') do
|
31
|
+
it { should_not be_listening }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe port(123) do
|
35
|
+
it { should be_listening.with("udp") }
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'aix'
|
4
|
+
|
5
|
+
describe commands.command_class('service').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Aix::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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'aix'
|
4
|
+
|
5
|
+
describe commands.command_class('user').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Aix::Base::User) }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe user('root') do
|
10
|
+
it { should belong_to_group 'root' }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe user('root') do
|
14
|
+
it { should_not belong_to_group 'invalid-group' }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe user('root') do
|
18
|
+
it { should have_login_shell '/bin/bash' }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe user('root') do
|
22
|
+
it { should_not have_login_shell 'invalid-login-shell' }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe user('root') do
|
26
|
+
it { should have_home_directory '/root' }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe user('root') do
|
30
|
+
it { should_not have_home_directory 'invalid-home-directory' }
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'arch'
|
4
|
+
|
5
|
+
describe commands.command_class('file').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Arch::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
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'arch'
|
4
|
+
|
5
|
+
describe commands.command_class('package').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Arch::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,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'arch'
|
4
|
+
|
5
|
+
describe commands.command_class('service').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Arch::Base::Service) }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe service('sshd') do
|
10
|
+
it { should be_enabled }
|
11
|
+
it { should be_running }
|
12
|
+
end
|
13
|
+
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
4
|
|
5
|
-
=begin
|
6
5
|
describe command('cat /etc/resolv.conf') do
|
7
6
|
let(:stdout) { "nameserver 127.0.0.1\r\n" }
|
8
7
|
it { should return_stdout("nameserver 127.0.0.1") }
|
@@ -44,7 +43,6 @@ end
|
|
44
43
|
describe command('cat /etc/resolv.conf') do
|
45
44
|
it { should return_exit_status 0 }
|
46
45
|
end
|
47
|
-
=end
|
48
46
|
|
49
47
|
describe command('ls -al /') do
|
50
48
|
let(:stdout) { <<EOF
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('cron').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::Cron) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe cron do
|
6
10
|
it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, {:family => 'base'}
|
4
|
+
|
5
|
+
describe commands.command_class('file').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::File) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe file('/etc/ssh/sshd_config') do
|
6
10
|
it { should be_file }
|
@@ -134,14 +138,6 @@ describe file('/dev') do
|
|
134
138
|
it { should_not be_readable.by('others') }
|
135
139
|
end
|
136
140
|
|
137
|
-
describe file('/tmp') do
|
138
|
-
it { should be_readable.by_user('mail') }
|
139
|
-
end
|
140
|
-
|
141
|
-
describe file('/tmp') do
|
142
|
-
it { should_not be_readable.by_user('invalid-user') }
|
143
|
-
end
|
144
|
-
|
145
141
|
describe file('/dev') do
|
146
142
|
let(:stdout) { "755\r\n" }
|
147
143
|
it { should be_writable }
|
@@ -182,13 +178,6 @@ describe file('/dev') do
|
|
182
178
|
it { should_not be_writable.by('others') }
|
183
179
|
end
|
184
180
|
|
185
|
-
describe file('/tmp') do
|
186
|
-
it { should be_writable.by_user('mail') }
|
187
|
-
end
|
188
|
-
|
189
|
-
describe file('/tmp') do
|
190
|
-
it { should_not be_writable.by_user('invalid-user') }
|
191
|
-
end
|
192
181
|
|
193
182
|
describe file('/dev') do
|
194
183
|
let(:stdout) { "755\r\n" }
|
@@ -230,14 +219,6 @@ describe file('/dev') do
|
|
230
219
|
it { should_not be_executable.by('others') }
|
231
220
|
end
|
232
221
|
|
233
|
-
describe file('/tmp') do
|
234
|
-
it { should be_executable.by_user('mail') }
|
235
|
-
end
|
236
|
-
|
237
|
-
describe file('/tmp') do
|
238
|
-
it { should_not be_executable.by_user('invalid-user') }
|
239
|
-
end
|
240
|
-
|
241
222
|
describe file('/') do
|
242
223
|
it { should be_mounted }
|
243
224
|
end
|
@@ -390,3 +371,21 @@ EOF
|
|
390
371
|
|
391
372
|
its(:content) { should match /root:x:0:0/ }
|
392
373
|
end
|
374
|
+
|
375
|
+
describe file('/etc/passwd') do
|
376
|
+
let(:stdout) { Time.now.to_i.to_s }
|
377
|
+
its(:mtime) { should > DateTime.now.prev_day(1) }
|
378
|
+
end
|
379
|
+
|
380
|
+
describe file('/etc/passwod') do
|
381
|
+
let(:stdout) { 100.to_s }
|
382
|
+
its(:size) { should > 0 }
|
383
|
+
end
|
384
|
+
|
385
|
+
describe file('/etc/passwd') do
|
386
|
+
it 'be_immutable is not implemented in base class' do
|
387
|
+
expect {
|
388
|
+
should be_immutable
|
389
|
+
}.to raise_error(Specinfra::Command::Base::NotImplementedError)
|
390
|
+
end
|
391
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('group').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::Group) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe group('root') do
|
6
10
|
it { should exist }
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('host').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::Host) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe host('127.0.0.1') do
|
6
10
|
it { should be_resolvable }
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('mail_alias').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::MailAlias) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe mail_alias('daemon') do
|
6
10
|
it { should be_aliased_to "root" }
|
@@ -1,29 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
4
|
|
5
|
-
describe
|
6
|
-
it { should
|
7
|
-
end
|
8
|
-
|
9
|
-
describe package('invalid-package') do
|
10
|
-
it { should_not be_installed }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe package('invalid-package') do
|
14
|
-
it { should_not be_installed.by('rpm') }
|
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 be_installed.by('rpm').with_version('2.2.15-28.el6') }
|
23
|
-
end
|
24
|
-
|
25
|
-
describe package('httpd') do
|
26
|
-
it { should_not be_installed.with_version('invalid-version') }
|
5
|
+
describe commands.command_class('package').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::Package) }
|
27
7
|
end
|
28
8
|
|
29
9
|
describe package('jekyll') do
|
@@ -58,7 +38,6 @@ describe package('bower') do
|
|
58
38
|
it { should_not be_installed.by('npm').with_version('invalid-version') }
|
59
39
|
end
|
60
40
|
|
61
|
-
|
62
41
|
describe package('mongo') do
|
63
42
|
it { should be_installed.by('pecl') }
|
64
43
|
end
|
@@ -94,11 +73,3 @@ end
|
|
94
73
|
describe package('App::Ack') do
|
95
74
|
it { should be_installed.by('cpan').with_version('2.04') }
|
96
75
|
end
|
97
|
-
|
98
|
-
describe package('httpd') do
|
99
|
-
let(:stdout) { "2.2.15\n" }
|
100
|
-
its(:version) { should eq '2.2.15' }
|
101
|
-
its(:version) { should > '2.2.14' }
|
102
|
-
its(:version) { should < '2.2.16' }
|
103
|
-
its(:version) { should > '2.2.9' }
|
104
|
-
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('port').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::Port) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe Serverspec::Type::Port do
|
6
10
|
describe port(80) do
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('process').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::Process) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe process("memcached") do
|
6
10
|
let(:stdout) { " 1407\n" }
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('routing_table').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::RoutingTable) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe routing_table do
|
6
10
|
let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
|
@@ -1,22 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
it { should be_enabled }
|
8
|
-
end
|
9
|
-
|
10
|
-
describe service('invalid-service') do
|
11
|
-
it { should_not be_enabled }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe service('sshd') do
|
15
|
-
it { should be_enabled.with_level(4) }
|
16
|
-
end
|
17
|
-
|
18
|
-
describe service('invalid-service') do
|
19
|
-
it { should_not be_enabled.with_level(4) }
|
5
|
+
describe commands.command_class('service').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::Service) }
|
20
7
|
end
|
21
8
|
|
22
9
|
describe service('sshd') do
|
@@ -52,7 +39,7 @@ describe service('sshd') do
|
|
52
39
|
it {
|
53
40
|
expect {
|
54
41
|
should be_running.under('not implemented')
|
55
|
-
}.to raise_error(
|
42
|
+
}.to raise_error(Specinfra::Command::Base::NotImplementedError)
|
56
43
|
}
|
57
44
|
end
|
58
45
|
|
@@ -66,15 +53,10 @@ describe service('sshd') do
|
|
66
53
|
it { should_not be_monitored_by('monit') }
|
67
54
|
end
|
68
55
|
|
69
|
-
|
70
|
-
=end
|
71
|
-
|
72
56
|
describe service('invalid-daemon') do
|
73
57
|
it { should_not be_monitored_by('monit') }
|
74
58
|
end
|
75
59
|
|
76
|
-
=begin
|
77
|
-
|
78
60
|
describe service('unicorn') do
|
79
61
|
it { should be_monitored_by('god') }
|
80
62
|
end
|
@@ -87,8 +69,6 @@ describe service('sshd') do
|
|
87
69
|
it {
|
88
70
|
expect {
|
89
71
|
should be_monitored_by('not implemented')
|
90
|
-
}.to raise_error(
|
72
|
+
}.to raise_error(Specinfra::Command::Base::NotImplementedError)
|
91
73
|
}
|
92
74
|
end
|
93
|
-
|
94
|
-
=end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
set :os, :family => 'base'
|
4
|
+
|
5
|
+
describe commands.command_class('user').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Base::User) }
|
7
|
+
end
|
4
8
|
|
5
9
|
describe user('root') do
|
6
10
|
it { should exist }
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'darwin'
|
4
|
+
|
5
|
+
describe commands.command_class('file').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Darwin::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 be_writable.by_user('mail') }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe file('/tmp') do
|
18
|
+
it { should be_executable.by_user('mail') }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe file('/etc/services') do
|
22
|
+
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe file('/etc/services') do
|
26
|
+
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe file('/etc/pam.d/system-auth') do
|
30
|
+
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe file('/etc/passwd') do
|
34
|
+
it { should be_mode 644 }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe file('/etc/passwd') do
|
38
|
+
it { should be_owned_by 'root' }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe file('/etc/passwd') do
|
42
|
+
it { should be_grouped_into 'root' }
|
43
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'darwin'
|
4
|
+
|
5
|
+
describe commands.command_class('package').create do
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Darwin::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
|
+
|