[#196] Update curl related function usages

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2024-02-14 16:20:06 +03:00
parent 251a7881c9
commit c433fe2264
6 changed files with 27 additions and 65 deletions

View file

@ -114,5 +114,5 @@ class Test_http_bearer(ClusterTestBase):
cid=user_container, cid=user_container,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
) )

View file

@ -92,8 +92,7 @@ class TestHttpGate(ClusterTestBase):
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
@ -150,8 +149,7 @@ class TestHttpPut(ClusterTestBase):
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
@allure.link( @allure.link(
@ -204,8 +202,7 @@ class TestHttpPut(ClusterTestBase):
file_name=file_path, file_name=file_path,
cid=cid, cid=cid,
attrs=attributes, attrs=attributes,
endpoint=self.cluster.default_http_gate_endpoint, node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
@allure.title("Expiration-Epoch in HTTP header (epoch_gap={epoch_gap})") @allure.title("Expiration-Epoch in HTTP header (epoch_gap={epoch_gap})")
@ -243,12 +240,7 @@ class TestHttpPut(ClusterTestBase):
else: else:
oids_to_be_expired.append(oid) oids_to_be_expired.append(oid)
with reporter.step("This object can be got"): with reporter.step("This object can be got"):
get_via_http_gate( get_via_http_gate(cid=cid, oid=oid, node=self.cluster.cluster_nodes[0])
cid=cid,
oid=oid,
endpoint=http_endpoint,
http_hostname=self.cluster.default_http_hostname[0],
)
self.tick_epoch() self.tick_epoch()
@ -260,18 +252,12 @@ class TestHttpPut(ClusterTestBase):
try_to_get_object_and_expect_error( try_to_get_object_and_expect_error(
cid=cid, cid=cid,
oid=oid, oid=oid,
node=self.cluster.cluster_nodes[0],
error_pattern=OBJECT_NOT_FOUND_ERROR, 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: for oid in oids_to_be_valid:
with reporter.step(f"{oid} shall be valid and can be got"): with reporter.step(f"{oid} shall be valid and can be got"):
get_via_http_gate( get_via_http_gate(cid=cid, oid=oid, node=self.cluster.cluster_nodes[0])
cid=cid,
oid=oid,
endpoint=http_endpoint,
http_hostname=self.cluster.default_http_hostname[0],
)
@allure.title("Zip in HTTP header") @allure.title("Zip in HTTP header")
def test_zip_in_http(self, complex_object_size: ObjectSize, simple_object_size: ObjectSize): 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, endpoint=self.cluster.default_http_gate_endpoint,
) )
dir_path = get_via_zip_http_gate( dir_path = get_via_zip_http_gate(cid=cid, prefix=common_prefix, node=self.cluster.cluster_nodes[0])
cid=cid,
prefix=common_prefix,
endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname[0],
)
with reporter.step("Verify hashes"): with reporter.step("Verify hashes"):
assert get_file_hash(f"{dir_path}/file1") == get_file_hash(file_path_simple) assert get_file_hash(f"{dir_path}/file1") == get_file_hash(file_path_simple)
@ -345,8 +326,7 @@ class TestHttpPut(ClusterTestBase):
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
verify_object_hash( verify_object_hash(
oid=oid_curl, oid=oid_curl,
@ -355,8 +335,7 @@ class TestHttpPut(ClusterTestBase):
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
object_getter=get_via_http_curl, object_getter=get_via_http_curl,
) )
@ -393,7 +372,6 @@ class TestHttpPut(ClusterTestBase):
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
object_getter=get_via_http_curl, object_getter=get_via_http_curl,
) )

View file

