Skip to content

Commit

Permalink
tests: header size limitation, closes nspcc-dev#740
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed Apr 11, 2024
1 parent 02ba9c4 commit dde84d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
timeout-minutes: 240
if: github.event_name == 'pull_request'
run: |
source venv.pytest/bin/activate && pytest --alluredir=${GITHUB_WORKSPACE}/allure-results pytest_tests/tests
source venv.pytest/bin/activate && pytest -s -k test_put_object_header_limitation --alluredir=${GITHUB_WORKSPACE}/allure-results pytest_tests/tests
working-directory: neofs-testcases

################################################################
Expand Down
1 change: 1 addition & 0 deletions pytest_tests/lib/helpers/grpc_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# LOCK_NON_REGULAR_OBJECT = "code = 2051.*message = ..." will be available once 2092 is fixed
OBJECT_IS_LOCKED = "code = 2050"
LOCK_NON_REGULAR_OBJECT = "code = 2051"
OBJECT_HEADER_LENGTH_LIMIT = ".*object header length exceeds the limit.*"

LIFETIME_REQUIRED = ".*at least one of the flags in the group [expire-at lifetime] is required.*"
LOCK_OBJECT_REMOVAL = "lock object removal"
Expand Down
20 changes: 20 additions & 0 deletions pytest_tests/tests/object/test_object_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
INVALID_RANGE_OVERFLOW,
INVALID_RANGE_ZERO_LENGTH,
INVALID_SEARCH_QUERY,
OBJECT_HEADER_LENGTH_LIMIT,
OUT_OF_RANGE,
)
from helpers.neofs_verbs import (
Expand Down Expand Up @@ -736,6 +737,25 @@ def test_object_get_range_hash_negatives(
endpoint=self.neofs_env.sn_rpc,
range_cut=range_cut,
)

def test_put_object_header_limitation(
self, default_wallet: NodeWallet, container: str, simple_object_size: int
):
file_path = generate_file(simple_object_size)
attr_key = "attr"
attr_val = "val"
attr_len = len(attr_key) + len(attr_val) + 9
api_limit = 16384
limit = api_limit // attr_len
with pytest.raises(Exception, match=OBJECT_HEADER_LENGTH_LIMIT):
put_object_to_random_node(
default_wallet.path,
file_path,
container,
shell=self.shell,
neofs_env=self.neofs_env,
attributes={f"{attr_key}{i}": f"{attr_val}{i}" for i in range(limit)}
)

def check_header_is_presented(self, head_info: dict, object_header: dict) -> None:
for key_to_check, val_to_check in object_header.items():
Expand Down

0 comments on commit dde84d3

Please sign in to comment.