Skip to content

Commit

Permalink
DVX-586: Added functions to validate custom package files
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryamanz29 committed Sep 11, 2024
1 parent 10efaf4 commit f34e1b0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pyatlan/test_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright 2024 Atlan Pte. Ltd.
import logging
import random
from os import path
from typing import List, Optional, Type

from nanoid import generate as generate_nanoid # type: ignore
Expand Down Expand Up @@ -229,3 +230,26 @@ def create_custom_metadata(
)
r = client.typedef.create(cm_def)
return r.custom_metadata_defs[0]


def validate_error_free_logs(files: List[str]):
"""
Asserts that the specified log files do not contain any error messages.
:param files: a list of file paths to the log files to be validated
"""
for file in files:
with open(file, "r") as log:
log_contents = log.read()
assert "ERROR" not in log_contents # noqa: S101


def validate_files_exist(files: List[str]):
"""
Asserts that the specified files exist and are non-empty.
:param files: a list of file paths to be validated
"""
for file in files:
assert path.isfile(file) # noqa: S101
assert path.getsize(file) > 0 # noqa: S101

0 comments on commit f34e1b0

Please sign in to comment.