Detector: perist executed actions

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-08-04 14:04:36 +02:00
parent 12c59f9b23
commit f75702439c
2 changed files with 24 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
import logging
from repo_cloner.lib import Detector, DetectedCommit
from repo_cloner.lib import Detector, DetectedCommit, DiskStoredList, DiskStoredRefs
import pytest
from unittest.mock import patch, MagicMock, PropertyMock
from git import Actor
@@ -368,3 +368,13 @@ def test_run(tmp_path, caplog):
assert any(ex.tags == 'v1001' for ex in executed)
assert any(ex.branches == 'master' for ex in executed)
assert all(ex.commit not in commits_old or ex.is_tag for ex in executed)
# new commits persisted?
commits = DiskStoredList(cache_dir.joinpath("detector", "detectorExecuted").as_posix())
for commit in commits_new:
assert commit in commits
refs = DiskStoredRefs(cache_dir.joinpath("detector", "tags"))
for tag, commit in tags_new.items():
assert commit == refs.get(tag)