@@ -65,6 +65,10 @@ def test_ingestion(mock_cache):
6565 mock_cache .ingest_report (report_2 )
6666 mock_cache .ingest_report (report_10 )
6767
68+ # Check expiry
69+ assert report_1 .ttl is None
70+ assert mock_cache .redis .ttl (report_1 .key_overall ) == - 1
71+
6872 # They must be in redis and on the file system
6973 assert mock_cache .redis .zcard (b"reports:myrepo:all:all" ) == 3
7074 assert mock_cache .redis .zcard (b"history:myrepo" ) == 3
@@ -108,6 +112,33 @@ def test_ingestion(mock_cache):
108112 ]
109113
110114
115+ def test_expiry (mock_cache ):
116+ """
117+ Test expiry for platform & suite reports
118+ """
119+ mock_cache .bucket .add_mock_blob ("myrepo/rev1/all:somesuite.json.zstd" , coverage = 1.0 )
120+ report_suite = Report (
121+ mock_cache .reports_dir ,
122+ "myrepo" ,
123+ "rev1" ,
124+ platform = "all" ,
125+ suite = "somesuite" ,
126+ date = 1000 ,
127+ push_id = 1 ,
128+ )
129+ mock_cache .ingest_report (report_suite )
130+ assert report_suite .ttl == 1296000
131+ assert mock_cache .redis .ttl (report_suite .key_overall ) > 0
132+
133+ mock_cache .bucket .add_mock_blob ("myrepo/rev1/win:all.json.zstd" , coverage = 1.0 )
134+ report_platform = Report (
135+ mock_cache .reports_dir , "myrepo" , "rev1" , platform = "win" , date = 2000 , push_id = 2
136+ )
137+ mock_cache .ingest_report (report_platform )
138+ assert report_platform .ttl == 1296000
139+ assert mock_cache .redis .ttl (report_platform .key_overall ) > 0
140+
141+
111142def test_ingest_hgmo (mock_cache , mock_hgmo ):
112143 """
113144 Test ingestion using a mock HGMO
0 commit comments