Fix SberCloud Failovers

This commit is contained in:
Vladimir Avdeev 2022-07-14 09:18:06 +03:00 committed by Vladimir Domnich
parent 01aeacde09
commit c5085f6b47
3 changed files with 58 additions and 6 deletions

38
configuration/id_rsa Normal file
View file

@ -0,0 +1,38 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEA2wk8aExmgGWhKxMh4e+2anHZbIK6RiHwbZvMCddxhDlAQELmmJQk
iklml3TUk/+ykXImmhwMRVIQyuZmhC+pPWhJNJg3o8mmsFWhGmh20rKCv3lCa8GjFkAke8
rEeVQvWtWOCUcG5mOlJWpFGESOBa/G0G7FM6VcF7EAG525Joq1YzBlTEDlAmhP900cCGGT
fd0V6YOQdWGDzHAW1m9NvQHRiNm5hzQh3CLYleAhCUEToy/WX2+i9A261l62T2hkzR1RzD
JgMPxC2WC2U1PigiuLjk0NNZrA88tteeMVODi/rBVz99teLwgqLOxi1t9w249sfEl8k5T1
d6kJD1Bu/uLz/O7adPhsndZZ4fg+0N6UlWV05dYo9lngseDG8KBcLOQVhfHWlTyZOt46DD
pqvp3Ef7irVyae4Ie/5rS0whkjpmJYTV9W2cHcZ7l7qXCiWgsz6ZvXjIE5DMmKxb1mnyA1
j2YY1qqDiWUThc30XiWUSETrgqDPhrmeHa7J1hOBAAAFiHrt07167dO9AAAAB3NzaC1yc2
EAAAGBANsJPGhMZoBloSsTIeHvtmpx2WyCukYh8G2bzAnXcYQ5QEBC5piUJIpJZpd01JP/
spFyJpocDEVSEMrmZoQvqT1oSTSYN6PJprBVoRpodtKygr95QmvBoxZAJHvKxHlUL1rVjg
lHBuZjpSVqRRhEjgWvxtBuxTOlXBexABuduSaKtWMwZUxA5QJoT/dNHAhhk33dFemDkHVh
g8xwFtZvTb0B0YjZuYc0Idwi2JXgIQlBE6Mv1l9vovQNutZetk9oZM0dUcwyYDD8Qt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ff+Eo/h9UuWFg
J1IGBuNU+60NEVMH/O0MOcmuXh/kDaNpi49yn7lYXNHiP47hzXxxobJzLJmYlcalxYZW7c
BNQP/VAlVJmPqjZEmzZnLvNI8gMLZmoIkO3vXUmnE3jOBNMYB7tLyzNVAvQE5iTCKaYLdY
Zzki531PQZrEDmDJvhfjGa6EKq/77K+aI2yKI23S3Wqqs6P0LVW9J3VOWwdCxgckS3aleZ
F0Lh48/5V+HDJa2mr12TMwnC6NE2bSGQAAAMEA25LmHASYVLcm20I5u7CB4oAIeSBpZG4k
5Iafl93RHGj8epan8Q76FyD0xqi54ts/KTjxpgj2xVjH73m7Tk2pnPXeCTE4IsWsWXrRh2
0kxXrMiZwL+zrYIbVEjeUMJsmdFnteRoIbGe9LPaiz2wU5rt8ahoZ2cneL00ozG5zf58aj
xgLaUUesZ2bpexbrCs2T2uvB8nCqbCaJmKr3zFoboN261Lx/pris2kXYyWF9GdpeuT7V3Z
Rwp4yKsryldompAAAADGFsZXhAYWxleC1WTQECAwQFBg==
-----END OPENSSH PRIVATE KEY-----

View file

@ -65,7 +65,7 @@ class HostClient:
TIMEOUT_RESTORE_CONNECTION = 10, 24
def __init__(self, ip: str, login: str, password: Optional[str],
def __init__(self, ip: str, login: Optional[str] = None, password: Optional[str] = None,
private_key_path: Optional[str] = None, init_ssh_client=True) -> None:
self.ip = ip
self.login = login

View file

@ -4,7 +4,6 @@ from time import sleep
import allure
import pytest
from common import STORAGE_NODE_PWD, STORAGE_NODE_USER
from python_keywords.container import create_container
from python_keywords.neofs_verbs import get_object, put_object
from python_keywords.utility_keywords import generate_file, get_file_hash
@ -13,13 +12,26 @@ from ssh_helper import HostClient, HostIsNotAvailable
from storage_policy import get_nodes_with_object
from wellknown_acl import PUBLIC_ACL
SSH_PK_PATH = f'{os.getcwd()}/configuration/id_rsa'
logger = logging.getLogger('NeoLogger')
stopped_hosts = []
@pytest.fixture(scope='session')
def free_storage_check():
if os.getenv('FREE_STORAGE', default='False').lower() not in ('true', '1'):
pytest.skip('Test work only on SberCloud infrastructure')
yield
@pytest.fixture(scope='session')
def sbercloud_client():
with allure.step('Connect to SberCloud'):
try:
yield SberCloud(f'{os.getcwd()}/configuration/sbercloud.yaml')
except Exception:
pytest.fail('SberCloud infrastructure not available')
yield None
@pytest.fixture(scope='session', autouse=True)
@ -30,7 +42,8 @@ def return_all_storage_nodes_fixture(sbercloud_client):
@allure.title('Hard reboot host via magic SysRq option')
def panic_reboot_host(ip: str = None):
ssh = HostClient(ip=ip, login=STORAGE_NODE_USER, password=STORAGE_NODE_PWD)
ssh = HostClient(ip=ip, init_ssh_client=False)
ssh.pk = SSH_PK_PATH
ssh.create_connection(attempts=1)
ssh.exec('echo 1 > /proc/sys/kernel/sysrq')
with pytest.raises(HostIsNotAvailable):
@ -56,7 +69,8 @@ def wait_object_replication(wallet, cid, oid, expected_copies: int) -> [str]:
@allure.title('Lost and return nodes')
@pytest.mark.parametrize('hard_reboot', [True, False])
def test_lost_storage_node(prepare_wallet_and_deposit, sbercloud_client: SberCloud, hard_reboot: bool):
def test_lost_storage_node(prepare_wallet_and_deposit, sbercloud_client: SberCloud,
free_storage_check, hard_reboot: bool):
wallet = prepare_wallet_and_deposit
placement_rule = 'REP 2 IN X CBF 2 SELECT 2 FROM * AS X'
source_file_path = generate_file()
@ -85,7 +99,7 @@ def test_lost_storage_node(prepare_wallet_and_deposit, sbercloud_client: SberClo
@allure.title('Panic storage node(s)')
@pytest.mark.parametrize('sequence', [True, False])
def test_panic_storage_node(prepare_wallet_and_deposit, sequence: bool):
def test_panic_storage_node(prepare_wallet_and_deposit, free_storage_check, sequence: bool):
wallet = prepare_wallet_and_deposit
placement_rule = 'REP 2 IN X CBF 2 SELECT 2 FROM * AS X'
source_file_path = generate_file()