forked from TrueCloudLab/frostfs-testcases
[#312] add new test for s3
Signed-off-by: Yulia Kovshova <y.kovshova@yadro.com>
This commit is contained in:
parent
b385c2466c
commit
ee2ed667c6
12 changed files with 2754 additions and 784 deletions
38
pytest_tests/steps/s3_gate_base.py
Normal file
38
pytest_tests/steps/s3_gate_base.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
import os
|
||||
|
||||
import allure
|
||||
import pytest
|
||||
from python_keywords.container import list_containers
|
||||
from steps import s3_gate_bucket
|
||||
from steps.aws_cli_client import AwsCliClient
|
||||
|
||||
|
||||
class TestS3GateBase:
|
||||
s3_client = None
|
||||
|
||||
@pytest.fixture(scope='class', autouse=True)
|
||||
@allure.title('[Class/Autouse]: Create S3 client')
|
||||
def s3_client(self, prepare_wallet_and_deposit, request):
|
||||
wallet = prepare_wallet_and_deposit
|
||||
s3_bearer_rules_file = f"{os.getcwd()}/robot/resources/files/s3_bearer_rules.json"
|
||||
|
||||
cid, bucket, access_key_id, secret_access_key, owner_private_key = \
|
||||
s3_gate_bucket.init_s3_credentials(
|
||||
wallet, s3_bearer_rules_file=s3_bearer_rules_file)
|
||||
containers_list = list_containers(wallet)
|
||||
assert cid in containers_list, f'Expected cid {cid} in {containers_list}'
|
||||
|
||||
if request.param == 'aws cli':
|
||||
try:
|
||||
client = AwsCliClient(access_key_id, secret_access_key)
|
||||
except Exception as err:
|
||||
if 'command was not found or was not executable' in str(err):
|
||||
pytest.skip('AWS CLI was not found')
|
||||
else:
|
||||
raise RuntimeError(
|
||||
'Error on creating instance for AwsCliClient') from err
|
||||
else:
|
||||
client = s3_gate_bucket.config_s3_client(
|
||||
access_key_id, secret_access_key)
|
||||
TestS3GateBase.s3_client = client
|
||||
TestS3GateBase.wallet = wallet
|
Loading…
Add table
Add a link
Reference in a new issue