Skip to content

Commit

Permalink
Compare number of created files with number of fixtures
Browse files Browse the repository at this point in the history
Ensure that the number of files created by the callback is the same
as the number of fixture files to compare with. There have been cases
where the callback produced less files and the tests passed without
noticing this.

Signed-off-by: Ruediger Pluem <[email protected]>
  • Loading branch information
rpluem-vf authored and evgeni committed Jan 29, 2025
1 parent cf9972a commit 469bc61
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def run_callback(tmpdir, report_type, vcrmode):
run = run_playbook_callback(tmpdir, report_type)
assert run.rc == 0
assert len(tmpdir.listdir()) > 0, "Directory with results is empty"
fixture_directory = os.path.join(os.getcwd(), 'tests', 'fixtures', 'callback', 'dir_store', report_type)
assert len(tmpdir.listdir()) == len(os.listdir(fixture_directory)), "Fixture directory and output directory have a different number of files"
for real_file in tmpdir.listdir(sort=True):
contents = real_file.read()
contents = re.sub(r"\d+-\d+-\d+ \d+:\d+:\d+\+\d+:\d+", "2000-01-01 12:00:00+00:00", contents)
Expand Down

0 comments on commit 469bc61

Please sign in to comment.