Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdk-heartbeat: improve logging #314

Merged
merged 3 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,24 @@ def execute_test(self):
def create_test_instance(config: Config) -> HeartbeatTest:
import importlib

module = importlib.import_module(config.database_test_module_name)
class_ = getattr(module, config.database_test_class_name)
try:
module = importlib.import_module(config.database_test_module_name)
except ModuleNotFoundError as e:
raise ModuleNotFoundError(
f"Configured database_test_module_name is not found. Error was: {e}.\n"
f"Make sure module {config.database_test_module_name} exists.\n"
f"Check if the module name in the configuration is not misspelled "
f"or if some 3th party library needs to be installed to provide it."
) from None
try:
class_ = getattr(module, config.database_test_class_name)
except AttributeError as e:
raise AttributeError(
f"Configured database_test_class_name is not found. Error was: {e}.\\n"
f"Make sure class {config.database_test_class_name} exists.\n"
f"Check if the class name in the configuration is not misspelled "
f"or if some 3th party library needs to be installed to provide it."
) from None
log.info(
f"Run test instance: {config.database_test_module_name}.{config.database_test_class_name}"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ def show_last_job_execution_logs(self):
self.config.job_team,
]
)
logs = res.decode("string_escape") if res else res
log.info(
f"Team {self.config.job_team}, Job: {self.config.job_name} Logs:\n {res}"
f"Team {self.config.job_team}, Job: {self.config.job_name} Logs:\n {logs}"
)

@LogDecorator(log)
Expand Down