serverspec 0.0.5 → 0.0.6
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.
- data/lib/serverspec.rb +2 -0
- data/lib/serverspec/commands/base.rb +4 -0
- data/lib/serverspec/commands/gentoo.rb +13 -0
- data/lib/serverspec/helper.rb +6 -0
- data/lib/serverspec/matchers/be_running.rb +3 -0
- data/lib/serverspec/version.rb +1 -1
- data/spec/gentoo/matchers_spec.rb +15 -0
- data/spec/redhat/matchers_spec.rb +3 -0
- metadata +5 -2
data/lib/serverspec.rb
CHANGED
@@ -7,12 +7,14 @@ require 'serverspec/setup'
|
|
7
7
|
require 'serverspec/commands/base'
|
8
8
|
require 'serverspec/commands/redhat'
|
9
9
|
require 'serverspec/commands/debian'
|
10
|
+
require 'serverspec/commands/gentoo'
|
10
11
|
require 'serverspec/commands/solaris'
|
11
12
|
|
12
13
|
RSpec.configure do |c|
|
13
14
|
c.include(Serverspec::Helper)
|
14
15
|
c.include(Serverspec::RedHatHelper, :os => :redhat)
|
15
16
|
c.include(Serverspec::DebianHelper, :os => :debian)
|
17
|
+
c.include(Serverspec::GentooHelper, :os => :gentoo)
|
16
18
|
c.include(Serverspec::SolarisHelper, :os => :solaris)
|
17
19
|
c.add_setting :host, :default => nil
|
18
20
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Serverspec
|
2
|
+
module Commands
|
3
|
+
class Gentoo < Base
|
4
|
+
def check_enabled service
|
5
|
+
"/sbin/rc-update show | grep '^\\s*#{service}\\s*|\\s*\\(boot\\|default\\)'"
|
6
|
+
end
|
7
|
+
|
8
|
+
def check_installed package
|
9
|
+
"/usr/bin/eix #{package} --installed"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/serverspec/helper.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
RSpec::Matchers.define :be_running do
|
2
2
|
match do |actual|
|
3
3
|
ret = ssh_exec(RSpec.configuration.host, commands.check_running(actual))
|
4
|
+
if ret[:exit_code] == 1
|
5
|
+
ret = ssh_exec(RSpec.configuration.host, commands.check_process(actual))
|
6
|
+
end
|
4
7
|
ret[:exit_code] == 0
|
5
8
|
end
|
6
9
|
end
|
data/lib/serverspec/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Serverspec matchers of Gentoo family', :os => :gentoo do
|
4
|
+
let(:test_server_host) { 'serverspec-gentoo-host' }
|
5
|
+
|
6
|
+
it_behaves_like 'support be_enabled matcher', 'sshd'
|
7
|
+
it_behaves_like 'support be_installed matcher', 'openssh'
|
8
|
+
it_behaves_like 'support be_running matcher', 'sshd'
|
9
|
+
it_behaves_like 'support be_listening matcher', 22
|
10
|
+
it_behaves_like 'support be_file matcher', '/etc/ssh/sshd_config'
|
11
|
+
it_behaves_like 'support be_directory matcher', '/etc/ssh'
|
12
|
+
it_behaves_like 'support contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
|
13
|
+
it_behaves_like 'support be_user matcher', 'root'
|
14
|
+
it_behaves_like 'support be_group matcher', 'wheel'
|
15
|
+
end
|
@@ -12,4 +12,7 @@ describe 'Serverspec matchers of Red Hat family', :os => :redhat do
|
|
12
12
|
it_behaves_like 'support contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
|
13
13
|
it_behaves_like 'support be_user matcher', 'root'
|
14
14
|
it_behaves_like 'support be_group matcher', 'wheel'
|
15
|
+
|
16
|
+
# Test for case of not registered in the service, but running as process.
|
17
|
+
it_behaves_like 'support be_running matcher', 'udevd'
|
15
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/serverspec.rb
|
93
93
|
- lib/serverspec/commands/base.rb
|
94
94
|
- lib/serverspec/commands/debian.rb
|
95
|
+
- lib/serverspec/commands/gentoo.rb
|
95
96
|
- lib/serverspec/commands/redhat.rb
|
96
97
|
- lib/serverspec/commands/solaris.rb
|
97
98
|
- lib/serverspec/helper.rb
|
@@ -109,6 +110,7 @@ files:
|
|
109
110
|
- lib/serverspec/version.rb
|
110
111
|
- serverspec.gemspec
|
111
112
|
- spec/debian/matchers_spec.rb
|
113
|
+
- spec/gentoo/matchers_spec.rb
|
112
114
|
- spec/redhat/matchers_spec.rb
|
113
115
|
- spec/solaris/matchers_spec.rb
|
114
116
|
- spec/spec_helper.rb
|
@@ -134,12 +136,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
136
|
version: '0'
|
135
137
|
requirements: []
|
136
138
|
rubyforge_project:
|
137
|
-
rubygems_version: 1.8.
|
139
|
+
rubygems_version: 1.8.25
|
138
140
|
signing_key:
|
139
141
|
specification_version: 3
|
140
142
|
summary: RSpec tests for your provisioned servers
|
141
143
|
test_files:
|
142
144
|
- spec/debian/matchers_spec.rb
|
145
|
+
- spec/gentoo/matchers_spec.rb
|
143
146
|
- spec/redhat/matchers_spec.rb
|
144
147
|
- spec/solaris/matchers_spec.rb
|
145
148
|
- spec/spec_helper.rb
|