Skip to content

Commit

Permalink
Merge branch 'master' of github.com:chorankates/rouster
Browse files Browse the repository at this point in the history
  • Loading branch information
chorankates-sfdc committed Aug 26, 2016
2 parents 485aab7 + a27d0da commit 85d6634
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/rouster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def is_available_via_ssh?
if @ssh.nil? or @ssh.closed?
begin
res = self.connect_ssh_tunnel()
rescue Rouster::InternalError, Net::SSH::Disconnect, Errno::ECONNREFUSED => e
rescue Rouster::InternalError, Net::SSH::Disconnect, Errno::ECONNREFUSED, Errno::ECONNRESET => e
res = false
end

Expand Down
16 changes: 10 additions & 6 deletions lib/rouster/testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -581,13 +581,17 @@ def validate_port(number, expectations, fail_fast=false)

when :address
lr = Array.new
addresses = ports[expectations[:protocol]][number][:address]
addresses.each_key do |address|
lr.push(address.eql?(v.to_s))
end

local = ! lr.find{|e| e.true? }.nil? # this feels jankity
if ports[expectations[:protocol]][number]
addresses = ports[expectations[:protocol]][number][:address]
addresses.each_key do |address|
lr.push(address.eql?(v.to_s))
end

local = ! lr.find{|e| e.true? }.nil? # this feels jankity
else
# this port isn't open in the first place, won't match any addresses we expect to see it on
local = false
end
else
raise InternalError.new(sprintf('unknown expectation[%s / %s]', k, v))
end
Expand Down
5 changes: 5 additions & 0 deletions test/unit/testing/test_validate_port.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def test_negative_constrained

end

def test_negative_port_dne
assert_equal(false, @app.validate_port(4567, { :ensure => true, :address => '*' }))
assert_equal(false, @app.validate_port(4567, { :ensure => true, :address => '127.0.0.1' }))
end

def teardown
# noop
end
Expand Down

0 comments on commit 85d6634

Please sign in to comment.