Skip to content

Commit

Permalink
Add test case for non existant log file
Browse files Browse the repository at this point in the history
  • Loading branch information
gregcorbett committed Aug 30, 2023
1 parent 49733cc commit a7a84e4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test_check_db_dump_recent.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ def test_empty_log(self):

self._run_test(log_line_list, check.check_db_dump_recent.RETURN_CODE_CRITICAL)

def test_no_log(self):
"""Test the check script given a non existent input."""
return_code = self.test_checker.run("/not/a/file")

self.assertEqual(
return_code,
check.check_db_dump_recent.RETURN_CODE_CRITICAL,
"Expected code %s, but got %s." % (
check.check_db_dump_recent.RETURN_CODE_CRITICAL,
return_code,
),
)

def list_to_temp_file(self, input_list):
"""Take the given list and write it to self.temp_file_path."""
with open(self.temp_file_path, "w") as temp_file:
Expand Down

0 comments on commit a7a84e4

Please sign in to comment.