Feature/move errors patterns and check function to lib #9
6 changed files with 54 additions and 3 deletions
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "frostfs-testlib"
|
name = "frostfs-testlib"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
description = "Building blocks and utilities to facilitate development of automated tests for FrostFS system"
|
description = "Building blocks and utilities to facilitate development of automated tests for FrostFS system"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{ name = "NSPCC", email = "info@nspcc.ru" }]
|
authors = [{ name = "NSPCC", email = "info@nspcc.ru" }]
|
||||||
|
@ -50,7 +50,7 @@ line-length = 100
|
||||||
target-version = ["py310"]
|
target-version = ["py310"]
|
||||||
|
|
||||||
[tool.bumpver]
|
[tool.bumpver]
|
||||||
current_version = "1.2.0"
|
current_version = "1.3.0"
|
||||||
version_pattern = "MAJOR.MINOR.PATCH"
|
version_pattern = "MAJOR.MINOR.PATCH"
|
||||||
commit_message = "Bump version {old_version} -> {new_version}"
|
commit_message = "Bump version {old_version} -> {new_version}"
|
||||||
commit = true
|
commit = true
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "1.2.0"
|
__version__ = "1.3.0"
|
||||||
|
|
1
src/frostfs_testlib/resources/__init__.py
Normal file
1
src/frostfs_testlib/resources/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
import common
|
36
src/frostfs_testlib/resources/common.py
Normal file
36
src/frostfs_testlib/resources/common.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# ACLs with final flag
|
||||||
|
PUBLIC_ACL_F = "1FBFBFFF"
|
||||||
|
PRIVATE_ACL_F = "1C8C8CCC"
|
||||||
|
READONLY_ACL_F = "1FBF8CFF"
|
||||||
|
|
||||||
|
# ACLs without final flag set
|
||||||
|
PUBLIC_ACL = "0FBFBFFF"
|
||||||
|
INACCESSIBLE_ACL = "40000000"
|
||||||
|
STICKY_BIT_PUB_ACL = "3FFFFFFF"
|
||||||
|
|
||||||
|
EACL_PUBLIC_READ_WRITE = "eacl-public-read-write"
|
||||||
|
|
||||||
|
# Regex patterns of status codes of Container service
|
||||||
|
CONTAINER_NOT_FOUND = "code = 3072.*message = container not found"
|
||||||
|
|
||||||
|
|
||||||
|
# Regex patterns of status codes of Object service
|
||||||
|
MALFORMED_REQUEST = "code = 1024.*message = malformed request"
|
||||||
|
OBJECT_ACCESS_DENIED = "code = 2048.*message = access to object operation denied"
|
||||||
|
OBJECT_NOT_FOUND = "code = 2049.*message = object not found"
|
||||||
|
OBJECT_ALREADY_REMOVED = "code = 2052.*message = object already removed"
|
||||||
|
SESSION_NOT_FOUND = "code = 4096.*message = session token not found"
|
||||||
|
OUT_OF_RANGE = "code = 2053.*message = out of range"
|
||||||
|
# TODO: Due to https://github.com/nspcc-dev/neofs-node/issues/2092 we have to check only codes until fixed
|
||||||
|
# OBJECT_IS_LOCKED = "code = 2050.*message = object is locked"
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
LIFETIME_REQUIRED = "either expiration epoch of a lifetime is required"
|
||||||
|
LOCK_OBJECT_REMOVAL = "lock object removal"
|
||||||
|
LOCK_OBJECT_EXPIRATION = "lock object expiration: {expiration_epoch}; current: {current_epoch}"
|
||||||
|
INVALID_RANGE_ZERO_LENGTH = "invalid '{range}' range: zero length"
|
||||||
|
INVALID_RANGE_OVERFLOW = "invalid '{range}' range: uint64 overflow"
|
||||||
|
INVALID_OFFSET_SPECIFIER = "invalid '{range}' range offset specifier"
|
||||||
|
INVALID_LENGTH_SPECIFIER = "invalid '{range}' range length specifier"
|
|
@ -0,0 +1,3 @@
|
||||||
|
import converters
|
||||||
|
import errors
|
||||||
|
import wallet
|
11
src/frostfs_testlib/utils/errors.py
Normal file
11
src/frostfs_testlib/utils/errors.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def error_matches_status(error: Exception, status_pattern: str) -> bool:
|
||||||
|
"""
|
||||||
|
Determines whether exception matches specified status pattern.
|
||||||
|
|
||||||
|
We use re.search() to be consistent with pytest.raises.
|
||||||
|
"""
|
||||||
|
match = re.search(status_pattern, str(error))
|
||||||
|
return match is not None
|
Loading…
Reference in a new issue