Added http hostname as a header to all http calls

This commit is contained in:
Yaroslava Lukoyanova 2023-07-24 09:55:14 +03:00
parent 89a31a695b
commit 0e1d34b2f7
6 changed files with 53 additions and 4 deletions

View file

@ -14,6 +14,8 @@ hosts:
endpoint_data0: s01.frostfs.devenv:8080 endpoint_data0: s01.frostfs.devenv:8080
control_endpoint: s01.frostfs.devenv:8081 control_endpoint: s01.frostfs.devenv:8081
un_locode: "RU MOW" un_locode: "RU MOW"
http_hostname: "no_hostname"
s3_hostname: "no_hostname"
- name: s02 - name: s02
attributes: attributes:
container_name: s02 container_name: s02
@ -26,6 +28,8 @@ hosts:
endpoint_data0: s02.frostfs.devenv:8080 endpoint_data0: s02.frostfs.devenv:8080
control_endpoint: s02.frostfs.devenv:8081 control_endpoint: s02.frostfs.devenv:8081
un_locode: "RU LED" un_locode: "RU LED"
http_hostname: "no_hostname"
s3_hostname: "no_hostname"
- name: s03 - name: s03
attributes: attributes:
container_name: s03 container_name: s03
@ -38,6 +42,8 @@ hosts:
endpoint_data0: s03.frostfs.devenv:8080 endpoint_data0: s03.frostfs.devenv:8080
control_endpoint: s03.frostfs.devenv:8081 control_endpoint: s03.frostfs.devenv:8081
un_locode: "SE STO" un_locode: "SE STO"
http_hostname: "no_hostname"
s3_hostname: "no_hostname"
- name: s04 - name: s04
attributes: attributes:
container_name: s04 container_name: s04
@ -50,6 +56,8 @@ hosts:
endpoint_data0: s04.frostfs.devenv:8080 endpoint_data0: s04.frostfs.devenv:8080
control_endpoint: s04.frostfs.devenv:8081 control_endpoint: s04.frostfs.devenv:8081
un_locode: "FI HEL" un_locode: "FI HEL"
http_hostname: "no_hostname"
s3_hostname: "no_hostname"
- name: s3-gate01 - name: s3-gate01
attributes: attributes:
container_name: s3_gate container_name: s3_gate

View file

