Commit ce011a00 authored by anonym's avatar anonym
Browse files

Use more robust method for obtaining a free TCP port.

Any random number in the range can of course already be in use.
parent 3260c61a
require 'socket'
def read_and_validate_ssh_config srv_type
conf = $config[srv_type]
......@@ -58,13 +60,20 @@ Given /^I (?:am prompted to )?verify the SSH fingerprint for the (?:Git|SSH) (?:
@screen.type('yes' + Sikuli::Key.ENTER)
def get_free_tcp_port
server ='', 0)
return server.addr[1]
When /^I connect to an SSH server on the (Internet|LAN)$/ do |location|
case location
when 'Internet'
read_and_validate_ssh_config "SSH"
when 'LAN'
@ssh_port = Random.rand(1024...65535)
@ssh_port = get_free_tcp_port
@ssh_username = 'user'
@ssh_host = $vmnet.bridge_ip_addr
@sshd = = @ssh_host, sshd_port = @ssh_port)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment