From dc5a9e7bb9336a9b331c119a09615e68f4703d01 Mon Sep 17 00:00:00 2001 From: Kirill Sosnovskikh Date: Tue, 17 Dec 2024 18:16:54 +0300 Subject: [PATCH] [#340] Move s3 and http directories to avoid conflict with requests Signed-off-by: Kirill Sosnovskikh --- pyproject.toml | 2 +- src/frostfs_testlib/clients/__init__.py | 5 +++++ src/frostfs_testlib/{ => clients}/http/__init__.py | 0 src/frostfs_testlib/{ => clients}/http/http_client.py | 0 src/frostfs_testlib/clients/s3/__init__.py | 1 + src/frostfs_testlib/{ => clients}/s3/aws_cli_client.py | 2 +- src/frostfs_testlib/{ => clients}/s3/boto3_client.py | 2 +- src/frostfs_testlib/{ => clients}/s3/curl_bucket_resolver.py | 2 +- src/frostfs_testlib/{ => clients}/s3/interfaces.py | 0 src/frostfs_testlib/{ => clients}/s3/s3_http_client.py | 2 +- src/frostfs_testlib/s3/__init__.py | 3 --- src/frostfs_testlib/steps/cli/container.py | 2 -- src/frostfs_testlib/steps/http/__init__.py | 0 src/frostfs_testlib/steps/{http => }/http_gate.py | 2 +- src/frostfs_testlib/steps/{s3 => }/s3_helper.py | 4 +--- .../storage/grpc_operations/implementations/container.py | 2 +- tests/test_dataclasses.py | 2 +- 17 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 src/frostfs_testlib/clients/__init__.py rename src/frostfs_testlib/{ => clients}/http/__init__.py (100%) rename src/frostfs_testlib/{ => clients}/http/http_client.py (100%) create mode 100644 src/frostfs_testlib/clients/s3/__init__.py rename src/frostfs_testlib/{ => clients}/s3/aws_cli_client.py (99%) rename src/frostfs_testlib/{ => clients}/s3/boto3_client.py (99%) rename src/frostfs_testlib/{ => clients}/s3/curl_bucket_resolver.py (88%) rename src/frostfs_testlib/{ => clients}/s3/interfaces.py (100%) rename src/frostfs_testlib/{ => clients}/s3/s3_http_client.py (98%) delete mode 100644 src/frostfs_testlib/s3/__init__.py delete mode 100644 src/frostfs_testlib/steps/http/__init__.py rename src/frostfs_testlib/steps/{http => }/http_gate.py (99%) rename src/frostfs_testlib/steps/{s3 => }/s3_helper.py (97%) diff --git a/pyproject.toml b/pyproject.toml index 3faa637..2778f8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ authmate = "frostfs_testlib.credentials.authmate_s3_provider:AuthmateS3Credentia wallet_factory = "frostfs_testlib.credentials.wallet_factory_provider:WalletFactoryProvider" [project.entry-points."frostfs.testlib.bucket_cid_resolver"] -frostfs = "frostfs_testlib.s3.curl_bucket_resolver:CurlBucketContainerResolver" +frostfs = "frostfs_testlib.clients.s3.curl_bucket_resolver:CurlBucketContainerResolver" [tool.isort] profile = "black" diff --git a/src/frostfs_testlib/clients/__init__.py b/src/frostfs_testlib/clients/__init__.py new file mode 100644 index 0000000..e46766b --- /dev/null +++ b/src/frostfs_testlib/clients/__init__.py @@ -0,0 +1,5 @@ +from frostfs_testlib.clients.http.http_client import HttpClient +from frostfs_testlib.clients.s3.aws_cli_client import AwsCliClient +from frostfs_testlib.clients.s3.boto3_client import Boto3ClientWrapper +from frostfs_testlib.clients.s3.interfaces import S3ClientWrapper +from frostfs_testlib.clients.s3.s3_http_client import S3HttpClient diff --git a/src/frostfs_testlib/http/__init__.py b/src/frostfs_testlib/clients/http/__init__.py similarity index 100% rename from src/frostfs_testlib/http/__init__.py rename to src/frostfs_testlib/clients/http/__init__.py diff --git a/src/frostfs_testlib/http/http_client.py b/src/frostfs_testlib/clients/http/http_client.py similarity index 100% rename from src/frostfs_testlib/http/http_client.py rename to src/frostfs_testlib/clients/http/http_client.py diff --git a/src/frostfs_testlib/clients/s3/__init__.py b/src/frostfs_testlib/clients/s3/__init__.py new file mode 100644 index 0000000..65a3990 --- /dev/null +++ b/src/frostfs_testlib/clients/s3/__init__.py @@ -0,0 +1 @@ +from frostfs_testlib.clients.s3.interfaces import BucketContainerResolver, S3ClientWrapper, VersioningStatus diff --git a/src/frostfs_testlib/s3/aws_cli_client.py b/src/frostfs_testlib/clients/s3/aws_cli_client.py similarity index 99% rename from src/frostfs_testlib/s3/aws_cli_client.py rename to src/frostfs_testlib/clients/s3/aws_cli_client.py index 4196c77..3496b2b 100644 --- a/src/frostfs_testlib/s3/aws_cli_client.py +++ b/src/frostfs_testlib/clients/s3/aws_cli_client.py @@ -6,8 +6,8 @@ from time import sleep from typing import Literal, Optional, Union from frostfs_testlib import reporter +from frostfs_testlib.clients.s3.interfaces import S3ClientWrapper, VersioningStatus, _make_objs_dict from frostfs_testlib.resources.common import ASSETS_DIR, MAX_REQUEST_ATTEMPTS, RETRY_MODE, S3_SYNC_WAIT_TIME -from frostfs_testlib.s3.interfaces import S3ClientWrapper, VersioningStatus, _make_objs_dict from frostfs_testlib.shell import CommandOptions from frostfs_testlib.shell.local_shell import LocalShell from frostfs_testlib.utils import string_utils diff --git a/src/frostfs_testlib/s3/boto3_client.py b/src/frostfs_testlib/clients/s3/boto3_client.py similarity index 99% rename from src/frostfs_testlib/s3/boto3_client.py rename to src/frostfs_testlib/clients/s3/boto3_client.py index 6b6c74e..53e7ffa 100644 --- a/src/frostfs_testlib/s3/boto3_client.py +++ b/src/frostfs_testlib/clients/s3/boto3_client.py @@ -13,8 +13,8 @@ from botocore.exceptions import ClientError from mypy_boto3_s3 import S3Client from frostfs_testlib import reporter +from frostfs_testlib.clients.s3.interfaces import S3ClientWrapper, VersioningStatus, _make_objs_dict from frostfs_testlib.resources.common import ASSETS_DIR, MAX_REQUEST_ATTEMPTS, RETRY_MODE, S3_SYNC_WAIT_TIME -from frostfs_testlib.s3.interfaces import S3ClientWrapper, VersioningStatus, _make_objs_dict from frostfs_testlib.utils import string_utils # TODO: Refactor this code to use shell instead of _cmd_run diff --git a/src/frostfs_testlib/s3/curl_bucket_resolver.py b/src/frostfs_testlib/clients/s3/curl_bucket_resolver.py similarity index 88% rename from src/frostfs_testlib/s3/curl_bucket_resolver.py rename to src/frostfs_testlib/clients/s3/curl_bucket_resolver.py index b713e79..4d845cf 100644 --- a/src/frostfs_testlib/s3/curl_bucket_resolver.py +++ b/src/frostfs_testlib/clients/s3/curl_bucket_resolver.py @@ -1,7 +1,7 @@ import re from frostfs_testlib.cli.generic_cli import GenericCli -from frostfs_testlib.s3.interfaces import BucketContainerResolver +from frostfs_testlib.clients.s3 import BucketContainerResolver from frostfs_testlib.storage.cluster import ClusterNode diff --git a/src/frostfs_testlib/s3/interfaces.py b/src/frostfs_testlib/clients/s3/interfaces.py similarity index 100% rename from src/frostfs_testlib/s3/interfaces.py rename to src/frostfs_testlib/clients/s3/interfaces.py diff --git a/src/frostfs_testlib/s3/s3_http_client.py b/src/frostfs_testlib/clients/s3/s3_http_client.py similarity index 98% rename from src/frostfs_testlib/s3/s3_http_client.py rename to src/frostfs_testlib/clients/s3/s3_http_client.py index a34c380..b83e7a8 100644 --- a/src/frostfs_testlib/s3/s3_http_client.py +++ b/src/frostfs_testlib/clients/s3/s3_http_client.py @@ -8,7 +8,7 @@ from botocore.awsrequest import AWSRequest from botocore.credentials import Credentials from frostfs_testlib import reporter -from frostfs_testlib.http.http_client import HttpClient +from frostfs_testlib.clients import HttpClient from frostfs_testlib.utils.file_utils import TestFile logger = logging.getLogger("NeoLogger") diff --git a/src/frostfs_testlib/s3/__init__.py b/src/frostfs_testlib/s3/__init__.py deleted file mode 100644 index 32426c2..0000000 --- a/src/frostfs_testlib/s3/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from frostfs_testlib.s3.aws_cli_client import AwsCliClient -from frostfs_testlib.s3.boto3_client import Boto3ClientWrapper -from frostfs_testlib.s3.interfaces import S3ClientWrapper, VersioningStatus diff --git a/src/frostfs_testlib/steps/cli/container.py b/src/frostfs_testlib/steps/cli/container.py index db896ce..092b1a3 100644 --- a/src/frostfs_testlib/steps/cli/container.py +++ b/src/frostfs_testlib/steps/cli/container.py @@ -7,9 +7,7 @@ from typing import Optional, Union from frostfs_testlib import reporter from frostfs_testlib.cli import FrostfsCli -from frostfs_testlib.plugins import load_plugin from frostfs_testlib.resources.cli import CLI_DEFAULT_TIMEOUT, FROSTFS_CLI_EXEC -from frostfs_testlib.s3.interfaces import BucketContainerResolver from frostfs_testlib.shell import Shell from frostfs_testlib.steps.cli.object import put_object, put_object_to_random_node from frostfs_testlib.storage.cluster import Cluster, ClusterNode diff --git a/src/frostfs_testlib/steps/http/__init__.py b/src/frostfs_testlib/steps/http/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/frostfs_testlib/steps/http/http_gate.py b/src/frostfs_testlib/steps/http_gate.py similarity index 99% rename from src/frostfs_testlib/steps/http/http_gate.py rename to src/frostfs_testlib/steps/http_gate.py index 117cded..4e712c1 100644 --- a/src/frostfs_testlib/steps/http/http_gate.py +++ b/src/frostfs_testlib/steps/http_gate.py @@ -12,8 +12,8 @@ import requests from frostfs_testlib import reporter from frostfs_testlib.cli import GenericCli +from frostfs_testlib.clients.s3.aws_cli_client import command_options from frostfs_testlib.resources.common import ASSETS_DIR, SIMPLE_OBJECT_SIZE -from frostfs_testlib.s3.aws_cli_client import command_options from frostfs_testlib.shell import Shell from frostfs_testlib.shell.local_shell import LocalShell from frostfs_testlib.steps.cli.object import get_object diff --git a/src/frostfs_testlib/steps/s3/s3_helper.py b/src/frostfs_testlib/steps/s3_helper.py similarity index 97% rename from src/frostfs_testlib/steps/s3/s3_helper.py rename to src/frostfs_testlib/steps/s3_helper.py index 7949f2d..c3092df 100644 --- a/src/frostfs_testlib/steps/s3/s3_helper.py +++ b/src/frostfs_testlib/steps/s3_helper.py @@ -6,13 +6,11 @@ from typing import Optional from dateutil.parser import parse from frostfs_testlib import reporter -from frostfs_testlib.s3 import S3ClientWrapper, VersioningStatus -from frostfs_testlib.s3.interfaces import BucketContainerResolver +from frostfs_testlib.clients.s3 import BucketContainerResolver, S3ClientWrapper, VersioningStatus from frostfs_testlib.shell import Shell from frostfs_testlib.steps.cli.container import search_nodes_with_container from frostfs_testlib.storage.cluster import Cluster, ClusterNode from frostfs_testlib.storage.dataclasses.wallet import WalletInfo -from frostfs_testlib.utils.file_utils import TestFile, get_file_hash logger = logging.getLogger("NeoLogger") diff --git a/src/frostfs_testlib/storage/grpc_operations/implementations/container.py b/src/frostfs_testlib/storage/grpc_operations/implementations/container.py index 7a637d7..86cac26 100644 --- a/src/frostfs_testlib/storage/grpc_operations/implementations/container.py +++ b/src/frostfs_testlib/storage/grpc_operations/implementations/container.py @@ -5,9 +5,9 @@ from typing import List, Optional, Union from frostfs_testlib import reporter from frostfs_testlib.cli.frostfs_cli.cli import FrostfsCli +from frostfs_testlib.clients.s3 import BucketContainerResolver from frostfs_testlib.plugins import load_plugin from frostfs_testlib.resources.cli import CLI_DEFAULT_TIMEOUT -from frostfs_testlib.s3.interfaces import BucketContainerResolver from frostfs_testlib.storage.cluster import Cluster, ClusterNode from frostfs_testlib.storage.grpc_operations import interfaces from frostfs_testlib.utils import json_utils diff --git a/tests/test_dataclasses.py b/tests/test_dataclasses.py index 19f3832..677aed4 100644 --- a/tests/test_dataclasses.py +++ b/tests/test_dataclasses.py @@ -2,7 +2,7 @@ from typing import Any import pytest -from frostfs_testlib.s3 import AwsCliClient, Boto3ClientWrapper +from frostfs_testlib.clients import AwsCliClient, Boto3ClientWrapper from frostfs_testlib.storage.dataclasses.acl import EACLRole from frostfs_testlib.storage.dataclasses.frostfs_services import HTTPGate, InnerRing, MorphChain, S3Gate, StorageNode from frostfs_testlib.storage.dataclasses.object_size import ObjectSize