From c433fe22649827074abd76066cd251836d0d98c6 Mon Sep 17 00:00:00 2001 From: Andrey Berezin Date: Wed, 14 Feb 2024 16:20:06 +0300 Subject: [PATCH] [#196] Update curl related function usages Signed-off-by: Andrey Berezin --- .../services/http_gate/test_http_bearer.py | 2 +- .../services/http_gate/test_http_gate.py | 42 +++++-------------- .../services/http_gate/test_http_headers.py | 15 +++---- .../services/http_gate/test_http_object.py | 15 +++---- .../services/http_gate/test_http_streaming.py | 3 +- .../http_gate/test_http_system_header.py | 15 +++---- 6 files changed, 27 insertions(+), 65 deletions(-) diff --git a/pytest_tests/testsuites/services/http_gate/test_http_bearer.py b/pytest_tests/testsuites/services/http_gate/test_http_bearer.py index d5f6682d..1479a564 100644 --- a/pytest_tests/testsuites/services/http_gate/test_http_bearer.py +++ b/pytest_tests/testsuites/services/http_gate/test_http_bearer.py @@ -114,5 +114,5 @@ class Test_http_bearer(ClusterTestBase): cid=user_container, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, + request_node=self.cluster.cluster_nodes[0], ) diff --git a/pytest_tests/testsuites/services/http_gate/test_http_gate.py b/pytest_tests/testsuites/services/http_gate/test_http_gate.py index 1641e48c..d435315b 100644 --- a/pytest_tests/testsuites/services/http_gate/test_http_gate.py +++ b/pytest_tests/testsuites/services/http_gate/test_http_gate.py @@ -92,8 +92,7 @@ class TestHttpGate(ClusterTestBase): cid=cid, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], ) @@ -150,8 +149,7 @@ class TestHttpPut(ClusterTestBase): cid=cid, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], ) @allure.link( @@ -204,8 +202,7 @@ class TestHttpPut(ClusterTestBase): file_name=file_path, cid=cid, attrs=attributes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + node=self.cluster.cluster_nodes[0], ) @allure.title("Expiration-Epoch in HTTP header (epoch_gap={epoch_gap})") @@ -243,12 +240,7 @@ class TestHttpPut(ClusterTestBase): else: oids_to_be_expired.append(oid) with reporter.step("This object can be got"): - get_via_http_gate( - cid=cid, - oid=oid, - endpoint=http_endpoint, - http_hostname=self.cluster.default_http_hostname[0], - ) + get_via_http_gate(cid=cid, oid=oid, node=self.cluster.cluster_nodes[0]) self.tick_epoch() @@ -260,18 +252,12 @@ class TestHttpPut(ClusterTestBase): try_to_get_object_and_expect_error( cid=cid, oid=oid, + node=self.cluster.cluster_nodes[0], error_pattern=OBJECT_NOT_FOUND_ERROR, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) for oid in oids_to_be_valid: with reporter.step(f"{oid} shall be valid and can be got"): - get_via_http_gate( - cid=cid, - oid=oid, - endpoint=http_endpoint, - http_hostname=self.cluster.default_http_hostname[0], - ) + get_via_http_gate(cid=cid, oid=oid, node=self.cluster.cluster_nodes[0]) @allure.title("Zip in HTTP header") def test_zip_in_http(self, complex_object_size: ObjectSize, simple_object_size: ObjectSize): @@ -302,12 +288,7 @@ class TestHttpPut(ClusterTestBase): endpoint=self.cluster.default_http_gate_endpoint, ) - dir_path = get_via_zip_http_gate( - cid=cid, - prefix=common_prefix, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], - ) + dir_path = get_via_zip_http_gate(cid=cid, prefix=common_prefix, node=self.cluster.cluster_nodes[0]) with reporter.step("Verify hashes"): assert get_file_hash(f"{dir_path}/file1") == get_file_hash(file_path_simple) @@ -345,8 +326,7 @@ class TestHttpPut(ClusterTestBase): cid=cid, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], ) verify_object_hash( oid=oid_curl, @@ -355,8 +335,7 @@ class TestHttpPut(ClusterTestBase): cid=cid, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], object_getter=get_via_http_curl, ) @@ -393,7 +372,6 @@ class TestHttpPut(ClusterTestBase): cid=cid, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], object_getter=get_via_http_curl, ) diff --git a/pytest_tests/testsuites/services/http_gate/test_http_headers.py b/pytest_tests/testsuites/services/http_gate/test_http_headers.py index 3d320cdf..77fed399 100644 --- a/pytest_tests/testsuites/services/http_gate/test_http_headers.py +++ b/pytest_tests/testsuites/services/http_gate/test_http_headers.py @@ -97,8 +97,7 @@ class Test_http_headers(ClusterTestBase): file_name=storage_object_1.file_path, cid=storage_object_1.cid, attrs={"Chapter2": storage_object_1.attributes["Chapter2"]}, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + node=self.cluster.cluster_nodes[0], ) @allure.title("Get object2 with different attributes, then delete object2 and get object1") @@ -129,8 +128,7 @@ class Test_http_headers(ClusterTestBase): file_name=storage_object_2.file_path, cid=storage_object_2.cid, attrs=attributes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + node=self.cluster.cluster_nodes[0], ) with reporter.step("Delete object#2 and verify is the container deleted"): delete_object( @@ -143,9 +141,8 @@ class Test_http_headers(ClusterTestBase): try_to_get_object_and_expect_error( cid=storage_object_2.cid, oid=storage_object_2.oid, + node=self.cluster.cluster_nodes[0], error_pattern=OBJECT_ALREADY_REMOVED_ERROR, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) storage_objects_with_attributes.remove(storage_object_2) @@ -158,8 +155,7 @@ class Test_http_headers(ClusterTestBase): file_name=storage_object_1.file_path, cid=storage_object_1.cid, attrs=key_value_pair, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + node=self.cluster.cluster_nodes[0], ) @allure.title("[NEGATIVE] Put object and get right after container is deleted") @@ -215,9 +211,8 @@ class Test_http_headers(ClusterTestBase): try_to_get_object_via_passed_request_and_expect_error( cid=storage_object_1.cid, oid="", + node=self.cluster.cluster_nodes[0], error_pattern=error_pattern, attrs=attrs_obj3, http_request_path=request, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) diff --git a/pytest_tests/testsuites/services/http_gate/test_http_object.py b/pytest_tests/testsuites/services/http_gate/test_http_object.py index 2bd8924c..64d7d0a0 100644 --- a/pytest_tests/testsuites/services/http_gate/test_http_object.py +++ b/pytest_tests/testsuites/services/http_gate/test_http_object.py @@ -91,8 +91,7 @@ class Test_http_object(ClusterTestBase): cid=cid, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], ) with reporter.step("[Negative] try to get object: [get/$CID/chapter1/peace]"): @@ -102,11 +101,10 @@ class Test_http_object(ClusterTestBase): try_to_get_object_via_passed_request_and_expect_error( cid=cid, oid=oid, + node=self.cluster.cluster_nodes[0], error_pattern=expected_err_msg, http_request_path=request, attrs=attrs, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) with reporter.step("Download the object with attribute [get_by_attribute/$CID/chapter1/peace]"): @@ -115,18 +113,16 @@ class Test_http_object(ClusterTestBase): file_name=file_path, cid=cid, attrs=attrs, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + node=self.cluster.cluster_nodes[0], ) with reporter.step("[Negative] try to get object: get_by_attribute/$CID/$OID"): request = f"/get_by_attribute/{cid}/{oid}" try_to_get_object_via_passed_request_and_expect_error( cid=cid, oid=oid, + node=self.cluster.cluster_nodes[0], error_pattern=expected_err_msg, http_request_path=request, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) @allure.title("Put over s3, Get over HTTP with bucket name and key") @@ -156,8 +152,7 @@ class Test_http_object(ClusterTestBase): obj_http = get_via_http_gate( cid=None, oid=None, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + node=self.cluster.cluster_nodes[0], request_path=request, ) with reporter.step("Verify hashes"): diff --git a/pytest_tests/testsuites/services/http_gate/test_http_streaming.py b/pytest_tests/testsuites/services/http_gate/test_http_streaming.py index c36e4cd5..c8df2ccf 100644 --- a/pytest_tests/testsuites/services/http_gate/test_http_streaming.py +++ b/pytest_tests/testsuites/services/http_gate/test_http_streaming.py @@ -61,6 +61,5 @@ class Test_http_streaming(ClusterTestBase): cid=cid, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], ) diff --git a/pytest_tests/testsuites/services/http_gate/test_http_system_header.py b/pytest_tests/testsuites/services/http_gate/test_http_system_header.py index 82f469ee..287859f7 100644 --- a/pytest_tests/testsuites/services/http_gate/test_http_system_header.py +++ b/pytest_tests/testsuites/services/http_gate/test_http_system_header.py @@ -124,8 +124,7 @@ class Test_http_system_header(ClusterTestBase): cid=user_container, shell=self.shell, nodes=self.cluster.storage_nodes, - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], + request_node=self.cluster.cluster_nodes[0], ) head = head_object( wallet=self.wallet, @@ -222,9 +221,8 @@ class Test_http_system_header(ClusterTestBase): try_to_get_object_and_expect_error( cid=user_container, oid=oid, + node=self.cluster.cluster_nodes[0], error_pattern="404 Not Found", - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) # check that object is not available via grpc with pytest.raises(Exception, match=OBJECT_NOT_FOUND): @@ -262,9 +260,8 @@ class Test_http_system_header(ClusterTestBase): try_to_get_object_and_expect_error( cid=user_container, oid=oid, + node=self.cluster.cluster_nodes[0], error_pattern="404 Not Found", - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) # check that object is not available via grpc with pytest.raises(Exception, match=OBJECT_NOT_FOUND): @@ -304,9 +301,8 @@ class Test_http_system_header(ClusterTestBase): try_to_get_object_and_expect_error( cid=user_container, oid=oid, + node=self.cluster.cluster_nodes[0], error_pattern="404 Not Found", - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) # check that object is not available via grpc with pytest.raises(Exception, match=OBJECT_NOT_FOUND): @@ -356,9 +352,8 @@ class Test_http_system_header(ClusterTestBase): try_to_get_object_and_expect_error( cid=user_container, oid=oid, + node=self.cluster.cluster_nodes[0], error_pattern="404 Not Found", - endpoint=self.cluster.default_http_gate_endpoint, - http_hostname=self.cluster.default_http_hostname[0], ) # check that object is not available via grpc with pytest.raises(Exception, match=OBJECT_NOT_FOUND):