update headers names

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2023-03-27 19:49:41 +03:00
parent 5684d11408
commit 4779d2be88
2 changed files with 26 additions and 26 deletions

View file

@ -217,7 +217,7 @@ class TestHttpGate(ClusterTestBase):
epochs = (curr_epoch, curr_epoch + 1, curr_epoch + 2, curr_epoch + 100) epochs = (curr_epoch, curr_epoch + 1, curr_epoch + 2, curr_epoch + 100)
for epoch in epochs: for epoch in epochs:
headers = {"X-Attribute-Frostfs-Expiration-Epoch": str(epoch)} headers = {"X-Attribute-System-Expiration-Epoch": str(epoch)}
with allure.step("Put objects using HTTP with attribute Expiration-Epoch"): with allure.step("Put objects using HTTP with attribute Expiration-Epoch"):
oids.append( oids.append(

View file

@ -24,14 +24,14 @@ from pytest_tests.helpers.http_gate import (
from pytest_tests.steps.cluster_test_base import ClusterTestBase from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
EXPIRATION_TIMESTAMP_HEADER = "__FROSTFS__EXPIRATION_TIMESTAMP" EXPIRATION_TIMESTAMP_HEADER = "__SYSTEM__EXPIRATION_TIMESTAMP"
EXPIRATION_EPOCH_HEADER = "__FROSTFS__EXPIRATION_EPOCH" EXPIRATION_EPOCH_HEADER = "__SYSTEM__EXPIRATION_EPOCH"
EXPIRATION_DURATION_HEADER = "__FROSTFS__EXPIRATION_DURATION" EXPIRATION_DURATION_HEADER = "__SYSTEM__EXPIRATION_DURATION"
EXPIRATION_EXPIRATION_RFC = "__FROSTFS__EXPIRATION_RFC3339" EXPIRATION_EXPIRATION_RFC = "__SYSTEM__EXPIRATION_RFC3339"
FROSTFS_EXPIRATION_EPOCH = "Frostfs-Expiration-Epoch" SYSTEM_EXPIRATION_EPOCH = "System-Expiration-Epoch"
FROSTFS_EXPIRATION_DURATION = "Frostfs-Expiration-Duration" SYSTEM_EXPIRATION_DURATION = "System-Expiration-Duration"
FROSTFS_EXPIRATION_TIMESTAMP = "Frostfs-Expiration-Timestamp" SYSTEM_EXPIRATION_TIMESTAMP = "System-Expiration-Timestamp"
FROSTFS_EXPIRATION_RFC3339 = "Frostfs-Expiration-RFC3339" SYSTEM_EXPIRATION_RFC3339 = "System-Expiration-RFC3339"
@pytest.mark.sanity @pytest.mark.sanity
@ -97,7 +97,7 @@ class Test_http_system_header(ClusterTestBase):
f"Validate that only {EXPIRATION_EPOCH_HEADER} exists in header and other headers are abesent" f"Validate that only {EXPIRATION_EPOCH_HEADER} exists in header and other headers are abesent"
) )
def validation_for_http_header_attr(self, head_info: dict, expected_epoch: int) -> None: def validation_for_http_header_attr(self, head_info: dict, expected_epoch: int) -> None:
# check that __FROSTFS__EXPIRATION_EPOCH attribute has corresponding epoch # check that __SYSTEM__EXPIRATION_EPOCH attribute has corresponding epoch
assert self.check_key_value_presented_header( assert self.check_key_value_presented_header(
head_info, {EXPIRATION_EPOCH_HEADER: str(expected_epoch)} head_info, {EXPIRATION_EPOCH_HEADER: str(expected_epoch)}
), f'Expected to find {EXPIRATION_EPOCH_HEADER}: {expected_epoch} in: {head_info["header"]["attributes"]}' ), f'Expected to find {EXPIRATION_EPOCH_HEADER}: {expected_epoch} in: {head_info["header"]["attributes"]}'
@ -143,7 +143,7 @@ class Test_http_system_header(ClusterTestBase):
@allure.title("[negative] attempt to put object with expired epoch") @allure.title("[negative] attempt to put object with expired epoch")
def test_unable_put_expired_epoch(self, user_container: str, simple_object_size: int): def test_unable_put_expired_epoch(self, user_container: str, simple_object_size: int):
headers = attr_into_str_header_curl( headers = attr_into_str_header_curl(
{"Frostfs-Expiration-Epoch": str(get_epoch(self.shell, self.cluster) - 1)} {"System-Expiration-Epoch": str(get_epoch(self.shell, self.cluster) - 1)}
) )
file_path = generate_file(simple_object_size) file_path = generate_file(simple_object_size)
with allure.step( with allure.step(
@ -154,15 +154,15 @@ class Test_http_system_header(ClusterTestBase):
filepath=file_path, filepath=file_path,
endpoint=self.cluster.default_http_gate_endpoint, endpoint=self.cluster.default_http_gate_endpoint,
headers=headers, headers=headers,
error_pattern="object has expired", error_pattern="must be greater than current epoch",
) )
@allure.title("[negative] attempt to put object with negative Frostfs-Expiration-Duration") @allure.title("[negative] attempt to put object with negative System-Expiration-Duration")
def test_unable_put_negative_duration(self, user_container: str, simple_object_size: int): def test_unable_put_negative_duration(self, user_container: str, simple_object_size: int):
headers = attr_into_str_header_curl({"Frostfs-Expiration-Duration": "-1h"}) headers = attr_into_str_header_curl({"System-Expiration-Duration": "-1h"})
file_path = generate_file(simple_object_size) file_path = generate_file(simple_object_size)
with allure.step( with allure.step(
"Put object using HTTP with attribute Frostfs-Expiration-Duration where duration is negative" "Put object using HTTP with attribute System-Expiration-Duration where duration is negative"
): ):
upload_via_http_gate_curl( upload_via_http_gate_curl(
cid=user_container, cid=user_container,
@ -173,13 +173,13 @@ class Test_http_system_header(ClusterTestBase):
) )
@allure.title( @allure.title(
"[negative] attempt to put object with Frostfs-Expiration-Timestamp value in the past" "[negative] attempt to put object with System-Expiration-Timestamp value in the past"
) )
def test_unable_put_expired_timestamp(self, user_container: str, simple_object_size: int): def test_unable_put_expired_timestamp(self, user_container: str, simple_object_size: int):
headers = attr_into_str_header_curl({"Frostfs-Expiration-Timestamp": "1635075727"}) headers = attr_into_str_header_curl({"System-Expiration-Timestamp": "1635075727"})
file_path = generate_file(simple_object_size) file_path = generate_file(simple_object_size)
with allure.step( with allure.step(
"Put object using HTTP with attribute Frostfs-Expiration-Timestamp where duration is in the past" "Put object using HTTP with attribute System-Expiration-Timestamp where duration is in the past"
): ):
upload_via_http_gate_curl( upload_via_http_gate_curl(
cid=user_container, cid=user_container,
@ -190,10 +190,10 @@ class Test_http_system_header(ClusterTestBase):
) )
@allure.title( @allure.title(
"[negative] Put object using HTTP with attribute Frostfs-Expiration-RFC3339 where duration is in the past" "[negative] Put object using HTTP with attribute System-Expiration-RFC3339 where duration is in the past"
) )
def test_unable_put_expired_rfc(self, user_container: str, simple_object_size: int): def test_unable_put_expired_rfc(self, user_container: str, simple_object_size: int):
headers = attr_into_str_header_curl({"Frostfs-Expiration-RFC3339": "2021-11-22T09:55:49Z"}) headers = attr_into_str_header_curl({"System-Expiration-RFC3339": "2021-11-22T09:55:49Z"})
file_path = generate_file(simple_object_size) file_path = generate_file(simple_object_size)
upload_via_http_gate_curl( upload_via_http_gate_curl(
cid=user_container, cid=user_container,
@ -218,7 +218,7 @@ class Test_http_system_header(ClusterTestBase):
logger.info( logger.info(
f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}" f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}"
) )
attributes = {FROSTFS_EXPIRATION_EPOCH: expected_epoch, FROSTFS_EXPIRATION_DURATION: "1m"} attributes = {SYSTEM_EXPIRATION_EPOCH: expected_epoch, SYSTEM_EXPIRATION_DURATION: "1m"}
file_path = generate_file(object_size) file_path = generate_file(object_size)
with allure.step( with allure.step(
f"Put objects using HTTP with attributes and head command should display {EXPIRATION_EPOCH_HEADER}: {expected_epoch} attr" f"Put objects using HTTP with attributes and head command should display {EXPIRATION_EPOCH_HEADER}: {expected_epoch} attr"
@ -266,10 +266,10 @@ class Test_http_system_header(ClusterTestBase):
f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}" f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}"
) )
attributes = { attributes = {
FROSTFS_EXPIRATION_DURATION: self.epoch_count_into_mins( SYSTEM_EXPIRATION_DURATION: self.epoch_count_into_mins(
epoch_duration=epoch_duration, epoch=2 epoch_duration=epoch_duration, epoch=2
), ),
FROSTFS_EXPIRATION_TIMESTAMP: self.epoch_count_into_timestamp( SYSTEM_EXPIRATION_TIMESTAMP: self.epoch_count_into_timestamp(
epoch_duration=epoch_duration, epoch=1 epoch_duration=epoch_duration, epoch=1
), ),
} }
@ -320,10 +320,10 @@ class Test_http_system_header(ClusterTestBase):
f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}" f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}"
) )
attributes = { attributes = {
FROSTFS_EXPIRATION_TIMESTAMP: self.epoch_count_into_timestamp( SYSTEM_EXPIRATION_TIMESTAMP: self.epoch_count_into_timestamp(
epoch_duration=epoch_duration, epoch=2 epoch_duration=epoch_duration, epoch=2
), ),
FROSTFS_EXPIRATION_RFC3339: self.epoch_count_into_timestamp( SYSTEM_EXPIRATION_RFC3339: self.epoch_count_into_timestamp(
epoch_duration=epoch_duration, epoch=1, rfc3339=True epoch_duration=epoch_duration, epoch=1, rfc3339=True
), ),
} }
@ -372,7 +372,7 @@ class Test_http_system_header(ClusterTestBase):
f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}" f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}"
) )
attributes = { attributes = {
FROSTFS_EXPIRATION_RFC3339: self.epoch_count_into_timestamp( SYSTEM_EXPIRATION_RFC3339: self.epoch_count_into_timestamp(
epoch_duration=epoch_duration, epoch=2, rfc3339=True epoch_duration=epoch_duration, epoch=2, rfc3339=True
) )
} }