From 9d772ea2e2123c15db577e49cd02aa87a50f6200 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Fri, 7 Apr 2023 18:12:05 +0000 Subject: [PATCH] test(backups): test that we do use cache --- tests/test_graphql/test_backup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_graphql/test_backup.py b/tests/test_graphql/test_backup.py index f6ad24a..619656d 100644 --- a/tests/test_graphql/test_backup.py +++ b/tests/test_graphql/test_backup.py @@ -192,6 +192,17 @@ def test_redis_storage(backups_backblaze): assert restored_provider.key == "KEY" +def test_snapshots_caching(backups, dummy_service): + Backups.back_up(dummy_service) + + # we test indirectly that we do redis calls instead of shell calls + start = datetime.now() + for i in range(10): + snapshots = Backups.get_snapshots(dummy_service) + assert len(snapshots) == 1 + assert datetime.now() - start < timedelta(seconds=0.5) + + # lowlevel def test_init_tracking_caching(backups, raw_dummy_service): assert Backups._has_redis_init_mark(raw_dummy_service) is False