Update environment check for failover tests
With testlib we have a new concept of host. Depending on number of hosts we can decide whether to run tests or not. This allows us to run failover tests on devenv if we deploy multiple devenv hosts, also this allows us to add hardware hosting without modifying code of the tests. Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
parent
bfd02531ef
commit
92c034c10b
4 changed files with 9 additions and 11 deletions
|
@ -12,7 +12,6 @@ from common import (
|
||||||
ASSETS_DIR,
|
ASSETS_DIR,
|
||||||
FREE_STORAGE,
|
FREE_STORAGE,
|
||||||
HOSTING_CONFIG_FILE,
|
HOSTING_CONFIG_FILE,
|
||||||
INFRASTRUCTURE_TYPE,
|
|
||||||
MAINNET_WALLET_PATH,
|
MAINNET_WALLET_PATH,
|
||||||
NEOFS_NETMAP_DICT,
|
NEOFS_NETMAP_DICT,
|
||||||
)
|
)
|
||||||
|
@ -31,9 +30,10 @@ def client_shell() -> Shell:
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def cloud_infrastructure_check():
|
def require_multiple_hosts(hosting: Hosting):
|
||||||
if INFRASTRUCTURE_TYPE != "CLOUD_VM":
|
"""Fixture that is applied to tests that require that environment has multiple hosts."""
|
||||||
pytest.skip("Test only works on SberCloud infrastructure")
|
if len(hosting.hosts) <= 1:
|
||||||
|
pytest.skip("Test only works with multiple hosts")
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,8 +103,8 @@ def run_health_check(collect_logs, hosting: Hosting):
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
@allure.title("Prepare wallet and deposit")
|
@allure.title("Prepare wallet and deposit")
|
||||||
def prepare_wallet_and_deposit(prepare_tmp_dir):
|
def prepare_wallet_and_deposit(prepare_tmp_dir):
|
||||||
wallet_path, addr, _ = wallet.init_wallet(ASSETS_DIR)
|
wallet_path, address, _ = wallet.init_wallet(ASSETS_DIR)
|
||||||
logger.info(f"Init wallet: {wallet_path},\naddr: {addr}")
|
logger.info(f"Init wallet: {wallet_path}, address: {address}")
|
||||||
allure.attach.file(wallet_path, os.path.basename(wallet_path), allure.attachment_type.JSON)
|
allure.attach.file(wallet_path, os.path.basename(wallet_path), allure.attachment_type.JSON)
|
||||||
|
|
||||||
if not FREE_STORAGE:
|
if not FREE_STORAGE:
|
||||||
|
|
|
@ -49,7 +49,7 @@ def restore_network(hosting: Hosting):
|
||||||
@allure.title("Block Storage node traffic")
|
@allure.title("Block Storage node traffic")
|
||||||
@pytest.mark.failover
|
@pytest.mark.failover
|
||||||
@pytest.mark.failover_net
|
@pytest.mark.failover_net
|
||||||
def test_block_storage_node_traffic(prepare_wallet_and_deposit, client_shell, cloud_infrastructure_check):
|
def test_block_storage_node_traffic(prepare_wallet_and_deposit, client_shell, require_multiple_hosts):
|
||||||
"""
|
"""
|
||||||
Block storage nodes traffic using iptables and wait for replication for objects.
|
Block storage nodes traffic using iptables and wait for replication for objects.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -58,6 +58,7 @@ def test_lost_storage_node(
|
||||||
client_shell,
|
client_shell,
|
||||||
hosting: Hosting,
|
hosting: Hosting,
|
||||||
hard_reboot: bool,
|
hard_reboot: bool,
|
||||||
|
require_multiple_hosts,
|
||||||
):
|
):
|
||||||
wallet = prepare_wallet_and_deposit
|
wallet = prepare_wallet_and_deposit
|
||||||
placement_rule = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
placement_rule = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
||||||
|
@ -92,7 +93,7 @@ def test_lost_storage_node(
|
||||||
@pytest.mark.failover_panic
|
@pytest.mark.failover_panic
|
||||||
@pytest.mark.failover
|
@pytest.mark.failover
|
||||||
def test_panic_storage_node(
|
def test_panic_storage_node(
|
||||||
prepare_wallet_and_deposit, client_shell, cloud_infrastructure_check, sequence: bool
|
prepare_wallet_and_deposit, client_shell, require_multiple_hosts, sequence: bool
|
||||||
):
|
):
|
||||||
wallet = prepare_wallet_and_deposit
|
wallet = prepare_wallet_and_deposit
|
||||||
placement_rule = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
placement_rule = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
||||||
|
|
|
@ -121,9 +121,6 @@ NEOFS_ADM_CONFIG_PATH = os.getenv("NEOFS_ADM_CONFIG_PATH")
|
||||||
FREE_STORAGE = os.getenv("FREE_STORAGE", "false").lower() == "true"
|
FREE_STORAGE = os.getenv("FREE_STORAGE", "false").lower() == "true"
|
||||||
BIN_VERSIONS_FILE = os.getenv("BIN_VERSIONS_FILE")
|
BIN_VERSIONS_FILE = os.getenv("BIN_VERSIONS_FILE")
|
||||||
|
|
||||||
# TODO: instead of specifying infrastructure type we should use attributes of hosts
|
|
||||||
INFRASTRUCTURE_TYPE = os.getenv("INFRASTRUCTURE_TYPE", "LOCAL_DEVENV")
|
|
||||||
|
|
||||||
HOSTING_CONFIG_FILE = os.getenv("HOSTING_CONFIG_FILE", ".devenv.hosting.yaml")
|
HOSTING_CONFIG_FILE = os.getenv("HOSTING_CONFIG_FILE", ".devenv.hosting.yaml")
|
||||||
|
|
||||||
# Generate wallet configs
|
# Generate wallet configs
|
||||||
|
|
Loading…
Reference in a new issue