Skip to content

Commit

Permalink
integration-tests: Use IP address for commands
Browse files Browse the repository at this point in the history
  • Loading branch information
vinzenz committed Jul 24, 2017
1 parent 063b429 commit 884d5bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions integration-tests/features/leapp_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ def make_migration_command(self, source_vm, target_vm,
container_name=None):
"""Get command to recreate source VM as a macrocontainer on given target VM"""
vm_helper = self._vm_helper
source_host = vm_helper.get_hostname(source_vm)
target_host = vm_helper.get_hostname(target_vm)
source_host = vm_helper.get_ip_address(source_vm)
target_host = vm_helper.get_ip_address(target_vm)
return self._make_migration_command(
source_host,
target_host,
Expand All @@ -226,8 +226,8 @@ def migrate_as_macrocontainer(self, source_vm, target_vm,
migration_opt=None, force_create=False):
"""Recreate source VM as a macrocontainer on given target VM"""
vm_helper = self._vm_helper
source_host = vm_helper.get_hostname(source_vm)
target_host = vm_helper.get_hostname(target_vm)
source_host = vm_helper.get_ip_address(source_vm)
target_host = vm_helper.get_ip_address(target_vm)
return self._convert_vm_to_macrocontainer(
source_host,
target_host,
Expand All @@ -238,7 +238,7 @@ def migrate_as_macrocontainer(self, source_vm, target_vm,
def check_target(self, target_vm, time_limit=10):
"""Check viability of target VM and report currently unavailable names"""
command_output = self.check_response_time(
["check-target", "-t", self._vm_helper.get_hostname(target_vm)],
["check-target", "-t", self._vm_helper.get_ip_address(target_vm)],
time_limit,
use_default_identity=True
)
Expand All @@ -248,7 +248,7 @@ def check_target(self, target_vm, time_limit=10):
def check_target_status(self, target_vm, time_limit=10):
"""Check services status of target VM and report results"""
command_output = self.check_response_time(
["check-target", "--status", "-t", self._vm_helper.get_hostname(target_vm)],
["check-target", "--status", "-t", self._vm_helper.get_ip_address(target_vm)],
time_limit,
use_default_identity=True
)
Expand Down
22 changes: 11 additions & 11 deletions integration-tests/features/steps/default-port-detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import subprocess


def _get_hostname(context, name):
return context.vm_helper.get_hostname(name)
def get_ip_address(context, name):
return context.vm_helper.get_ip_address(name)

def _assert_discovered_ports(ports, expected_ports):
ports = loads(ports)
Expand All @@ -23,7 +23,7 @@ def check_specific_ports_used_by_vm(context, vm_source_name, vm_target_name):
"""check if ports 22,80,111 are open and forwarded to 9022,80,112"""

ports = context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name)],
time_limit=60
)
expected_ports = "[[9022,22],[80,80],[112,111]]"
Expand All @@ -34,7 +34,7 @@ def check_specific_ports_used_by_vm_with_override(context, vm_source_name, vm_ta
"""check if ports 22,80,111 are open and forwarded to 9022,8080,112"""

ports = context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--tcp-port", "{}:{}".format(target_port, source_port)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--tcp-port", "{}:{}".format(target_port, source_port)],
time_limit=60
)
expected_ports = "[[9022,22],[{},{}],[112,111]]".format(target_port, source_port)
Expand All @@ -45,7 +45,7 @@ def check_specific_ports_used_by_vm_with_addition_and_override(context, vm_sourc
"""check if ports 22,80,111 are open and forwarded to 9022,8080,112"""

ports = context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--tcp-port", "{}:{}".format(target_port, source_port)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--tcp-port", "{}:{}".format(target_port, source_port)],
time_limit=60
)
expected_ports = "[[9022,22],[80,80],[81,8080],[112,111]]"
Expand All @@ -56,7 +56,7 @@ def check_specific_ports_used_by_vm_with_addition(context, vm_source_name, vm_ta
"""check if ports 22,80,111,8080 are open and forwarded to 9022,8080,112,8080"""

ports = context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--tcp-port", "{}:{}".format(source_port, target_port)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--tcp-port", "{}:{}".format(source_port, target_port)],
time_limit=60
)
expected_ports = "[[9022,22],[80,80],[112,111],[{},{}]]".format(target_port, source_port)
Expand All @@ -67,7 +67,7 @@ def check_user_defined_ports(context, vm_source_name, vm_target_name, target_por
"""check if ports 22,80,111,8080 are open and forwarded to 9022,8080,111,8080"""

ports = context.cli_helper.check_response_time(
["migrate-machine", "-p", "--ignore-default-port-map", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--tcp-port", "{}:{}".format(target_port_0, target_port_0), "{}:{}".format(target_port_1, target_port_1)],
["migrate-machine", "-p", "--ignore-default-port-map", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--tcp-port", "{}:{}".format(target_port_0, target_port_0), "{}:{}".format(target_port_1, target_port_1)],
time_limit=60
)

Expand All @@ -80,7 +80,7 @@ def check_specific_ports_used_by_vm_and_remove_some(context, vm_source_name, vm_
"""check if ports 22,80,111,8080 are open and forwarded to 9022,8080,112,8080"""

ports = context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--no-tcp-port", "{}".format(excluded_port)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--no-tcp-port", "{}".format(excluded_port)],
time_limit=60
)
expected_ports = "[[9022,22],[80,80]]"
Expand All @@ -91,7 +91,7 @@ def check_specific_ports_used_by_vm_add_and_remove(context, vm_source_name, vm_t
"""check if ports 22,80,111,1111 are open and forwarded to 9022,8080,112"""

ports = context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--no-tcp-port", "{}".format(add_port), "--tcp-port", "{}:{}".format(add_port, add_port)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--no-tcp-port", "{}".format(add_port), "--tcp-port", "{}:{}".format(add_port, add_port)],
time_limit=60
)
expected_ports = "[[9022,22],[80,80],[112,111]]"
Expand All @@ -103,7 +103,7 @@ def collision_detect_source_target(context, vm_source_name, vm_target_name, sour
return_code = 0
try:
context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--tcp-port", "{}:{}".format(source_port, target_port)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--tcp-port", "{}:{}".format(source_port, target_port)],
time_limit=60
)
except subprocess.CalledProcessError as e:
Expand All @@ -116,7 +116,7 @@ def collision_detect_target_target(context, vm_source_name, vm_target_name, targ
return_code = 0
try:
context.cli_helper.check_response_time(
["migrate-machine", "-p", "-t", _get_hostname(context, vm_target_name), _get_hostname(context, vm_source_name), "--tcp-port", "{}:111".format(target_port), "{}:112".format(target_port)],
["migrate-machine", "-p", "-t", get_ip_address(context, vm_target_name), get_ip_address(context, vm_source_name), "--tcp-port", "{}:111".format(target_port), "{}:112".format(target_port)],
time_limit=60
)
except subprocess.CalledProcessError as e:
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/features/steps/destroy_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def check_destroy_container(context, container, target, time_limit):
if not claimed_names:
raise RuntimeError("Claim names in test scenario setup to use this step")
context.cli_helper.check_response_time(
["destroy-container", "-t", context.vm_helper.get_hostname(target), container],
["destroy-container", "-t", context.vm_helper.get_ip_address(target), container],
time_limit,
use_default_identity=True
)
Expand Down

0 comments on commit 884d5bb

Please sign in to comment.