HOTFIX: FREE_STORAGE condition

FREE_STORAGE may be false or true and it affects GAS transfer.

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
Elizaveta Chichindaeva 2022-09-06 13:23:53 +03:00
parent 926a7a5779
commit 38a177107e
2 changed files with 22 additions and 12 deletions

View file

@ -7,6 +7,8 @@ from common import (
IR_WALLET_PASS, IR_WALLET_PASS,
IR_WALLET_PATH, IR_WALLET_PATH,
SIMPLE_OBJ_SIZE, SIMPLE_OBJ_SIZE,
ASSETS_DIR,
FREE_STORAGE
) )
from epoch import tick_epoch from epoch import tick_epoch
from typing import Optional from typing import Optional
@ -48,11 +50,12 @@ deposit = 30
@pytest.mark.storage_group @pytest.mark.storage_group
class TestStorageGroup: class TestStorageGroup:
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def prepare_two_wallets(self, prepare_wallet_and_deposit, tmp_path): def prepare_two_wallets(self, prepare_wallet_and_deposit):
self.main_wallet = prepare_wallet_and_deposit self.main_wallet = prepare_wallet_and_deposit
self.other_wallet, _, _ = init_wallet(tmp_path) self.other_wallet, _, _ = init_wallet(ASSETS_DIR)
transfer_mainnet_gas(self.other_wallet, 31) if not FREE_STORAGE:
neofs_deposit(self.other_wallet, 30) transfer_mainnet_gas(self.other_wallet, 31)
neofs_deposit(self.other_wallet, 30)
@allure.title("Test Storage Group in Private Container") @allure.title("Test Storage Group in Private Container")
def test_storagegroup_basic_private_container(self, object_size): def test_storagegroup_basic_private_container(self, object_size):
@ -204,10 +207,11 @@ class TestStorageGroup:
and include an Object created on behalf of some user. We expect and include an Object created on behalf of some user. We expect
that System key is granted to make all operations except PUT and DELETE. that System key is granted to make all operations except PUT and DELETE.
""" """
transfer_mainnet_gas( if not FREE_STORAGE:
IR_WALLET_PATH, deposit + 1, wallet_password=IR_WALLET_PASS transfer_mainnet_gas(
) IR_WALLET_PATH, deposit + 1, wallet_password=IR_WALLET_PASS
neofs_deposit(IR_WALLET_PATH, deposit, wallet_password=IR_WALLET_PASS) )
neofs_deposit(IR_WALLET_PATH, deposit, wallet_password=IR_WALLET_PASS)
storage_group = put_storagegroup(wallet, cid, obj_list) storage_group = put_storagegroup(wallet, cid, obj_list)
with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED): with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED):
put_storagegroup( put_storagegroup(

View file

@ -17,7 +17,11 @@ from common import (
from complex_object_actions import get_link_object from complex_object_actions import get_link_object
from neofs_verbs import head_object from neofs_verbs import head_object
import allure
logger = logging.getLogger("NeoLogger")
@allure.step('Put Storagegroup')
def put_storagegroup( def put_storagegroup(
wallet: str, wallet: str,
cid: str, cid: str,
@ -51,6 +55,7 @@ def put_storagegroup(
return oid return oid
@allure.step('List Storagegroup')
def list_storagegroup( def list_storagegroup(
wallet: str, cid: str, bearer_token: str = "", wallet_config: str = WALLET_CONFIG wallet: str, cid: str, bearer_token: str = "", wallet_config: str = WALLET_CONFIG
): ):
@ -77,6 +82,7 @@ def list_storagegroup(
return found_objects return found_objects
@allure.step('Get Storagegroup')
def get_storagegroup( def get_storagegroup(
wallet: str, wallet: str,
cid: str, cid: str,
@ -122,6 +128,7 @@ def get_storagegroup(
return sg_dict return sg_dict
@allure.step('Delete Storagegroup')
def delete_storagegroup( def delete_storagegroup(
wallet: str, wallet: str,
cid: str, cid: str,
@ -152,6 +159,7 @@ def delete_storagegroup(
return tombstone_id return tombstone_id
@allure.step('Verify list operation over Storagegroup')
def verify_list_storage_group( def verify_list_storage_group(
wallet: str, wallet: str,
cid: str, cid: str,
@ -162,12 +170,10 @@ def verify_list_storage_group(
storage_groups = list_storagegroup( storage_groups = list_storagegroup(
wallet, cid, bearer_token=bearer, wallet_config=wallet_config wallet, cid, bearer_token=bearer, wallet_config=wallet_config
) )
try: assert storagegroup in storage_groups
storagegroup in storage_groups
except:
logging.error("Storage Group hasn't been persisted")
@allure.step('Verify get operation over Storagegroup')
def verify_get_storage_group( def verify_get_storage_group(
wallet: str, wallet: str,
cid: str, cid: str,