@@ -13,16 +13,18 @@ def test_download_report(mock_cache):
13
13
"""
14
14
Test base method to download a report & store it on local FS
15
15
"""
16
- mock_cache .bucket .add_mock_blob ("myrepo/deadbeef123/full .json.zstd" )
16
+ mock_cache .bucket .add_mock_blob ("myrepo/deadbeef123/all:all .json.zstd" )
17
17
18
18
# Does not exist
19
19
report = Report (mock_cache .reports_dir , "myrepo" , "missing" , date = 1 , push_id = 1 )
20
20
assert mock_cache .download_report (report ) is False
21
21
22
22
archive = os .path .join (
23
- mock_cache .reports_dir , "myrepo" , "deadbeef123" , "full.json.zstd"
23
+ mock_cache .reports_dir , "myrepo" , "deadbeef123" , "all:all.json.zstd"
24
+ )
25
+ payload = os .path .join (
26
+ mock_cache .reports_dir , "myrepo" , "deadbeef123" , "all:all.json"
24
27
)
25
- payload = os .path .join (mock_cache .reports_dir , "myrepo" , "deadbeef123" , "full.json" )
26
28
assert not os .path .exists (archive )
27
29
assert not os .path .exists (payload )
28
30
@@ -46,9 +48,9 @@ def test_ingestion(mock_cache):
46
48
Test ingestion of several reports and their retrieval through Redis index
47
49
"""
48
50
# Setup blobs
49
- mock_cache .bucket .add_mock_blob ("myrepo/rev1/full .json.zstd" , coverage = 0.1 )
50
- mock_cache .bucket .add_mock_blob ("myrepo/rev2/full .json.zstd" , coverage = 0.2 )
51
- mock_cache .bucket .add_mock_blob ("myrepo/rev10/full .json.zstd" , coverage = 1.0 )
51
+ mock_cache .bucket .add_mock_blob ("myrepo/rev1/all:all .json.zstd" , coverage = 0.1 )
52
+ mock_cache .bucket .add_mock_blob ("myrepo/rev2/all:all .json.zstd" , coverage = 0.2 )
53
+ mock_cache .bucket .add_mock_blob ("myrepo/rev10/all:all .json.zstd" , coverage = 1.0 )
52
54
53
55
# No reports at first
54
56
assert mock_cache .redis .zcard (b"reports:myrepo" ) == 0
@@ -67,13 +69,13 @@ def test_ingestion(mock_cache):
67
69
assert mock_cache .redis .zcard (b"reports:myrepo:all:all" ) == 3
68
70
assert mock_cache .redis .zcard (b"history:myrepo" ) == 3
69
71
assert os .path .exists (
70
- os .path .join (mock_cache .reports_dir , "myrepo" , "rev1" , "full .json" )
72
+ os .path .join (mock_cache .reports_dir , "myrepo" , "rev1" , "all:all .json" )
71
73
)
72
74
assert os .path .exists (
73
- os .path .join (mock_cache .reports_dir , "myrepo" , "rev2" , "full .json" )
75
+ os .path .join (mock_cache .reports_dir , "myrepo" , "rev2" , "all:all .json" )
74
76
)
75
77
assert os .path .exists (
76
- os .path .join (mock_cache .reports_dir , "myrepo" , "rev10" , "full .json" )
78
+ os .path .join (mock_cache .reports_dir , "myrepo" , "rev10" , "all:all .json" )
77
79
)
78
80
79
81
# Reports are exposed, and sorted by push
@@ -87,7 +89,7 @@ def test_ingestion(mock_cache):
87
89
]
88
90
89
91
# Even if we add a smaller one later on, reports are still sorted
90
- mock_cache .bucket .add_mock_blob ("myrepo/rev5/full .json.zstd" , coverage = 0.5 )
92
+ mock_cache .bucket .add_mock_blob ("myrepo/rev5/all:all .json.zstd" , coverage = 0.5 )
91
93
report_5 = Report (mock_cache .reports_dir , "myrepo" , "rev5" , date = 5000 , push_id = 5 )
92
94
mock_cache .ingest_report (report_5 )
93
95
assert mock_cache .list_reports ("myrepo" ) == [
@@ -114,7 +116,7 @@ def test_ingest_hgmo(mock_cache, mock_hgmo):
114
116
# Add a report on push 995
115
117
rev = hashlib .md5 (b"995" ).hexdigest ()
116
118
mock_cache .bucket .add_mock_blob (
117
- "myrepo/{}/full .json.zstd" .format (rev ), coverage = 0.5
119
+ "myrepo/{}/all:all .json.zstd" .format (rev ), coverage = 0.5
118
120
)
119
121
120
122
# Ingest last pushes
@@ -149,7 +151,7 @@ def test_closest_report(mock_cache, mock_hgmo):
149
151
# Add a report on 994, 2 pushes after our revision
150
152
report_rev = hashlib .md5 (b"994" ).hexdigest ()
151
153
mock_cache .bucket .add_mock_blob (
152
- "myrepo/{}/full .json.zstd" .format (report_rev ), coverage = 0.5
154
+ "myrepo/{}/all:all .json.zstd" .format (report_rev ), coverage = 0.5
153
155
)
154
156
report_994 = Report (
155
157
mock_cache .reports_dir , "myrepo" , report_rev , push_id = 1 , date = 994
@@ -158,7 +160,7 @@ def test_closest_report(mock_cache, mock_hgmo):
158
160
# Add a report on 990, 2 pushes before our revision
159
161
base_rev = hashlib .md5 (b"990" ).hexdigest ()
160
162
mock_cache .bucket .add_mock_blob (
161
- "myrepo/{}/full .json.zstd" .format (base_rev ), coverage = 0.4
163
+ "myrepo/{}/all:all .json.zstd" .format (base_rev ), coverage = 0.4
162
164
)
163
165
report_990 = Report (mock_cache .reports_dir , "myrepo" , base_rev , push_id = 1 , date = 990 )
164
166
@@ -197,10 +199,10 @@ def test_get_coverage(mock_cache):
197
199
report = Report (mock_cache .reports_dir , "myrepo" , "myhash" , push_id = 1 , date = 1 )
198
200
with pytest .raises (AssertionError ) as e :
199
201
mock_cache .get_coverage (report , "" )
200
- assert str (e .value ) == "Missing report myrepo/myhash/full "
202
+ assert str (e .value ) == "Missing report myrepo/myhash/all:all "
201
203
202
204
# Report available online
203
- mock_cache .bucket .add_mock_blob ("myrepo/myhash/full .json.zstd" )
205
+ mock_cache .bucket .add_mock_blob ("myrepo/myhash/all:all .json.zstd" )
204
206
205
207
# Coverage available
206
208
coverage = mock_cache .get_coverage (report , "" )
@@ -213,7 +215,7 @@ def test_get_coverage(mock_cache):
213
215
}
214
216
215
217
# Remove local file
216
- path = os .path .join (mock_cache .reports_dir , "myrepo" , "myhash" , "full .json" )
218
+ path = os .path .join (mock_cache .reports_dir , "myrepo" , "myhash" , "all:all .json" )
217
219
assert os .path .exists (path )
218
220
os .unlink (path )
219
221
0 commit comments