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,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'darwin'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('port').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Darwin::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,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'darwin'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Darwin::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,39 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'debian'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Debian::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('apt') }
|
|
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('apt').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 => 'debian'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Debian::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,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'fedora'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Fedora::Base::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('sshd') do
|
|
14
|
+
it { should be_enabled.with_level(4) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe service('sshd') do
|
|
18
|
+
it { should be_running }
|
|
19
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'fedora', :release => 15
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Fedora::V15::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('sshd') do
|
|
14
|
+
it { should be_enabled.with_level(4) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe service('sshd') do
|
|
18
|
+
it { should be_running }
|
|
19
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'fedora', :release => 20
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Fedora::V15::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('sshd') do
|
|
14
|
+
it { should be_enabled.with_level(4) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe service('sshd') do
|
|
18
|
+
it { should be_running }
|
|
19
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Freebsd::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,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('port').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Freebsd::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,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Freebsd::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,31 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd', :release => 10
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Freebsd::V10::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,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'gentoo'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Gentoo::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,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'gentoo'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Gentoo::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,38 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, {:family => 'linux'}
|
|
4
|
+
|
|
5
|
+
property[:os_by_host] = nil
|
|
6
|
+
|
|
7
|
+
describe commands.command_class('file').create do
|
|
8
|
+
it { should be_an_instance_of(Specinfra::Command::Linux::Base::File) }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe file('/tmp') do
|
|
12
|
+
it { should be_readable.by_user('mail') }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe file('/tmp') do
|
|
16
|
+
it { should_not be_readable.by_user('invalid-user') }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe file('/tmp') do
|
|
20
|
+
it { should be_writable.by_user('mail') }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe file('/tmp') do
|
|
24
|
+
it { should_not be_writable.by_user('invalid-user') }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
describe file('/tmp') do
|
|
29
|
+
it { should be_executable.by_user('mail') }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe file('/tmp') do
|
|
33
|
+
it { should_not be_executable.by_user('invalid-user') }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe file('/tmp') do
|
|
37
|
+
it { should be_immutable }
|
|
38
|
+
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
set :os, :family => 'linux'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('interface').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Linux::Base::Interface) }
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
describe interface('eth0') do
|
|
6
10
|
let(:stdout) { '1000' }
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
set :os, :family => 'linux'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('iptables').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Linux::Base::Iptables) }
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
describe iptables do
|
|
6
|
-
it { should have_rule '-P INPUT ACCEPT'
|
|
10
|
+
it { should have_rule '-P INPUT ACCEPT' }
|
|
7
11
|
end
|
|
8
12
|
|
|
9
13
|
describe iptables do
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'linux'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('kernel_module').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Linux::Base::KernelModule) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe kernel_module('lp') do
|
|
10
|
+
it { should be_loaded }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe kernel_module('invalid-module') do
|
|
14
|
+
it { should_not be_loaded }
|
|
15
|
+
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
set :os, :family => 'linux'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('lxc_container').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Linux::Base::LxcContainer) }
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
describe lxc('ct01') do
|
|
6
10
|
it { should exist }
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
set :os, :family => 'linux'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('selinux').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Linux::Base::Selinux)}
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
describe selinux do
|
|
6
10
|
it { should be_enforcing }
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
set :os, :family => 'linux'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('zfs').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Linux::Base::Zfs) }
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
describe zfs('rpool') do
|
|
6
10
|
it { should exist }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'nixos'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('package').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Nixos::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('nix') }
|
|
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('nix').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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'nixos'
|
|
4
|
+
|
|
5
|
+
describe commands.command_class('service').create do
|
|
6
|
+
it { should be_an_instance_of(Specinfra::Command::Nixos::Base::Service) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled }
|
|
11
|
+
it { should be_running }
|
|
12
|
+
end
|
|
13
|
+
|