nagios-zfs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Nagios
2
2
  module ZFS
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -5,7 +5,8 @@ module Nagios
5
5
 
6
6
  option :zpool,
7
7
  :short => '-p ZPOOL_NAME',
8
- :long => '--pool ZPOOL_NAME'
8
+ :long => '--pool ZPOOL_NAME',
9
+ :required => true
9
10
 
10
11
  option :critical,
11
12
  :short => '-c CRITICAL_CAPACITY',
@@ -4,12 +4,20 @@ module Nagios
4
4
  module ZFS
5
5
  describe ZpoolPlugin do
6
6
  let(:plugin) { ZpoolPlugin.new }
7
- let(:argv) { [] }
7
+ let(:argv) { %w(--pool tank) }
8
8
 
9
9
  before do
10
10
  ZpoolPlugin.any_instance.stub(:argv).and_return(argv)
11
11
  end
12
12
 
13
+ context 'without required arguments' do
14
+ let(:argv) { [] }
15
+
16
+ it 'raises an error without pool name' do
17
+ expect { plugin }.to raise_error(SystemExit)
18
+ end
19
+ end
20
+
13
21
  describe '#critical?' do
14
22
  it 'returns true when capacity is critical' do
15
23
  plugin.should_receive(:critical_capacity?).and_return(true)
@@ -104,18 +112,17 @@ module Nagios
104
112
 
105
113
  describe '#config' do
106
114
  %w(-p --pool).each do |opt|
107
- name = 'tank'
108
- context "with #{opt} #{name}" do
109
- let(:argv) { [opt, name] }
115
+ context "with #{opt}" do
116
+ before { argv << opt << 'tank' }
110
117
 
111
- it { expect(plugin.config[:zpool]).to eq(name) }
118
+ it { expect(plugin.config[:zpool]).to eq('tank') }
112
119
  end
113
120
  end
114
121
 
115
122
  %w(-c --critical).each do |opt|
116
123
  threshold = 42
117
- context "with #{opt} #{threshold}" do
118
- let(:argv) { [opt, threshold.to_s] }
124
+ context "with #{opt}" do
125
+ before { argv << opt << threshold.to_s }
119
126
 
120
127
  it { expect(plugin.config[:critical]).to eq(threshold) }
121
128
  end
@@ -123,8 +130,8 @@ module Nagios
123
130
 
124
131
  %w(-w --warning).each do |opt|
125
132
  threshold = 42
126
- context "with #{opt} #{threshold}" do
127
- let(:argv) { [opt, threshold.to_s] }
133
+ context "with #{opt}" do
134
+ before { argv << opt << threshold.to_s }
128
135
 
129
136
  it { expect(plugin.config[:warning]).to eq(threshold) }
130
137
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagios-zfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-10-02 00:00:00.000000000 Z
12
+ date: 2013-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nagiosplugin
@@ -182,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  segments:
184
184
  - 0
185
- hash: 4578558176594243719
185
+ hash: -2614810607798314703
186
186
  required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  none: false
188
188
  requirements:
@@ -191,13 +191,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  segments:
193
193
  - 0
194
- hash: 4578558176594243719
194
+ hash: -2614810607798314703
195
195
  requirements: []
196
196
  rubyforge_project:
197
197
  rubygems_version: 1.8.23
198
198
  signing_key:
199
199
  specification_version: 3
200
- summary: nagios-zfs-0.1.0
200
+ summary: nagios-zfs-0.1.1
201
201
  test_files:
202
202
  - features/check_zpool_capacity.feature
203
203
  - features/step_definitions/dev_steps.rb