Refactor fixture that checks cloud environment

Now it relies on presence of sbercloud configuration rather than on free storage setting.

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-08-02 09:37:28 +03:00
parent e1d7999313
commit eff4b032a5
3 changed files with 8 additions and 5 deletions

View file

@ -12,6 +12,7 @@ from cli_helpers import _cmd_run
from common import ASSETS_DIR, FREE_STORAGE, MAINNET_WALLET_PATH, NEOFS_NETMAP_DICT
from payment_neogo import neofs_deposit, transfer_mainnet_gas
from python_keywords.node_management import node_healthcheck
from sbercloud_helper import SberCloudConfig
def robot_keyword_adapter(name=None, tags=(), types=()):
@ -24,8 +25,9 @@ logger = logging.getLogger('NeoLogger')
@pytest.fixture(scope='session')
def free_storage_check():
if os.getenv('FREE_STORAGE', default='False').lower() not in ('true', '1'):
def cloud_infrastructure_check():
cloud_config = SberCloudConfig.from_env()
if not cloud_config.project_id:
pytest.skip('Test only works on SberCloud infrastructure')
yield

View file

@ -62,7 +62,7 @@ def restore_network():
@allure.title('Block Storage node traffic')
@pytest.mark.failover
@pytest.mark.failover_net
def test_block_storage_node_traffic(prepare_wallet_and_deposit, free_storage_check):
def test_block_storage_node_traffic(prepare_wallet_and_deposit, cloud_infrastructure_check):
"""
Block storage nodes traffic using iptables and wait for replication for objects.
"""

View file

@ -56,7 +56,7 @@ def return_all_storage_nodes(sbercloud_client: SberCloud) -> None:
@pytest.mark.parametrize('hard_reboot', [True, False])
@pytest.mark.failover
def test_lost_storage_node(prepare_wallet_and_deposit, sbercloud_client: SberCloud,
free_storage_check, hard_reboot: bool):
cloud_infrastructure_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()
@ -88,7 +88,8 @@ def test_lost_storage_node(prepare_wallet_and_deposit, sbercloud_client: SberClo
@pytest.mark.parametrize('sequence', [True, False])
@pytest.mark.failover_panic
@pytest.mark.failover
def test_panic_storage_node(prepare_wallet_and_deposit, free_storage_check, sequence: bool):
def test_panic_storage_node(prepare_wallet_and_deposit, cloud_infrastructure_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()