serverspec 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/serverspec/commands/base.rb +12 -0
- data/lib/serverspec/commands/solaris.rb +15 -0
- data/lib/serverspec/matchers.rb +3 -0
- data/lib/serverspec/matchers/have_ipnat_rule.rb +5 -0
- data/lib/serverspec/matchers/have_svcprop.rb +9 -0
- data/lib/serverspec/matchers/have_svcprops.rb +5 -0
- data/lib/serverspec/version.rb +1 -1
- data/spec/solaris/commands_spec.rb +18 -0
- data/spec/solaris/matchers_spec.rb +5 -0
- data/spec/support/shared_matcher_examples.rb +35 -0
- metadata +5 -2
@@ -104,6 +104,18 @@ module Serverspec
|
|
104
104
|
def check_ipfilter_rule rule
|
105
105
|
raise NotImplementedError.new
|
106
106
|
end
|
107
|
+
|
108
|
+
def check_ipnat_rule rule
|
109
|
+
raise NotImplementedError.new
|
110
|
+
end
|
111
|
+
|
112
|
+
def check_svcprop svc, property, value
|
113
|
+
raise NotImplementedError.new
|
114
|
+
end
|
115
|
+
|
116
|
+
def check_svcprops svc, property
|
117
|
+
raise NotImplementedError.new
|
118
|
+
end
|
107
119
|
end
|
108
120
|
end
|
109
121
|
end
|
@@ -38,6 +38,21 @@ module Serverspec
|
|
38
38
|
"/sbin/ipfstat -io 2> /dev/null | grep '#{rule}'"
|
39
39
|
end
|
40
40
|
|
41
|
+
def check_ipnat_rule rule
|
42
|
+
"/sbin/ipnat -l 2> /dev/null | grep '^#{rule}$'"
|
43
|
+
end
|
44
|
+
|
45
|
+
def check_svcprop svc, property, value
|
46
|
+
"svcprop -p #{property} #{svc} | grep ^#{value}$"
|
47
|
+
end
|
48
|
+
|
49
|
+
def check_svcprops svc, property
|
50
|
+
commands = []
|
51
|
+
property.sort.each do |key, value|
|
52
|
+
commands << "svcprop -p #{key} #{svc} | grep ^#{value}$"
|
53
|
+
end
|
54
|
+
commands.join(' && ')
|
55
|
+
end
|
41
56
|
end
|
42
57
|
end
|
43
58
|
end
|
data/lib/serverspec/matchers.rb
CHANGED
@@ -21,3 +21,6 @@ require 'serverspec/matchers/be_readable'
|
|
21
21
|
require 'serverspec/matchers/be_writable'
|
22
22
|
require 'serverspec/matchers/be_executable'
|
23
23
|
require 'serverspec/matchers/have_ipfilter_rule'
|
24
|
+
require 'serverspec/matchers/have_ipnat_rule'
|
25
|
+
require 'serverspec/matchers/have_svcprop'
|
26
|
+
require 'serverspec/matchers/have_svcprops'
|
data/lib/serverspec/version.rb
CHANGED
@@ -119,3 +119,21 @@ describe commands.check_ipfilter_rule('pass in quick on lo0 all') do
|
|
119
119
|
it { should eq "/sbin/ipfstat -io 2> /dev/null | grep 'pass in quick on lo0 all'" }
|
120
120
|
end
|
121
121
|
|
122
|
+
describe commands.check_ipnat_rule('map net1 192.168.0.0/24 -> 0.0.0.0/32') do
|
123
|
+
it { should eq "/sbin/ipnat -l 2> /dev/null | grep '^map net1 192.168.0.0/24 -> 0.0.0.0/32$'" }
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
describe commands.check_svcprop('svc:/network/http:apache22',
|
129
|
+
'httpd/enable_64bit','false') do
|
130
|
+
it { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep ^false$" }
|
131
|
+
end
|
132
|
+
|
133
|
+
describe commands.check_svcprops('svc:/network/http:apache22', {
|
134
|
+
'httpd/enable_64bit' => 'false',
|
135
|
+
'httpd/server_type' => 'worker',
|
136
|
+
}) do
|
137
|
+
it { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep ^false$ && svcprop -p httpd/server_type svc:/network/http:apache22 | grep ^worker$" }
|
138
|
+
end
|
139
|
+
|
@@ -53,4 +53,9 @@ describe 'Serverspec matchers of Solaris family', :os => :solaris do
|
|
53
53
|
it_behaves_like 'support be_executable_by_others matcher', '/dev'
|
54
54
|
|
55
55
|
it_behaves_like 'support have_ipfilter_rule matcher', 'pass in quick on lo0 all'
|
56
|
+
|
57
|
+
it_behaves_like 'support have_ipnat_rule matcher', 'map net1 192.168.0.0/24 -> 0.0.0.0/32'
|
58
|
+
|
59
|
+
it_behaves_like 'support have_svcprop.with_value matcher', 'svc:/network/http:apache22', 'httpd/server_type', 'worker'
|
60
|
+
it_behaves_like 'support have_svcprops matcher', 'svc:/network/http:apache22', {'httpd/enable_64bit' => 'false', 'httpd/server_type' => 'worker' }
|
56
61
|
end
|
@@ -644,3 +644,38 @@ shared_examples_for 'support have_ipfilter_rule matcher' do |rule|
|
|
644
644
|
end
|
645
645
|
end
|
646
646
|
|
647
|
+
shared_examples_for 'support have_ipnat_rule matcher' do |rule|
|
648
|
+
describe 'have_ipnat_rule' do
|
649
|
+
describe 'ipnat' do
|
650
|
+
it { should have_ipnat_rule rule }
|
651
|
+
end
|
652
|
+
|
653
|
+
describe 'ipnat' do
|
654
|
+
it { should_not have_ipnat_rule 'invalid-rule' }
|
655
|
+
end
|
656
|
+
end
|
657
|
+
end
|
658
|
+
|
659
|
+
shared_examples_for 'support have_svcprop.with_value matcher' do |svc, property, value|
|
660
|
+
describe 'have_svcprop' do
|
661
|
+
describe svc do
|
662
|
+
it { should have_svcprop(property).with_value(value) }
|
663
|
+
end
|
664
|
+
|
665
|
+
describe 'this-is-invalid-svc' do
|
666
|
+
it { should_not have_svcprop(property).with_value(value) }
|
667
|
+
end
|
668
|
+
end
|
669
|
+
end
|
670
|
+
|
671
|
+
shared_examples_for 'support have_svcprops matcher' do |svc, property|
|
672
|
+
describe 'have_svcprop' do
|
673
|
+
describe svc do
|
674
|
+
it { should have_svcprops(property) }
|
675
|
+
end
|
676
|
+
|
677
|
+
describe 'this-is-invalid-svc' do
|
678
|
+
it { should_not have_svcprops(property) }
|
679
|
+
end
|
680
|
+
end
|
681
|
+
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.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -133,7 +133,10 @@ files:
|
|
133
133
|
- lib/serverspec/matchers/get_stdout.rb
|
134
134
|
- lib/serverspec/matchers/have_cron_entry.rb
|
135
135
|
- lib/serverspec/matchers/have_ipfilter_rule.rb
|
136
|
+
- lib/serverspec/matchers/have_ipnat_rule.rb
|
136
137
|
- lib/serverspec/matchers/have_iptables_rule.rb
|
138
|
+
- lib/serverspec/matchers/have_svcprop.rb
|
139
|
+
- lib/serverspec/matchers/have_svcprops.rb
|
137
140
|
- lib/serverspec/setup.rb
|
138
141
|
- lib/serverspec/version.rb
|
139
142
|
- serverspec.gemspec
|