Skip to content

Commit

Permalink
tests: new tests for numeric eacl rules (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-khimov authored Apr 8, 2024
2 parents 1ce940a + 033612a commit cc27301
Show file tree
Hide file tree
Showing 5 changed files with 605 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ jobs:

################################################################
- name: Run Sanity tests for pull requests
timeout-minutes: 120
timeout-minutes: 240
if: github.event_name == 'pull_request'
run: |
source venv.pytest/bin/activate && pytest --alluredir=${GITHUB_WORKSPACE}/allure-results pytest_tests/tests
Expand Down
15 changes: 15 additions & 0 deletions pytest_tests/lib/helpers/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ class EACLHeaderType(Enum):
class EACLMatchType(Enum):
STRING_EQUAL = "=" # Return true if strings are equal
STRING_NOT_EQUAL = "!=" # Return true if strings are different
NUM_GT = ">"
NUM_GE = ">="
NUM_LT = "<"
NUM_LE = "<="

def compare(self, val1, val2):
if self.value == ">":
return val1 > val2
elif self.value == ">=":
return val1 >= val2
elif self.value == "<":
return val1 < val2
elif self.value == "<=":
return val1 <= val2
raise AssertionError(f"Unsupported value: {self.value} for compare")


@dataclass
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 @@ -41,6 +41,7 @@
)

INVALID_SEARCH_QUERY = ".*invalid search query.*"
INVALID_RULES = ".*unable to parse provided rules.*"


def error_matches_status(error: Exception, status_pattern: str) -> bool:
Expand Down
4 changes: 3 additions & 1 deletion pytest_tests/lib/helpers/object_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def can_get_object(
err, OBJECT_ACCESS_DENIED
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
return False
assert get_file_hash(file_name) == get_file_hash(got_file_path)
assert get_file_hash(file_name) == get_file_hash(
got_file_path
), "file hash of downloaded object is not equal to the uploaded"
return True


Expand Down
Loading

0 comments on commit cc27301

Please sign in to comment.