Switch failover test to hosting from testlib

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-10-13 16:13:45 +00:00 committed by Vladimir
parent 92c034c10b
commit 48e53b3d86
20 changed files with 242 additions and 441 deletions

View file

@ -1,16 +1,13 @@
from ssh_helper import HostClient
from neofs_testlib.shell import Shell
# TODO: convert to shell from hosting
class IpTablesHelper:
@staticmethod
def drop_input_traffic_to_port(client: HostClient, ports: list[str]):
def drop_input_traffic_to_port(shell: Shell, ports: list[str]) -> None:
for port in ports:
cmd_output = client.exec(cmd=f"sudo iptables -A INPUT -p tcp --dport {port} -j DROP")
assert cmd_output.rc == 0
shell.exec(f"sudo iptables -A INPUT -p tcp --dport {port} -j DROP")
@staticmethod
def restore_input_traffic_to_port(client: HostClient, ports: list[str]):
def restore_input_traffic_to_port(shell: Shell, ports: list[str]) -> None:
for port in ports:
cmd_output = client.exec(cmd=f"sudo iptables -D INPUT -p tcp --dport {port} -j DROP")
assert cmd_output.rc == 0
shell.exec(f"sudo iptables -D INPUT -p tcp --dport {port} -j DROP")