Skip to content

Commit

Permalink
Add test for log filename format.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Oct 4, 2023
1 parent d66e975 commit 5b91d9a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/tests_integration/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import glob
import os
import platform
import re
from pathlib import Path

import pytest
Expand Down Expand Up @@ -81,6 +82,22 @@ def delete_log_files(self, logging_path):
for log in logs:
os.remove(log)

def test_log_filename(self, setup_project):
"""
Check the log filename is formatted correctly, for
`update_config`, an arbitrary command
"""
setup_project.update_config("central_host_id", "test_id")

log_search = list(setup_project.cfg.logging_path.glob("*.log"))
assert (
len(log_search) == 1
), "should only be 1 log in this test environment."
log_filename = log_search[0].name

regex = re.compile(r"\d{8}T\d{6}_update-config.log")
assert re.search(regex, log_filename) is not None

def test_logs_make_config_file(self, clean_project_name, tmp_path):
""""""
project = DataShuttle(clean_project_name)
Expand Down

0 comments on commit 5b91d9a

Please sign in to comment.