@ -94,6 +94,7 @@ class TestHttpGate(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
@allure.link("https://github.com/TrueCloudLab/frostfs-http-gw#uploading", name="uploading") @allure.link("https://github.com/TrueCloudLab/frostfs-http-gw#uploading", name="uploading")
@ -142,6 +143,7 @@ class TestHttpGate(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
hostname=self.cluster.default_http_hostname,
) )
@allure.link( @allure.link(
@ -196,8 +198,10 @@ class TestHttpGate(ClusterTestBase):
cid=cid, cid=cid,
attrs=attributes, attrs=attributes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
@pytest.mark.skip("Skipped due to deprecated PUT via http")
@allure.title("Test Expiration-Epoch in HTTP header") @allure.title("Test Expiration-Epoch in HTTP header")
@pytest.mark.parametrize("epoch_gap", [0, 1]) @pytest.mark.parametrize("epoch_gap", [0, 1])
def test_expiration_epoch_in_http(self, simple_object_size: int, epoch_gap): def test_expiration_epoch_in_http(self, simple_object_size: int, epoch_gap):
@ -222,14 +226,23 @@ class TestHttpGate(ClusterTestBase):
with allure.step("Put objects using HTTP with attribute Expiration-Epoch"): with allure.step("Put objects using HTTP with attribute Expiration-Epoch"):
oid = upload_via_http_gate( oid = upload_via_http_gate(
cid=cid, path=file_path, headers=headers, endpoint=http_endpoint cid=cid,
path=file_path,
headers=headers,
endpoint=http_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
if get_epoch(self.shell, self.cluster) + 1 <= valid_until: if get_epoch(self.shell, self.cluster) + 1 <= valid_until:
oids_to_be_valid.append(oid) oids_to_be_valid.append(oid)
else: else:
oids_to_be_expired.append(oid) oids_to_be_expired.append(oid)
with allure.step("This object can be got"): with allure.step("This object can be got"):
get_via_http_gate(cid=cid, oid=oid, endpoint=http_endpoint) get_via_http_gate(
cid=cid,
oid=oid,
endpoint=http_endpoint,
http_hostname=self.cluster.default_http_hostname,
)
self.tick_epoch() self.tick_epoch()
@ -243,11 +256,18 @@ class TestHttpGate(ClusterTestBase):
oid=oid, oid=oid,
error_pattern=OBJECT_NOT_FOUND_ERROR, error_pattern=OBJECT_NOT_FOUND_ERROR,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
for oid in oids_to_be_valid: for oid in oids_to_be_valid:
with allure.step(f"{oid} shall be valid and can be got"): with allure.step(f"{oid} shall be valid and can be got"):
get_via_http_gate(cid=cid, oid=oid, endpoint=http_endpoint) get_via_http_gate(
cid=cid,
oid=oid,
endpoint=http_endpoint,
http_hostname=self.cluster.default_http_hostname,
)
@pytest.mark.skip("Skipped due to deprecated PUT via http")
@allure.title("Test Zip in HTTP header") @allure.title("Test Zip in HTTP header")
def test_zip_in_http(self, complex_object_size: int, simple_object_size: int): def test_zip_in_http(self, complex_object_size: int, simple_object_size: int):
cid = create_container( cid = create_container(
@ -279,7 +299,10 @@ class TestHttpGate(ClusterTestBase):
) )
dir_path = get_via_zip_http_gate( dir_path = get_via_zip_http_gate(
cid=cid, prefix=common_prefix, endpoint=self.cluster.default_http_gate_endpoint cid=cid,
prefix=common_prefix,
endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
with allure.step("Verify hashes"): with allure.step("Verify hashes"):
@ -323,6 +346,7 @@ class TestHttpGate(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
hostname=self.cluster.default_http_hostname,
) )
verify_object_hash( verify_object_hash(
oid=oid_curl, oid=oid_curl,
@ -332,6 +356,7 @@ class TestHttpGate(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
object_getter=get_via_http_curl, object_getter=get_via_http_curl,
) )
@ -371,5 +396,6 @@ class TestHttpGate(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
object_getter=get_via_http_curl, object_getter=get_via_http_curl,
) )

View file

@ -105,6 +105,7 @@ class Test_http_headers(ClusterTestBase):
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, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
@allure.title("Test get object2 with different attributes, then delete object2 and get object1") @allure.title("Test get object2 with different attributes, then delete object2 and get object1")
@ -138,6 +139,7 @@ class Test_http_headers(ClusterTestBase):
cid=storage_object_2.cid, cid=storage_object_2.cid,
attrs=attributes, attrs=attributes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
with allure.step("Delete object#2 and verify is the container deleted"): with allure.step("Delete object#2 and verify is the container deleted"):
delete_object( delete_object(
@ -152,6 +154,7 @@ class Test_http_headers(ClusterTestBase):
oid=storage_object_2.oid, oid=storage_object_2.oid,
error_pattern=OBJECT_ALREADY_REMOVED_ERROR, error_pattern=OBJECT_ALREADY_REMOVED_ERROR,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
storage_objects_with_attributes.remove(storage_object_2) storage_objects_with_attributes.remove(storage_object_2)
@ -165,6 +168,7 @@ class Test_http_headers(ClusterTestBase):
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, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
@allure.title("[Negative] Try to put object and get right after container is deleted") @allure.title("[Negative] Try to put object and get right after container is deleted")
@ -228,4 +232,5 @@ class Test_http_headers(ClusterTestBase):
attrs=attrs_obj3, attrs=attrs_obj3,
http_request_path=request, http_request_path=request,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )

View file

@ -91,6 +91,7 @@ class Test_http_object(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
with allure.step("[Negative] try to get object: [get/$CID/chapter1/peace]"): with allure.step("[Negative] try to get object: [get/$CID/chapter1/peace]"):
attrs = {obj_key1: obj_value1, obj_key2: obj_value2} attrs = {obj_key1: obj_value1, obj_key2: obj_value2}
@ -103,6 +104,7 @@ class Test_http_object(ClusterTestBase):
http_request_path=request, http_request_path=request,
attrs=attrs, attrs=attrs,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
with allure.step( with allure.step(
@ -114,6 +116,7 @@ class Test_http_object(ClusterTestBase):
cid=cid, cid=cid,
attrs=attrs, attrs=attrs,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
hostname=self.cluster.default_http_hostname,
) )
with allure.step("[Negative] try to get object: get_by_attribute/$CID/$OID"): with allure.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}"
@ -123,4 +126,5 @@ class Test_http_object(ClusterTestBase):
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, endpoint=self.cluster.default_http_gate_endpoint,
hostname=self.cluster.default_http_hostname,
) )

View file

@ -67,4 +67,5 @@ class Test_http_streaming(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
hostname=self.cluster.default_http_hostname,
) )

View file

@ -130,6 +130,7 @@ class Test_http_system_header(ClusterTestBase):
shell=self.shell, shell=self.shell,
nodes=self.cluster.storage_nodes, nodes=self.cluster.storage_nodes,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
hostname=self.cluster.default_http_hostname,
) )
head = head_object( head = head_object(
wallet=self.wallet, wallet=self.wallet,
@ -242,6 +243,7 @@ class Test_http_system_header(ClusterTestBase):
oid=oid, oid=oid,
error_pattern="404 Not Found", error_pattern="404 Not Found",
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
# 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):
@ -297,6 +299,7 @@ class Test_http_system_header(ClusterTestBase):
oid=oid, oid=oid,
error_pattern="404 Not Found", error_pattern="404 Not Found",
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
# 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):
@ -352,6 +355,7 @@ class Test_http_system_header(ClusterTestBase):
oid=oid, oid=oid,
error_pattern="404 Not Found", error_pattern="404 Not Found",
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
# 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):
@ -407,6 +411,7 @@ class Test_http_system_header(ClusterTestBase):
oid=oid, oid=oid,
error_pattern="404 Not Found", error_pattern="404 Not Found",
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
http_hostname=self.cluster.default_http_hostname,
) )
# 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):