serverspec 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/serverspec/commands/solaris.rb +8 -0
- data/lib/serverspec/version.rb +1 -1
- data/spec/solaris/commands_spec.rb +15 -1
- metadata +2 -2
@@ -93,6 +93,14 @@ module Serverspec
|
|
93
93
|
## to be better tested under real solaris env
|
94
94
|
"su #{user} -c \"test -#{access} #{file}\""
|
95
95
|
end
|
96
|
+
|
97
|
+
def check_reachable(host, port, proto, timeout)
|
98
|
+
if port.nil?
|
99
|
+
"ping -n #{escape(host)} #{escape(timeout)}"
|
100
|
+
else
|
101
|
+
"nc -vvvvz#{escape(proto[0].chr)} -w #{escape(timeout)} #{escape(host)} #{escape(port)}"
|
102
|
+
end
|
103
|
+
end
|
96
104
|
end
|
97
105
|
end
|
98
106
|
end
|
data/lib/serverspec/version.rb
CHANGED
@@ -19,7 +19,6 @@ describe 'Serverspec commands of Solaris family' do
|
|
19
19
|
it_behaves_like 'support command check_mounted', '/'
|
20
20
|
|
21
21
|
it_behaves_like 'support command check_routing_table', '192.168.100.1/24'
|
22
|
-
it_behaves_like 'support command check_reachable'
|
23
22
|
it_behaves_like 'support command check_resolvable'
|
24
23
|
|
25
24
|
it_behaves_like 'support command check_user', 'root'
|
@@ -170,3 +169,18 @@ describe 'check_access_by_user' do
|
|
170
169
|
it { should eq 'su dummyuser3 -c "test -x /tmp/somethingx"' }
|
171
170
|
end
|
172
171
|
end
|
172
|
+
|
173
|
+
describe 'check_reachable' do
|
174
|
+
context "connect with name from /etc/services to localhost" do
|
175
|
+
subject { commands.check_reachable('localhost', 'ssh', 'tcp', 1) }
|
176
|
+
it { should eq "nc -vvvvzt -w 1 localhost ssh" }
|
177
|
+
end
|
178
|
+
context "connect with ip and port 11111 and timeout of 5" do
|
179
|
+
subject { commands.check_reachable('127.0.0.1', '11111', 'udp', 5) }
|
180
|
+
it { should eq "nc -vvvvzu -w 5 127.0.0.1 11111" }
|
181
|
+
end
|
182
|
+
context "do a ping" do
|
183
|
+
subject { commands.check_reachable('127.0.0.1', nil, 'icmp', 1) }
|
184
|
+
it { should eq "ping -n 127.0.0.1 1" }
|
185
|
+
end
|
186
|
+
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.6.
|
4
|
+
version: 0.6.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -324,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
324
|
version: '0'
|
325
325
|
requirements: []
|
326
326
|
rubyforge_project:
|
327
|
-
rubygems_version: 1.8.
|
327
|
+
rubygems_version: 1.8.25
|
328
328
|
signing_key:
|
329
329
|
specification_version: 3
|
330
330
|
summary: RSpec tests for your servers configured by Puppet, Chef or anything else
|