diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a350aae3f..513736975 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -119,14 +119,6 @@ jobs: file: 'neofs-rest-gw-linux-amd64' target: 'neofs-testcases/neofs-rest-gw' - - name: Download latest stable neofs-http-gw - uses: dsaltares/fetch-gh-release-asset@1.1.1 - with: - repo: 'nspcc-dev/neofs-http-gw' - version: 'tags/v0.28.0' - file: 'neofs-http-gw-linux-amd64' - target: 'neofs-testcases/neofs-http-gw' - - name: Download latest stable neo-go uses: dsaltares/fetch-gh-release-asset@1.1.1 with: @@ -154,7 +146,6 @@ jobs: sudo chmod a+x neofs-lens sudo chmod a+x neofs-node sudo chmod a+x neofs-rest-gw - sudo chmod a+x neofs-http-gw sudo chmod a+x neo-go sudo chmod a+x neofs-s3-authmate sudo chmod a+x neofs-s3-gw diff --git a/neofs-testlib/neofs_testlib/env/env.py b/neofs-testlib/neofs_testlib/env/env.py index 0c8bedc4b..b58120656 100644 --- a/neofs-testlib/neofs_testlib/env/env.py +++ b/neofs-testlib/neofs_testlib/env/env.py @@ -57,13 +57,11 @@ def __init__(self, neofs_env_config: dict = None): self.neofs_s3_authmate_path = os.getenv("NEOFS_S3_AUTHMATE_BIN", "./neofs-s3-authmate") self.neofs_s3_gw_path = os.getenv("NEOFS_S3_GW_BIN", "./neofs-s3-gw") self.neofs_rest_gw_path = os.getenv("NEOFS_REST_GW_BIN", "./neofs-rest-gw") - self.neofs_http_gw_path = os.getenv("NEOFS_HTTP_GW_BIN", "./neofs-http-gw") # nodes inside env self.storage_nodes = [] self.inner_ring_nodes = [] self.s3_gw = None self.rest_gw = None - self.http_gw = None @property def morph_rpc(self): @@ -156,17 +154,11 @@ def deploy_s3_gw(self): self.s3_gw.start() allure.attach(str(self.s3_gw), "s3_gw", allure.attachment_type.TEXT, ".txt") - @allure.step("Deploy http gateway") - def deploy_http_gw(self): - self.http_gw = HTTP_GW(self) - self.http_gw.start() - allure.attach(str(self.http_gw), "http_gw", allure.attachment_type.TEXT, ".txt") - @allure.step("Deploy rest gateway") def deploy_rest_gw(self): self.rest_gw = REST_GW(self) self.rest_gw.start() - allure.attach(str(self.rest_gw), "http_gw", allure.attachment_type.TEXT, ".txt") + allure.attach(str(self.rest_gw), "rest_gw", allure.attachment_type.TEXT, ".txt") @allure.step("Generate wallet") def generate_wallet( @@ -210,7 +202,6 @@ def generate_wallet( @allure.step("Kill current neofs env") def kill(self): self.rest_gw.process.kill() - self.http_gw.process.kill() self.s3_gw.process.kill() for sn in self.storage_nodes: sn.process.kill() @@ -236,7 +227,6 @@ def log_env_details_to_file(self): env_details += f"{self.s3_gw}\n" env_details += f"{self.rest_gw}\n" - env_details += f"{self.http_gw}\n" fp.write(env_details) @@ -250,7 +240,6 @@ def log_versions_to_allure(self): versions += NeoFSEnv._run_single_command(self.neofs_s3_authmate_path, "--version") versions += NeoFSEnv._run_single_command(self.neofs_s3_gw_path, "--version") versions += NeoFSEnv._run_single_command(self.neofs_rest_gw_path, "--version") - versions += NeoFSEnv._run_single_command(self.neofs_http_gw_path, "--version") allure.attach(versions, f"neofs env versions", allure.attachment_type.TEXT, ".txt") @allure.step("Download binaries") @@ -267,7 +256,6 @@ def download_binaries(self): (self.neofs_s3_authmate_path, "neofs_s3_authmate"), (self.neofs_s3_gw_path, "neofs_s3_gw"), (self.neofs_rest_gw_path, "neofs_rest_gw"), - (self.neofs_http_gw_path, "neofs_http_gw"), ] for binary in binaries: @@ -325,7 +313,6 @@ def simple(cls, neofs_env_config: dict = None) -> "NeoFSEnv": } ) neofs_env.deploy_s3_gw() - neofs_env.deploy_http_gw() neofs_env.deploy_rest_gw() neofs_env.log_env_details_to_file() neofs_env.log_versions_to_allure() @@ -752,74 +739,6 @@ def _launch_process(self): ) -class HTTP_GW: - def __init__(self, neofs_env: NeoFSEnv): - self.neofs_env = neofs_env - self.config_path = NeoFSEnv._generate_temp_file(extension="yml", prefix="http_gw_config") - self.wallet = NodeWallet( - path=NeoFSEnv._generate_temp_file(prefix="http_gw_wallet"), - address="", - password=self.neofs_env.default_password, - ) - self.address = f"{self.neofs_env.domain}:{NeoFSEnv.get_available_port()}" - self.stdout = "Not initialized" - self.stderr = "Not initialized" - self.process = None - - def __str__(self): - return f""" - HTTP Gateway: - - Address: {self.address} - - HTTP GW Config path: {self.config_path} - - STDOUT: {self.stdout} - - STDERR: {self.stderr} - """ - - def __getstate__(self): - attributes = self.__dict__.copy() - del attributes["process"] - return attributes - - def start(self): - if self.process is not None: - raise RuntimeError(f"This http gw instance has already been started:\n{self}") - self.neofs_env.generate_wallet(WalletType.STORAGE, self.wallet, label=f"http") - logger.info(f"Generating config for http gw at {self.config_path}") - self._generate_config() - logger.info(f"Launching HTTP GW: {self}") - self._launch_process() - logger.info(f"Launched HTTP GW: {self}") - - def _generate_config(self): - http_config_template = "http.yaml" - - NeoFSEnv.generate_config_file( - config_template=http_config_template, - config_path=self.config_path, - custom=Path(http_config_template).is_file(), - address=self.address, - wallet=self.wallet, - ) - - def _launch_process(self): - self.stdout = NeoFSEnv._generate_temp_file(prefix="http_gw_stdout") - self.stderr = NeoFSEnv._generate_temp_file(prefix="http_gw_stderr") - stdout_fp = open(self.stdout, "w") - stderr_fp = open(self.stderr, "w") - http_gw_env = {} - - for index, sn in enumerate(self.neofs_env.storage_nodes): - http_gw_env[f"HTTP_GW_PEERS_{index}_ADDRESS"] = sn.endpoint - http_gw_env[f"HTTP_GW_PEERS_{index}_WEIGHT"] = "0.2" - - self.process = subprocess.Popen( - [self.neofs_env.neofs_http_gw_path, "--config", self.config_path], - stdout=stdout_fp, - stderr=stderr_fp, - env=http_gw_env, - ) - - class REST_GW: def __init__(self, neofs_env: NeoFSEnv): self.neofs_env = neofs_env diff --git a/neofs-testlib/neofs_testlib/env/templates/http.yaml b/neofs-testlib/neofs_testlib/env/templates/http.yaml deleted file mode 100644 index 36a75a35a..000000000 --- a/neofs-testlib/neofs_testlib/env/templates/http.yaml +++ /dev/null @@ -1,16 +0,0 @@ -logger: - level: debug # Log level - -rebalance_timer: 5m # Interval to check nodes' health - -connect_timeout: 60s # Timeout to dial node - -request_timeout: 300s # Timeout to check node health during rebalance - -server: - - address: {{ address }} - -# Wallet settings -wallet: - path: {{ wallet.path }} # Path to wallet - passphrase: {{ wallet.password }} # Passphrase to decrypt wallet diff --git a/pytest_tests/pytest.ini b/pytest_tests/pytest.ini index 4ae0fcfff..1740aeb52 100644 --- a/pytest_tests/pytest.ini +++ b/pytest_tests/pytest.ini @@ -15,8 +15,7 @@ markers = grpc_api: standard gRPC API tests grpc_control: tests related to using neofs-cli control commands grpc_object_lock: gRPC lock tests - http_and_rest_gates: HTTP and REST gates contract - http_gate: HTTP gate contract + rest_gate: REST gate tests s3_gate: All S3 gate tests s3_gate_base: Base S3 gate tests s3_gate_bucket: Bucket S3 gate tests diff --git a/pytest_tests/tests/conftest.py b/pytest_tests/tests/conftest.py index 63fe236d8..23eeb1663 100644 --- a/pytest_tests/tests/conftest.py +++ b/pytest_tests/tests/conftest.py @@ -58,7 +58,7 @@ def neofs_env(request): os.makedirs(logs_path, exist_ok=True) shutil.copyfile(neofs_env.s3_gw.stderr, f"{logs_path}/s3_gw_log.txt") - shutil.copyfile(neofs_env.http_gw.stderr, f"{logs_path}/http_gw_log.txt") + shutil.copyfile(neofs_env.rest_gw.stderr, f"{logs_path}/rest_gw_log.txt") for idx, ir in enumerate(neofs_env.inner_ring_nodes): shutil.copyfile(ir.stderr, f"{logs_path}/ir_{idx}_log.txt") for idx, sn in enumerate(neofs_env.storage_nodes): diff --git a/pytest_tests/tests/services/http_rest_gates/conftest.py b/pytest_tests/tests/services/http_rest_gates/conftest.py deleted file mode 100644 index 4a94eb31a..000000000 --- a/pytest_tests/tests/services/http_rest_gates/conftest.py +++ /dev/null @@ -1,15 +0,0 @@ -import logging - -import pytest -from neofs_testlib.env.env import NeoFSEnv - -logger = logging.getLogger("NeoLogger") - - -@pytest.fixture(scope="session", params=["HTTP", "REST"]) -def gw_endpoint(neofs_env: NeoFSEnv, request): - gw_type = request.param - if gw_type == "HTTP": - return f"http://{neofs_env.http_gw.address}" - else: # Assuming REST - return f"http://{neofs_env.rest_gw.address}/v1" diff --git a/pytest_tests/tests/services/rest_gate/conftest.py b/pytest_tests/tests/services/rest_gate/conftest.py new file mode 100644 index 000000000..3fbab8523 --- /dev/null +++ b/pytest_tests/tests/services/rest_gate/conftest.py @@ -0,0 +1,11 @@ +import logging + +import pytest +from neofs_testlib.env.env import NeoFSEnv + +logger = logging.getLogger("NeoLogger") + + +@pytest.fixture(scope="session") +def gw_endpoint(neofs_env: NeoFSEnv): + return f"http://{neofs_env.rest_gw.address}/v1" diff --git a/pytest_tests/tests/services/http_rest_gates/test_http_rest_bearer.py b/pytest_tests/tests/services/rest_gate/test_rest_bearer.py similarity index 97% rename from pytest_tests/tests/services/http_rest_gates/test_http_rest_bearer.py rename to pytest_tests/tests/services/rest_gate/test_rest_bearer.py index ff32bad3e..12d4c6e8a 100644 --- a/pytest_tests/tests/services/http_rest_gates/test_http_rest_bearer.py +++ b/pytest_tests/tests/services/rest_gate/test_rest_bearer.py @@ -25,14 +25,14 @@ @pytest.mark.sanity -@pytest.mark.http_and_rest_gates -class Test_http_rest_bearer(NeofsEnvTestBase): +@pytest.mark.rest_gate +class Test_rest_bearer(NeofsEnvTestBase): PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 2 FROM * AS X" @pytest.fixture(scope="class", autouse=True) @allure.title("[Class/Autouse]: Prepare wallet and deposit") def prepare_wallet(self, default_wallet): - Test_http_rest_bearer.wallet = default_wallet + Test_rest_bearer.wallet = default_wallet @pytest.fixture(scope="class") def user_container(self) -> str: diff --git a/pytest_tests/tests/services/http_rest_gates/test_http_rest_gate.py b/pytest_tests/tests/services/rest_gate/test_rest_gate.py similarity index 88% rename from pytest_tests/tests/services/http_rest_gates/test_http_rest_gate.py rename to pytest_tests/tests/services/rest_gate/test_rest_gate.py index 83a2168a5..bcacd1de8 100644 --- a/pytest_tests/tests/services/http_rest_gates/test_http_rest_gate.py +++ b/pytest_tests/tests/services/rest_gate/test_rest_gate.py @@ -28,37 +28,29 @@ @allure.link( - "https://github.com/nspcc-dev/neofs-http-gw#neofs-http-gateway", name="neofs-http-gateway" + "https://github.com/nspcc-dev/neofs-rest-gw?tab=readme-ov-file#neofs-rest-gw", + name="neofs-rest-gateway", ) -@allure.link("https://github.com/nspcc-dev/neofs-http-gw#uploading", name="uploading") -@allure.link("https://github.com/nspcc-dev/neofs-http-gw#downloading", name="downloading") @pytest.mark.sanity -@pytest.mark.http_and_rest_gates -class TestHttpRestGate(NeofsEnvTestBase): +@pytest.mark.rest_gate +class TestRestGate(NeofsEnvTestBase): PLACEMENT_RULE_1 = "REP 1 IN X CBF 1 SELECT 1 FROM * AS X" PLACEMENT_RULE_2 = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X" @pytest.fixture(scope="class", autouse=True) @allure.title("[Class/Autouse]: Prepare wallet and deposit") def prepare_wallet(self, default_wallet): - TestHttpRestGate.wallet = default_wallet - - @pytest.fixture(scope="class", params=["HTTP", "REST"]) - def gw_params(self, request): - gw_type = request.param - if gw_type == "HTTP": - return { - "endpoint": f"http://{self.neofs_env.http_gw.address}", - "wallet_path": self.neofs_env.http_gw.wallet.path, - } - else: # Assuming REST - return { - "endpoint": f"http://{self.neofs_env.rest_gw.address}/v1", - "wallet_path": self.neofs_env.rest_gw.wallet.path, - } + TestRestGate.wallet = default_wallet + + @pytest.fixture(scope="class") + def gw_params(self): + return { + "endpoint": f"http://{self.neofs_env.rest_gw.address}/v1", + "wallet_path": self.neofs_env.rest_gw.wallet.path, + } @allure.title("Test Put over gRPC, Get over HTTP") - def test_put_grpc_get_http(self, complex_object_size, simple_object_size): + def test_put_grpc_get_http(self, complex_object_size, simple_object_size, gw_endpoint): """ Test that object can be put using gRPC interface and get using HTTP. @@ -108,7 +100,7 @@ def test_put_grpc_get_http(self, complex_object_size, simple_object_size): cid=cid, shell=self.shell, nodes=self.neofs_env.storage_nodes, - endpoint=f"http://{self.neofs_env.http_gw.address}", + endpoint=gw_endpoint, ) @allure.title("Verify Content-Disposition header") @@ -439,44 +431,6 @@ def test_expiration_epoch_in_http(self, simple_object_size, gw_params): for oid in not_expired_objects: get_via_http_gate(cid=cid, oid=oid, endpoint=gw_params["endpoint"]) - @allure.title("Test Zip in HTTP header") - def test_zip_in_http(self, complex_object_size, simple_object_size): - cid = create_container( - self.wallet.path, - shell=self.shell, - endpoint=self.neofs_env.sn_rpc, - rule=self.PLACEMENT_RULE_2, - basic_acl=PUBLIC_ACL, - ) - file_path_simple, file_path_large = generate_file(simple_object_size), generate_file( - complex_object_size - ) - common_prefix = "my_files" - - headers1 = {"X-Attribute-FilePath": f"{common_prefix}/file1"} - headers2 = {"X-Attribute-FilePath": f"{common_prefix}/file2"} - - upload_via_http_gate( - cid=cid, - path=file_path_simple, - headers=headers1, - endpoint=f"http://{self.neofs_env.http_gw.address}", - ) - upload_via_http_gate( - cid=cid, - path=file_path_large, - headers=headers2, - endpoint=f"http://{self.neofs_env.http_gw.address}", - ) - - dir_path = get_via_zip_http_gate( - cid=cid, prefix=common_prefix, endpoint=f"http://{self.neofs_env.http_gw.address}" - ) - - with allure.step("Verify hashes"): - assert get_file_hash(f"{dir_path}/file1") == get_file_hash(file_path_simple) - assert get_file_hash(f"{dir_path}/file2") == get_file_hash(file_path_large) - @pytest.mark.long @allure.title("Test Put over HTTP/Curl, Get over HTTP/Curl for large object") def test_put_http_get_http_large_file(self, complex_object_size, gw_params): diff --git a/pytest_tests/tests/services/http_rest_gates/test_http_rest_headers.py b/pytest_tests/tests/services/rest_gate/test_rest_headers.py similarity index 98% rename from pytest_tests/tests/services/http_rest_gates/test_http_rest_headers.py rename to pytest_tests/tests/services/rest_gate/test_rest_headers.py index bb99008d0..608af6708 100644 --- a/pytest_tests/tests/services/http_rest_gates/test_http_rest_headers.py +++ b/pytest_tests/tests/services/rest_gate/test_rest_headers.py @@ -27,8 +27,8 @@ @pytest.mark.sanity -@pytest.mark.http_and_rest_gates -class Test_http_rest_headers(NeofsEnvTestBase): +@pytest.mark.rest_gate +class Test_rest_headers(NeofsEnvTestBase): PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 4 FROM * AS X" obj1_keys = ["Writer", "Chapter1", "Chapter2"] obj2_keys = ["Writer", "Ch$pter1", "chapter2"] @@ -41,7 +41,7 @@ class Test_http_rest_headers(NeofsEnvTestBase): @pytest.fixture(scope="class", autouse=True) @allure.title("[Class/Autouse]: Prepare wallet and deposit") def prepare_wallet(self, default_wallet): - Test_http_rest_headers.wallet = default_wallet + Test_rest_headers.wallet = default_wallet @pytest.fixture( params=[ diff --git a/pytest_tests/tests/services/http_rest_gates/test_http_rest_object.py b/pytest_tests/tests/services/rest_gate/test_rest_object.py similarity index 83% rename from pytest_tests/tests/services/http_rest_gates/test_http_rest_object.py rename to pytest_tests/tests/services/rest_gate/test_rest_object.py index c2fe8f164..af0444a5b 100644 --- a/pytest_tests/tests/services/http_rest_gates/test_http_rest_object.py +++ b/pytest_tests/tests/services/rest_gate/test_rest_object.py @@ -18,37 +18,26 @@ @pytest.mark.sanity -@pytest.mark.http_and_rest_gates -class Test_http_rest_object(NeofsEnvTestBase): +@pytest.mark.rest_gate +class Test_rest_object(NeofsEnvTestBase): PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 4 FROM * AS X" @pytest.fixture(scope="class", autouse=True) @allure.title("[Class/Autouse]: Prepare wallet and deposit") def prepare_wallet(self, default_wallet): - Test_http_rest_object.wallet = default_wallet - - @pytest.fixture(scope="class", params=["HTTP", "REST"]) - def gw_attributes(self, request): - gw_type = request.param - if gw_type == "HTTP": - return { - "endpoint": f"http://{self.neofs_env.http_gw.address}", - # List of Key=Value attributes - "obj_key1": "chapter1", - "obj_value1": "peace", - "obj_key2": "chapter2", - "obj_value2": "war", - } - else: # Assuming REST - return { - "endpoint": f"http://{self.neofs_env.rest_gw.address}/v1", - # List of Key=Value attributes - # REST gateway accepts attributes in the Canonical MIME Header Key. - "obj_key1": "Chapter1", - "obj_value1": "peace", - "obj_key2": "Chapter2", - "obj_value2": "war", - } + Test_rest_object.wallet = default_wallet + + @pytest.fixture(scope="class") + def gw_attributes(self): + return { + "endpoint": f"http://{self.neofs_env.rest_gw.address}/v1", + # List of Key=Value attributes + # REST gateway accepts attributes in the Canonical MIME Header Key. + "obj_key1": "Chapter1", + "obj_value1": "peace", + "obj_key2": "Chapter2", + "obj_value2": "war", + } @allure.title("Test Put over gRPC, Get over HTTP") @pytest.mark.parametrize( diff --git a/pytest_tests/tests/services/http_rest_gates/test_http_rest_streaming.py b/pytest_tests/tests/services/rest_gate/test_rest_streaming.py similarity index 94% rename from pytest_tests/tests/services/http_rest_gates/test_http_rest_streaming.py rename to pytest_tests/tests/services/rest_gate/test_rest_streaming.py index c9f259bb9..ff90b157d 100644 --- a/pytest_tests/tests/services/http_rest_gates/test_http_rest_streaming.py +++ b/pytest_tests/tests/services/rest_gate/test_rest_streaming.py @@ -13,14 +13,14 @@ @pytest.mark.sanity -@pytest.mark.http_and_rest_gates -class Test_http_rest_streaming(NeofsEnvTestBase): +@pytest.mark.rest_gate +class Test_rest_streaming(NeofsEnvTestBase): PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 4 FROM * AS X" @pytest.fixture(scope="class", autouse=True) @allure.title("[Class/Autouse]: Prepare wallet and deposit") def prepare_wallet(self, default_wallet): - Test_http_rest_streaming.wallet = default_wallet + Test_rest_streaming.wallet = default_wallet @allure.title("Test Put via pipe (steaming), Get over HTTP and verify hashes") @pytest.mark.parametrize( diff --git a/pytest_tests/tests/services/http_rest_gates/test_http_rest_system_header.py b/pytest_tests/tests/services/rest_gate/test_rest_system_header.py similarity index 99% rename from pytest_tests/tests/services/http_rest_gates/test_http_rest_system_header.py rename to pytest_tests/tests/services/rest_gate/test_rest_system_header.py index 42d21cd1d..2c3ad4844 100644 --- a/pytest_tests/tests/services/http_rest_gates/test_http_rest_system_header.py +++ b/pytest_tests/tests/services/rest_gate/test_rest_system_header.py @@ -30,14 +30,14 @@ NEOFS_EXIPRATION_RFC3339 = "Neofs-Expiration-RFC3339" -@pytest.mark.http_and_rest_gates -class Test_http_rest_system_header(NeofsEnvTestBase): +@pytest.mark.rest_gate +class Test_rest_system_header(NeofsEnvTestBase): PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 2 FROM * AS X" @pytest.fixture(scope="class", autouse=True) @allure.title("[Class/Autouse]: Prepare wallet and deposit") def prepare_wallet(self, default_wallet): - Test_http_rest_system_header.wallet = default_wallet + Test_rest_system_header.wallet = default_wallet @pytest.fixture(scope="class") @allure.title("Create container")