Commit 61f2928b authored by anonym's avatar anonym
Browse files

Refactor ssh server setup part into its own step.

Also:
* Don't use class variables (@sshd) unnecessarily.
* Ruby does not support "keyword" style parameter assignment
  (sshd_host, sshd_port).
parent de642ccc
......@@ -19,6 +19,7 @@ Feature: Logging in via SSH
@check_tor_leaks
Scenario: Connecting to an SSH server on the LAN
Given I have the SSH key pair for an SSH server
And an SSH server is running on the LAN
When I connect to an SSH server on the LAN
Then I am prompted to verify the SSH fingerprint for the SSH server
......
......@@ -70,18 +70,23 @@ ensure
server.close
end
Given /^an SSH server is running on the LAN$/ do
@sshd_server_port = get_free_tcp_port
@sshd_server_host = $vmnet.bridge_ip_addr
sshd = SSHServer.new(@sshd_server_host, @sshd_server_port)
sshd.start
add_after_scenario_hook { sshd.stop }
end
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 = get_free_tcp_port
@ssh_port = @sshd_server_port
@ssh_username = 'user'
@ssh_host = $vmnet.bridge_ip_addr
@sshd = SSHServer.new(sshd_host = @ssh_host, sshd_port = @ssh_port)
@sshd.start
add_after_scenario_hook { @sshd.stop }
@ssh_host = @sshd_server_host
end
ssh_port_suffix = "-p #{@ssh_port}" if @ssh_port
......
Markdown is supported
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