serverspec 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -101,6 +101,9 @@ module Serverspec
101
101
  "stat -c %a #{file}"
102
102
  end
103
103
 
104
+ def check_ipfilter_rule rule
105
+ raise NotImplementedError.new
106
+ end
104
107
  end
105
108
  end
106
109
  end
@@ -33,6 +33,11 @@ module Serverspec
33
33
  commands.join(' && ')
34
34
  end
35
35
  end
36
+
37
+ def check_ipfilter_rule rule
38
+ "/sbin/ipfstat -io 2> /dev/null | grep '#{rule}'"
39
+ end
40
+
36
41
  end
37
42
  end
38
43
  end
@@ -20,3 +20,4 @@ require 'serverspec/matchers/be_zfs'
20
20
  require 'serverspec/matchers/be_readable'
21
21
  require 'serverspec/matchers/be_writable'
22
22
  require 'serverspec/matchers/be_executable'
23
+ require 'serverspec/matchers/have_ipfilter_rule'
@@ -0,0 +1,5 @@
1
+ RSpec::Matchers.define :have_ipfilter_rule do |rule|
2
+ match do |iptables|
3
+ backend.check_ipfilter_rule(example, rule)
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -114,3 +114,8 @@ end
114
114
  describe commands.get_mode('/dev') do
115
115
  it { should eq 'stat -c %a /dev' }
116
116
  end
117
+
118
+ describe commands.check_ipfilter_rule('pass in quick on lo0 all') do
119
+ it { should eq "/sbin/ipfstat -io 2> /dev/null | grep 'pass in quick on lo0 all'" }
120
+ end
121
+
@@ -51,4 +51,6 @@ describe 'Serverspec matchers of Solaris family', :os => :solaris do
51
51
  it_behaves_like 'support be_executable_by_owner matcher', '/dev'
52
52
  it_behaves_like 'support be_executable_by_group matcher', '/dev'
53
53
  it_behaves_like 'support be_executable_by_others matcher', '/dev'
54
+
55
+ it_behaves_like 'support have_ipfilter_rule matcher', 'pass in quick on lo0 all'
54
56
  end
@@ -631,3 +631,16 @@ shared_examples_for 'support be_executable_by_others matcher' do |file|
631
631
  end
632
632
  end
633
633
  end
634
+
635
+ shared_examples_for 'support have_ipfilter_rule matcher' do |rule|
636
+ describe 'have_ipfilter_rule' do
637
+ describe 'ipfilter' do
638
+ it { should have_ipfilter_rule rule }
639
+ end
640
+
641
+ describe 'ipfilter' do
642
+ it { should_not have_ipfilter_rule 'invalid-rule' }
643
+ end
644
+ end
645
+ end
646
+
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.5
4
+ version: 0.2.6
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-10 00:00:00.000000000 Z
12
+ date: 2013-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -132,6 +132,7 @@ files:
132
132
  - lib/serverspec/matchers/contain.rb
133
133
  - lib/serverspec/matchers/get_stdout.rb
134
134
  - lib/serverspec/matchers/have_cron_entry.rb
135
+ - lib/serverspec/matchers/have_ipfilter_rule.rb
135
136
  - lib/serverspec/matchers/have_iptables_rule.rb
136
137
  - lib/serverspec/setup.rb
137
138
  - lib/serverspec/version.rb
@@ -167,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
168
  version: '0'
168
169
  requirements: []
169
170
  rubyforge_project:
170
- rubygems_version: 1.8.25
171
+ rubygems_version: 1.8.23
171
172
  signing_key:
172
173
  specification_version: 3
173
174
  summary: RSpec tests for your servers provisioned by Puppet, Chef or anything else