mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-06 23:49:24 +00:00
fix: use future dates in checkpoint prune tests to prevent time-dependent failures (#5543)
Some checks failed
Some checks failed
The test_older_than tests in both JSON and SQLite prune suites used hardcoded 2026-04-17 timestamps for the 'new' checkpoint. Once that date passes, the checkpoint is older than 1 day and gets pruned along with the 'old' one, causing assert count >= 1 to fail (count=0). Use 2099-01-01 for the 'new' checkpoint so tests remain stable. Co-authored-by: Joao Moura <joaomdmoura@gmail.com>
This commit is contained in:
@@ -292,7 +292,7 @@ class TestPruneJson:
|
||||
d, name="20250101T000000_old01111_p-none.json"
|
||||
)
|
||||
os.utime(old_path, (0, 0))
|
||||
_write_json_checkpoint(d, name="20260417T000000_new01111_p-none.json")
|
||||
_write_json_checkpoint(d, name="20990101T000000_new01111_p-none.json")
|
||||
deleted = _prune_json(d, keep=None, older_than=timedelta(days=1))
|
||||
assert deleted == 1
|
||||
|
||||
@@ -330,7 +330,7 @@ class TestPruneSqlite:
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
db_path = os.path.join(d, "test.db")
|
||||
_create_sqlite_checkpoint(db_path, "20200101T000000_old01111")
|
||||
_create_sqlite_checkpoint(db_path, "20260417T000000_new01111")
|
||||
_create_sqlite_checkpoint(db_path, "20990101T000000_new01111")
|
||||
deleted = _prune_sqlite(db_path, keep=None, older_than=timedelta(days=1))
|
||||
assert deleted >= 1
|
||||
with sqlite3.connect(db_path) as conn:
|
||||
|
||||
Reference in New Issue
Block a user