serverspec-ruby19 2.24.3
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 +7 -0
- data/.gitignore +26 -0
- data/.gitmodules +3 -0
- data/.travis.yml +19 -0
- data/Gemfile +8 -0
- data/Guardfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +30 -0
- data/WINDOWS_SUPPORT.md +118 -0
- data/appveyor.yml +56 -0
- data/bin/serverspec-init +7 -0
- data/lib/serverspec.rb +63 -0
- data/lib/serverspec/commands/base.rb +7 -0
- data/lib/serverspec/helper.rb +8 -0
- data/lib/serverspec/helper/type.rb +26 -0
- data/lib/serverspec/matcher.rb +39 -0
- data/lib/serverspec/matcher/be_enabled.rb +13 -0
- data/lib/serverspec/matcher/be_enforcing.rb +10 -0
- data/lib/serverspec/matcher/be_executable.rb +13 -0
- data/lib/serverspec/matcher/be_installed.rb +13 -0
- data/lib/serverspec/matcher/be_listening.rb +13 -0
- data/lib/serverspec/matcher/be_mounted.rb +15 -0
- data/lib/serverspec/matcher/be_permissive.rb +10 -0
- data/lib/serverspec/matcher/be_reachable.rb +17 -0
- data/lib/serverspec/matcher/be_readable.rb +13 -0
- data/lib/serverspec/matcher/be_resolvable.rb +9 -0
- data/lib/serverspec/matcher/be_running.rb +13 -0
- data/lib/serverspec/matcher/be_writable.rb +13 -0
- data/lib/serverspec/matcher/belong_to_group.rb +5 -0
- data/lib/serverspec/matcher/belong_to_primary_group.rb +5 -0
- data/lib/serverspec/matcher/contain.rb +28 -0
- data/lib/serverspec/matcher/have_entry.rb +14 -0
- data/lib/serverspec/matcher/have_rule.rb +17 -0
- data/lib/serverspec/matcher/have_site_application.rb +18 -0
- data/lib/serverspec/matcher/have_site_bindings.rb +22 -0
- data/lib/serverspec/matcher/have_virtual_dir.rb +14 -0
- data/lib/serverspec/power_assert.rb +14 -0
- data/lib/serverspec/setup.rb +338 -0
- data/lib/serverspec/subject.rb +12 -0
- data/lib/serverspec/type/base.rb +30 -0
- data/lib/serverspec/type/bond.rb +11 -0
- data/lib/serverspec/type/bridge.rb +11 -0
- data/lib/serverspec/type/cgroup.rb +17 -0
- data/lib/serverspec/type/command.rb +20 -0
- data/lib/serverspec/type/cron.rb +15 -0
- data/lib/serverspec/type/default_gateway.rb +15 -0
- data/lib/serverspec/type/docker_base.rb +29 -0
- data/lib/serverspec/type/docker_container.rb +27 -0
- data/lib/serverspec/type/docker_image.rb +4 -0
- data/lib/serverspec/type/file.rb +133 -0
- data/lib/serverspec/type/fstab.rb +11 -0
- data/lib/serverspec/type/group.rb +11 -0
- data/lib/serverspec/type/host.rb +21 -0
- data/lib/serverspec/type/iis_app_pool.rb +43 -0
- data/lib/serverspec/type/iis_website.rb +40 -0
- data/lib/serverspec/type/interface.rb +27 -0
- data/lib/serverspec/type/ip6tables.rb +13 -0
- data/lib/serverspec/type/ipfilter.rb +11 -0
- data/lib/serverspec/type/ipnat.rb +11 -0
- data/lib/serverspec/type/iptables.rb +11 -0
- data/lib/serverspec/type/kernel_module.rb +7 -0
- data/lib/serverspec/type/linux_audit_system.rb +45 -0
- data/lib/serverspec/type/linux_kernel_parameter.rb +10 -0
- data/lib/serverspec/type/lxc.rb +15 -0
- data/lib/serverspec/type/mail_alias.rb +7 -0
- data/lib/serverspec/type/mysql_config.rb +10 -0
- data/lib/serverspec/type/package.rb +66 -0
- data/lib/serverspec/type/php_config.rb +10 -0
- data/lib/serverspec/type/port.rb +40 -0
- data/lib/serverspec/type/ppa.rb +11 -0
- data/lib/serverspec/type/process.rb +27 -0
- data/lib/serverspec/type/routing_table.rb +11 -0
- data/lib/serverspec/type/selinux.rb +19 -0
- data/lib/serverspec/type/selinux_module.rb +11 -0
- data/lib/serverspec/type/service.rb +52 -0
- data/lib/serverspec/type/user.rb +43 -0
- data/lib/serverspec/type/windows_feature.rb +7 -0
- data/lib/serverspec/type/windows_hot_fix.rb +7 -0
- data/lib/serverspec/type/windows_registry_key.rb +19 -0
- data/lib/serverspec/type/windows_scheduled_task.rb +7 -0
- data/lib/serverspec/type/x509_certificate.rb +76 -0
- data/lib/serverspec/type/x509_private_key.rb +21 -0
- data/lib/serverspec/type/yumrepo.rb +11 -0
- data/lib/serverspec/type/zfs.rb +29 -0
- data/lib/serverspec/version.rb +3 -0
- data/serverspec.gemspec +28 -0
- data/spec/helper/type_spec.rb +6 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/type/aix/file_spec.rb +31 -0
- data/spec/type/aix/group_spec.rb +7 -0
- data/spec/type/aix/package_spec.rb +7 -0
- data/spec/type/aix/port_spec.rb +20 -0
- data/spec/type/aix/service_spec.rb +12 -0
- data/spec/type/aix/user_spec.rb +16 -0
- data/spec/type/arch/file_spec.rb +15 -0
- data/spec/type/arch/package_spec.rb +19 -0
- data/spec/type/arch/service_spec.rb +9 -0
- data/spec/type/base/command_spec.rb +67 -0
- data/spec/type/base/cron_spec.rb +11 -0
- data/spec/type/base/default_gateway_spec.rb +11 -0
- data/spec/type/base/file_spec.rb +356 -0
- data/spec/type/base/group_spec.rb +11 -0
- data/spec/type/base/host_spec.rb +47 -0
- data/spec/type/base/mail_alias_spec.rb +7 -0
- data/spec/type/base/mysql_config_spec.rb +13 -0
- data/spec/type/base/package_spec.rb +51 -0
- data/spec/type/base/php_config_spec.rb +33 -0
- data/spec/type/base/port_spec.rb +34 -0
- data/spec/type/base/process_spec.rb +35 -0
- data/spec/type/base/routing_table_spec.rb +63 -0
- data/spec/type/base/service_spec.rb +49 -0
- data/spec/type/base/user_spec.rb +44 -0
- data/spec/type/darwin/file_spec.rb +41 -0
- data/spec/type/darwin/package_spec.rb +19 -0
- data/spec/type/darwin/port_spec.rb +27 -0
- data/spec/type/darwin/service_spec.rb +16 -0
- data/spec/type/debian/package_spec.rb +23 -0
- data/spec/type/debian/service_spec.rb +11 -0
- data/spec/type/fedora/service_spec.rb +15 -0
- data/spec/type/fedora15/service_spec.rb +15 -0
- data/spec/type/fedora20/service_spec.rb +15 -0
- data/spec/type/freebsd/file_spec.rb +29 -0
- data/spec/type/freebsd/package_spec.rb +19 -0
- data/spec/type/freebsd/port_spec.rb +27 -0
- data/spec/type/freebsd/service_spec.rb +8 -0
- data/spec/type/freebsd10/package_spec.rb +19 -0
- data/spec/type/gentoo/package_spec.rb +7 -0
- data/spec/type/gentoo/service_spec.rb +12 -0
- data/spec/type/linux/bond_spec.rb +12 -0
- data/spec/type/linux/bridge_spec.rb +12 -0
- data/spec/type/linux/cgroup_spec.rb +13 -0
- data/spec/type/linux/docker_container_pre_1_8_spec.rb +124 -0
- data/spec/type/linux/docker_container_spec.rb +126 -0
- data/spec/type/linux/docker_image_spec.rb +94 -0
- data/spec/type/linux/file_spec.rb +27 -0
- data/spec/type/linux/fstab_spec.rb +31 -0
- data/spec/type/linux/interface_spec.rb +30 -0
- data/spec/type/linux/ip6tables_spec.rb +19 -0
- data/spec/type/linux/iptables_spec.rb +11 -0
- data/spec/type/linux/kernel_module_spec.rb +7 -0
- data/spec/type/linux/linux_audit_system_spec.rb +139 -0
- data/spec/type/linux/linux_kernel_parameter_spec.rb +33 -0
- data/spec/type/linux/lxc_container_spec.rb +12 -0
- data/spec/type/linux/selinux_module_spec.rb +11 -0
- data/spec/type/linux/selinux_spec.rb +23 -0
- data/spec/type/linux/x509_certificate_spec.rb +62 -0
- data/spec/type/linux/x509_private_key_spec.rb +31 -0
- data/spec/type/linux/zfs_spec.rb +15 -0
- data/spec/type/nixos/package_spec.rb +15 -0
- data/spec/type/nixos/service_spec.rb +9 -0
- data/spec/type/openbsd/file_spec.rb +134 -0
- data/spec/type/openbsd/interface_spec.rb +21 -0
- data/spec/type/openbsd/mail_alias_spec.rb +7 -0
- data/spec/type/openbsd/package_spec.rb +11 -0
- data/spec/type/openbsd/port_spec.rb +7 -0
- data/spec/type/openbsd/service_spec.rb +13 -0
- data/spec/type/openbsd/user_spec.rb +12 -0
- data/spec/type/opensuse/service_spec.rb +16 -0
- data/spec/type/plamo/package_spec.rb +8 -0
- data/spec/type/plamo/service_spec.rb +8 -0
- data/spec/type/redhat/file_spec.rb +19 -0
- data/spec/type/redhat/package_spec.rb +23 -0
- data/spec/type/redhat/service_spec.rb +11 -0
- data/spec/type/redhat/yumrepo_spec.rb +11 -0
- data/spec/type/redhat5/iptables_spec.rb +11 -0
- data/spec/type/redhat7/service_spec.rb +9 -0
- data/spec/type/smartos/package_spec.rb +19 -0
- data/spec/type/smartos/service_spec.rb +16 -0
- data/spec/type/solaris/cron_spec.rb +11 -0
- data/spec/type/solaris/file_spec.rb +15 -0
- data/spec/type/solaris/group_spec.rb +7 -0
- data/spec/type/solaris/host_spec.rb +19 -0
- data/spec/type/solaris/ipfilter_spec.rb +7 -0
- data/spec/type/solaris/ipnat_spec.rb +7 -0
- data/spec/type/solaris/package_spec.rb +7 -0
- data/spec/type/solaris/port_spec.rb +34 -0
- data/spec/type/solaris/service_spec.rb +16 -0
- data/spec/type/solaris/user_spec.rb +16 -0
- data/spec/type/solaris/zfs_spec.rb +15 -0
- data/spec/type/solaris10/file_spec.rb +313 -0
- data/spec/type/solaris10/group_spec.rb +8 -0
- data/spec/type/solaris10/host_spec.rb +16 -0
- data/spec/type/solaris10/package_spec.rb +8 -0
- data/spec/type/solaris10/user_spec.rb +8 -0
- data/spec/type/suse/package_spec.rb +23 -0
- data/spec/type/suse/service_spec.rb +11 -0
- data/spec/type/ubuntu/ppa_spec.rb +11 -0
- data/spec/type/ubuntu/service_spec.rb +7 -0
- data/spec/type/windows/command_spec.rb +64 -0
- data/spec/type/windows/feature_spec.rb +17 -0
- data/spec/type/windows/file_spec.rb +120 -0
- data/spec/type/windows/group_spec.rb +23 -0
- data/spec/type/windows/host_spec.rb +32 -0
- data/spec/type/windows/hot_fix_spec.rb +22 -0
- data/spec/type/windows/iis_app_pool_spec.rb +17 -0
- data/spec/type/windows/iis_webisite_spec.rb +16 -0
- data/spec/type/windows/package_spec.rb +10 -0
- data/spec/type/windows/port_spec.rb +25 -0
- data/spec/type/windows/registry_key_spec.rb +58 -0
- data/spec/type/windows/scheduled_task_spec.rb +9 -0
- data/spec/type/windows/service_spec.rb +30 -0
- data/spec/type/windows/user_spec.rb +33 -0
- data/wercker.yml +1 -0
- metadata +450 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'darwin'
|
|
4
|
+
|
|
5
|
+
describe port(80) do
|
|
6
|
+
it { should be_listening }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe port(80) do
|
|
10
|
+
it { should be_listening.with('tcp') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe port(80) do
|
|
14
|
+
it do
|
|
15
|
+
expect {
|
|
16
|
+
should be_listening.with('not implemented')
|
|
17
|
+
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe port(80) do
|
|
22
|
+
it { should be_listening.on('127.0.0.1') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe port(53) do
|
|
26
|
+
it { should be_listening.with('udp') }
|
|
27
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'darwin'
|
|
4
|
+
|
|
5
|
+
describe service('sshd') do
|
|
6
|
+
it { should be_enabled }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled.with_level(4) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('sshd') do
|
|
14
|
+
it { should be_running }
|
|
15
|
+
end
|
|
16
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'debian'
|
|
4
|
+
|
|
5
|
+
describe package('httpd') do
|
|
6
|
+
it { should be_installed }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe package('httpd') do
|
|
10
|
+
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe package('httpd') do
|
|
14
|
+
it { should be_installed.by('apt').with_version('2.2.15-28.el6') }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe package('httpd') do
|
|
18
|
+
let(:stdout) { "2.2.15\n" }
|
|
19
|
+
its(:version) { should eq '2.2.15' }
|
|
20
|
+
its(:version) { should > '2.2.14' }
|
|
21
|
+
its(:version) { should < '2.2.16' }
|
|
22
|
+
its(:version) { should > '2.2.9' }
|
|
23
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'fedora'
|
|
4
|
+
|
|
5
|
+
describe service('sshd') do
|
|
6
|
+
it { should be_enabled }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled.with_level(4) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('sshd') do
|
|
14
|
+
it { should be_running }
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'fedora', :release => 15
|
|
4
|
+
|
|
5
|
+
describe service('sshd') do
|
|
6
|
+
it { should be_enabled }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled.with_level(4) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('sshd') do
|
|
14
|
+
it { should be_running }
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'fedora', :release => 20
|
|
4
|
+
|
|
5
|
+
describe service('sshd') do
|
|
6
|
+
it { should be_enabled }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe service('sshd') do
|
|
10
|
+
it { should be_enabled.with_level(4) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe service('sshd') do
|
|
14
|
+
it { should be_running }
|
|
15
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd'
|
|
4
|
+
|
|
5
|
+
describe file('/etc/passwd') do
|
|
6
|
+
it { should be_mode 644 }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe file('/etc/passwd') do
|
|
10
|
+
it { should be_owned_by 'root' }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe file('/etc/passwd') do
|
|
14
|
+
it { should be_grouped_into 'root' }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe file('/sbin/nologin') do
|
|
18
|
+
it { should be_linked_to '/usr/sbin/nologin' }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe file('/etc/passwd') do
|
|
22
|
+
let(:stdout) { Time.now.to_i.to_s }
|
|
23
|
+
its(:mtime) { should > DateTime.now - 1 }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe file('/etc/passwod') do
|
|
27
|
+
let(:stdout) { 100.to_s }
|
|
28
|
+
its(:size) { should > 0 }
|
|
29
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd'
|
|
4
|
+
|
|
5
|
+
describe package('httpd') do
|
|
6
|
+
it { should be_installed }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe package('httpd') do
|
|
10
|
+
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe package('httpd') do
|
|
14
|
+
let(:stdout) { "2.2.15\n" }
|
|
15
|
+
its(:version) { should eq '2.2.15' }
|
|
16
|
+
its(:version) { should > '2.2.14' }
|
|
17
|
+
its(:version) { should < '2.2.16' }
|
|
18
|
+
its(:version) { should > '2.2.9' }
|
|
19
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd'
|
|
4
|
+
|
|
5
|
+
describe port(80) do
|
|
6
|
+
it { should be_listening }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe port(80) do
|
|
10
|
+
it { should be_listening.with('tcp') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe port(80) do
|
|
14
|
+
it do
|
|
15
|
+
expect {
|
|
16
|
+
should be_listening.with('not implemented')
|
|
17
|
+
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe port(80) do
|
|
22
|
+
it { should be_listening.on('127.0.0.1') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe port(53) do
|
|
26
|
+
it { should be_listening.with('udp') }
|
|
27
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'freebsd', :release => 10
|
|
4
|
+
|
|
5
|
+
describe package('httpd') do
|
|
6
|
+
it { should be_installed }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe package('httpd') do
|
|
10
|
+
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe package('httpd') do
|
|
14
|
+
let(:stdout) { "2.2.15\n" }
|
|
15
|
+
its(:version) { should eq '2.2.15' }
|
|
16
|
+
its(:version) { should > '2.2.14' }
|
|
17
|
+
its(:version) { should < '2.2.16' }
|
|
18
|
+
its(:version) { should > '2.2.9' }
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
set :os, :family => 'linux'
|
|
4
|
+
|
|
5
|
+
describe cgroup('group1') do
|
|
6
|
+
let(:stdout) { "1\r\n" }
|
|
7
|
+
its('cpuset.cpus') { should eq 1 }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe cgroup('group1') do
|
|
11
|
+
let(:stdout) { "1\r\n" }
|
|
12
|
+
its('cpuset.cpus') { should_not eq 0 }
|
|
13
|
+
end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
property[:os] = nil
|
|
6
|
+
set :os, {:family => 'linux'}
|
|
7
|
+
|
|
8
|
+
describe docker_container('c1') do
|
|
9
|
+
it { should exist }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe docker_container('c1 pre 1.8') do
|
|
13
|
+
let(:stdout) { inspect_container }
|
|
14
|
+
it { should be_running }
|
|
15
|
+
it { should have_volume('/tmp', '/data') }
|
|
16
|
+
it { should_not have_volume('/tmp', '/data-bad') }
|
|
17
|
+
its(:inspection) { should include 'Driver' => 'aufs' }
|
|
18
|
+
its(['Config.Cmd']) { should include '/bin/sh' }
|
|
19
|
+
its(['HostConfig.PortBindings.80.[0].HostPort']) { should eq '8080' }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe docker_container('restarting pre 1.8') do
|
|
23
|
+
let(:stdout) do
|
|
24
|
+
attrs = JSON.parse(inspect_container)
|
|
25
|
+
attrs.first['State']['Restarting'] = true
|
|
26
|
+
attrs.to_json
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it { should_not be_running }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def inspect_container
|
|
33
|
+
<<'EOS'
|
|
34
|
+
[{
|
|
35
|
+
"Args": [],
|
|
36
|
+
"Config": {
|
|
37
|
+
"AttachStderr": false,
|
|
38
|
+
"AttachStdin": false,
|
|
39
|
+
"AttachStdout": false,
|
|
40
|
+
"Cmd": [
|
|
41
|
+
"/bin/sh"
|
|
42
|
+
],
|
|
43
|
+
"CpuShares": 0,
|
|
44
|
+
"Cpuset": "",
|
|
45
|
+
"Domainname": "",
|
|
46
|
+
"Entrypoint": null,
|
|
47
|
+
"Env": [
|
|
48
|
+
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
49
|
+
],
|
|
50
|
+
"ExposedPorts": null,
|
|
51
|
+
"Hostname": "65cd2e2d7963",
|
|
52
|
+
"Image": "busybox",
|
|
53
|
+
"Memory": 0,
|
|
54
|
+
"MemorySwap": 0,
|
|
55
|
+
"NetworkDisabled": false,
|
|
56
|
+
"OnBuild": null,
|
|
57
|
+
"OpenStdin": true,
|
|
58
|
+
"PortSpecs": null,
|
|
59
|
+
"StdinOnce": false,
|
|
60
|
+
"Tty": true,
|
|
61
|
+
"User": "",
|
|
62
|
+
"Volumes": null,
|
|
63
|
+
"WorkingDir": ""
|
|
64
|
+
},
|
|
65
|
+
"Created": "2014-09-26T15:08:37.527931773Z",
|
|
66
|
+
"Driver": "aufs",
|
|
67
|
+
"ExecDriver": "native-0.2",
|
|
68
|
+
"HostConfig": {
|
|
69
|
+
"Binds": [
|
|
70
|
+
"/data:/tmp"
|
|
71
|
+
],
|
|
72
|
+
"ContainerIDFile": "",
|
|
73
|
+
"Dns": null,
|
|
74
|
+
"DnsSearch": null,
|
|
75
|
+
"Links": null,
|
|
76
|
+
"LxcConf": [],
|
|
77
|
+
"NetworkMode": "bridge",
|
|
78
|
+
"PortBindings": {
|
|
79
|
+
"80": [
|
|
80
|
+
{
|
|
81
|
+
"HostIp": "",
|
|
82
|
+
"HostPort": "8080"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"Privileged": false,
|
|
87
|
+
"PublishAllPorts": false,
|
|
88
|
+
"VolumesFrom": null
|
|
89
|
+
},
|
|
90
|
+
"HostnamePath": "/mnt/sda1/var/lib/docker/containers/65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545/hostname",
|
|
91
|
+
"HostsPath": "/mnt/sda1/var/lib/docker/containers/65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545/hosts",
|
|
92
|
+
"Id": "65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545",
|
|
93
|
+
"Image": "e72ac664f4f0c6a061ac4ef332557a70d69b0c624b6add35f1c181ff7fff2287",
|
|
94
|
+
"MountLabel": "",
|
|
95
|
+
"Name": "/c1",
|
|
96
|
+
"NetworkSettings": {
|
|
97
|
+
"Bridge": "docker0",
|
|
98
|
+
"Gateway": "172.17.42.1",
|
|
99
|
+
"IPAddress": "172.17.0.24",
|
|
100
|
+
"IPPrefixLen": 16,
|
|
101
|
+
"PortMapping": null,
|
|
102
|
+
"Ports": {}
|
|
103
|
+
},
|
|
104
|
+
"Path": "/bin/sh",
|
|
105
|
+
"ProcessLabel": "",
|
|
106
|
+
"ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545/resolv.conf",
|
|
107
|
+
"State": {
|
|
108
|
+
"ExitCode": 0,
|
|
109
|
+
"FinishedAt": "0001-01-01T00:00:00Z",
|
|
110
|
+
"Paused": false,
|
|
111
|
+
"Pid": 4123,
|
|
112
|
+
"Running": true,
|
|
113
|
+
"StartedAt": "2014-09-26T15:08:37.737780273Z"
|
|
114
|
+
},
|
|
115
|
+
"Volumes": {
|
|
116
|
+
"/tmp": "/data"
|
|
117
|
+
},
|
|
118
|
+
"VolumesRW": {
|
|
119
|
+
"/tmp": true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
EOS
|
|
124
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
property[:os] = nil
|
|
6
|
+
set :os, {:family => 'linux'}
|
|
7
|
+
|
|
8
|
+
describe docker_container('c1') do
|
|
9
|
+
it { should exist }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe docker_container('c1') do
|
|
13
|
+
let(:stdout) { inspect_container }
|
|
14
|
+
it { should be_running }
|
|
15
|
+
it { should have_volume('/tmp', '/data') }
|
|
16
|
+
it { should_not have_volume('/tmp', '/data-bad') }
|
|
17
|
+
its(:inspection) { should include 'Driver' => 'aufs' }
|
|
18
|
+
its(['Config.Cmd']) { should include '/bin/sh' }
|
|
19
|
+
its(['HostConfig.PortBindings.80.[0].HostPort']) { should eq '8080' }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe docker_container('restarting') do
|
|
23
|
+
let(:stdout) do
|
|
24
|
+
attrs = JSON.parse(inspect_container)
|
|
25
|
+
attrs.first['State']['Restarting'] = true
|
|
26
|
+
attrs.to_json
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it { should_not be_running }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def inspect_container
|
|
33
|
+
<<'EOS'
|
|
34
|
+
[{
|
|
35
|
+
"Args": [],
|
|
36
|
+
"Config": {
|
|
37
|
+
"AttachStderr": false,
|
|
38
|
+
"AttachStdin": false,
|
|
39
|
+
"AttachStdout": false,
|
|
40
|
+
"Cmd": [
|
|
41
|
+
"/bin/sh"
|
|
42
|
+
],
|
|
43
|
+
"CpuShares": 0,
|
|
44
|
+
"Cpuset": "",
|
|
45
|
+
"Domainname": "",
|
|
46
|
+
"Entrypoint": null,
|
|
47
|
+
"Env": [
|
|
48
|
+
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
49
|
+
],
|
|
50
|
+
"ExposedPorts": null,
|
|
51
|
+
"Hostname": "65cd2e2d7963",
|
|
52
|
+
"Image": "busybox",
|
|
53
|
+
"Memory": 0,
|
|
54
|
+
"MemorySwap": 0,
|
|
55
|
+
"NetworkDisabled": false,
|
|
56
|
+
"OnBuild": null,
|
|
57
|
+
"OpenStdin": true,
|
|
58
|
+
"PortSpecs": null,
|
|
59
|
+
"StdinOnce": false,
|
|
60
|
+
"Tty": true,
|
|
61
|
+
"User": "",
|
|
62
|
+
"Volumes": null,
|
|
63
|
+
"WorkingDir": ""
|
|
64
|
+
},
|
|
65
|
+
"Created": "2014-09-26T15:08:37.527931773Z",
|
|
66
|
+
"Driver": "aufs",
|
|
67
|
+
"ExecDriver": "native-0.2",
|
|
68
|
+
"HostConfig": {
|
|
69
|
+
"Binds": [
|
|
70
|
+
"/data:/tmp"
|
|
71
|
+
],
|
|
72
|
+
"ContainerIDFile": "",
|
|
73
|
+
"Dns": null,
|
|
74
|
+
"DnsSearch": null,
|
|
75
|
+
"Links": null,
|
|
76
|
+
"LxcConf": [],
|
|
77
|
+
"NetworkMode": "bridge",
|
|
78
|
+
"PortBindings": {
|
|
79
|
+
"80": [
|
|
80
|
+
{
|
|
81
|
+
"HostIp": "",
|
|
82
|
+
"HostPort": "8080"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"Privileged": false,
|
|
87
|
+
"PublishAllPorts": false,
|
|
88
|
+
"VolumesFrom": null
|
|
89
|
+
},
|
|
90
|
+
"HostnamePath": "/mnt/sda1/var/lib/docker/containers/65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545/hostname",
|
|
91
|
+
"HostsPath": "/mnt/sda1/var/lib/docker/containers/65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545/hosts",
|
|
92
|
+
"Id": "65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545",
|
|
93
|
+
"Image": "e72ac664f4f0c6a061ac4ef332557a70d69b0c624b6add35f1c181ff7fff2287",
|
|
94
|
+
"MountLabel": "",
|
|
95
|
+
"Name": "/c1",
|
|
96
|
+
"NetworkSettings": {
|
|
97
|
+
"Bridge": "docker0",
|
|
98
|
+
"Gateway": "172.17.42.1",
|
|
99
|
+
"IPAddress": "172.17.0.24",
|
|
100
|
+
"IPPrefixLen": 16,
|
|
101
|
+
"PortMapping": null,
|
|
102
|
+
"Ports": {}
|
|
103
|
+
},
|
|
104
|
+
"Path": "/bin/sh",
|
|
105
|
+
"ProcessLabel": "",
|
|
106
|
+
"ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/65cd2e2d7963bacaecda2d7fcd89499010bc0d38d70bce5ad0af7112a94a4545/resolv.conf",
|
|
107
|
+
"State": {
|
|
108
|
+
"ExitCode": 0,
|
|
109
|
+
"FinishedAt": "0001-01-01T00:00:00Z",
|
|
110
|
+
"Paused": false,
|
|
111
|
+
"Pid": 4123,
|
|
112
|
+
"Running": true,
|
|
113
|
+
"StartedAt": "2014-09-26T15:08:37.737780273Z"
|
|
114
|
+
},
|
|
115
|
+
"Mounts": [
|
|
116
|
+
{
|
|
117
|
+
"Source": "/data",
|
|
118
|
+
"Destination": "/tmp",
|
|
119
|
+
"Mode": "",
|
|
120
|
+
"RW": true
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
EOS
|
|
126
|
+
end
|