@ -97,8 +97,7 @@ class Test_http_headers(ClusterTestBase):
file_name=storage_object_1.file_path, file_name=storage_object_1.file_path,
cid=storage_object_1.cid, cid=storage_object_1.cid,
attrs={"Chapter2": storage_object_1.attributes["Chapter2"]}, attrs={"Chapter2": storage_object_1.attributes["Chapter2"]},
endpoint=self.cluster.default_http_gate_endpoint, node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
@allure.title("Get object2 with different attributes, then delete object2 and get object1") @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, file_name=storage_object_2.file_path,
cid=storage_object_2.cid, cid=storage_object_2.cid,
attrs=attributes, attrs=attributes,
endpoint=self.cluster.default_http_gate_endpoint, node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
with reporter.step("Delete object#2 and verify is the container deleted"): with reporter.step("Delete object#2 and verify is the container deleted"):
delete_object( delete_object(
@ -143,9 +141,8 @@ class Test_http_headers(ClusterTestBase):
try_to_get_object_and_expect_error( try_to_get_object_and_expect_error(
cid=storage_object_2.cid, cid=storage_object_2.cid,
oid=storage_object_2.oid, oid=storage_object_2.oid,
node=self.cluster.cluster_nodes[0],
error_pattern=OBJECT_ALREADY_REMOVED_ERROR, 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) storage_objects_with_attributes.remove(storage_object_2)
@ -158,8 +155,7 @@ class Test_http_headers(ClusterTestBase):
file_name=storage_object_1.file_path, file_name=storage_object_1.file_path,
cid=storage_object_1.cid, cid=storage_object_1.cid,
attrs=key_value_pair, attrs=key_value_pair,
endpoint=self.cluster.default_http_gate_endpoint, node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
@allure.title("[NEGATIVE] Put object and get right after container is deleted") @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( try_to_get_object_via_passed_request_and_expect_error(
cid=storage_object_1.cid, cid=storage_object_1.cid,
oid="", oid="",
node=self.cluster.cluster_nodes[0],
error_pattern=error_pattern, error_pattern=error_pattern,
attrs=attrs_obj3, attrs=attrs_obj3,
http_request_path=request, http_request_path=request,
endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname[0],
) )

View file

@ -91,8 +91,7 @@ class Test_http_object(ClusterTestBase):
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
with reporter.step("[Negative] try to get object: [get/$CID/chapter1/peace]"): 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( try_to_get_object_via_passed_request_and_expect_error(
cid=cid, cid=cid,
oid=oid, oid=oid,
node=self.cluster.cluster_nodes[0],
error_pattern=expected_err_msg, error_pattern=expected_err_msg,
http_request_path=request, http_request_path=request,
attrs=attrs, 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]"): 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, file_name=file_path,
cid=cid, cid=cid,
attrs=attrs, attrs=attrs,
endpoint=self.cluster.default_http_gate_endpoint, node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
with reporter.step("[Negative] try to get object: get_by_attribute/$CID/$OID"): with reporter.step("[Negative] try to get object: get_by_attribute/$CID/$OID"):
request = f"/get_by_attribute/{cid}/{oid}" request = f"/get_by_attribute/{cid}/{oid}"
try_to_get_object_via_passed_request_and_expect_error( try_to_get_object_via_passed_request_and_expect_error(
cid=cid, cid=cid,
oid=oid, oid=oid,
node=self.cluster.cluster_nodes[0],
error_pattern=expected_err_msg, error_pattern=expected_err_msg,
http_request_path=request, 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") @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( obj_http = get_via_http_gate(
cid=None, cid=None,
oid=None, oid=None,
endpoint=self.cluster.default_http_gate_endpoint, node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
request_path=request, request_path=request,
) )
with reporter.step("Verify hashes"): with reporter.step("Verify hashes"):

View file

@ -61,6 +61,5 @@ class Test_http_streaming(ClusterTestBase):
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )

View file

@ -124,8 +124,7 @@ class Test_http_system_header(ClusterTestBase):
cid=user_container, cid=user_container,
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, request_node=self.cluster.cluster_nodes[0],
http_hostname=self.cluster.default_http_hostname[0],
) )
head = head_object( head = head_object(
wallet=self.wallet, wallet=self.wallet,
@ -222,9 +221,8 @@ class Test_http_system_header(ClusterTestBase):
try_to_get_object_and_expect_error( try_to_get_object_and_expect_error(
cid=user_container, cid=user_container,
oid=oid, oid=oid,
node=self.cluster.cluster_nodes[0],
error_pattern="404 Not Found", 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 # check that object is not available via grpc
with pytest.raises(Exception, match=OBJECT_NOT_FOUND): 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( try_to_get_object_and_expect_error(
cid=user_container, cid=user_container,
oid=oid, oid=oid,
node=self.cluster.cluster_nodes[0],
error_pattern="404 Not Found", 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 # check that object is not available via grpc
with pytest.raises(Exception, match=OBJECT_NOT_FOUND): 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( try_to_get_object_and_expect_error(
cid=user_container, cid=user_container,
oid=oid, oid=oid,
node=self.cluster.cluster_nodes[0],
error_pattern="404 Not Found", 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 # check that object is not available via grpc
with pytest.raises(Exception, match=OBJECT_NOT_FOUND): 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( try_to_get_object_and_expect_error(
cid=user_container, cid=user_container,
oid=oid, oid=oid,
node=self.cluster.cluster_nodes[0],
error_pattern="404 Not Found", 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 # check that object is not available via grpc
with pytest.raises(Exception, match=OBJECT_NOT_FOUND): with pytest.raises(Exception, match=OBJECT_NOT_FOUND):