@@ -26,10 +26,15 @@ def test_get_size_metrics_filtering(self):
2626 metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .ANDROID_DYNAMIC_FEATURE ,
2727 identifier = "test_feature" ,
2828 )
29+ app_clip_metrics = self .create_preprod_artifact_size_metrics (
30+ artifact ,
31+ metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .APP_CLIP_ARTIFACT ,
32+ identifier = "test_app_clip" ,
33+ )
2934
3035 # Test getting all metrics (no filters)
3136 all_metrics = artifact .get_size_metrics ()
32- assert all_metrics .count () == 3
37+ assert all_metrics .count () == 4
3338
3439 # Test filtering by metrics type
3540 main_only = artifact .get_size_metrics (
@@ -65,6 +70,15 @@ def test_get_size_metrics_filtering(self):
6570 assert feature_typed_first is not None
6671 assert feature_typed_first .id == feature_metrics .id
6772
73+ app_clip_only = artifact .get_size_metrics (
74+ metrics_artifact_type = PreprodArtifactSizeMetrics .MetricsArtifactType .APP_CLIP_ARTIFACT ,
75+ identifier = "test_app_clip" ,
76+ )
77+ assert app_clip_only .count () == 1
78+ app_clip_first = app_clip_only .first ()
79+ assert app_clip_first is not None
80+ assert app_clip_first .id == app_clip_metrics .id
81+
6882 # Test no matches
6983 no_matches = artifact .get_size_metrics (identifier = "nonexistent" )
7084 assert no_matches .count () == 0
@@ -82,6 +96,11 @@ def test_get_size_metrics_for_artifacts_bulk(self):
8296 artifact1 ,
8397 metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .WATCH_ARTIFACT ,
8498 )
99+ artifact1_app_clip = self .create_preprod_artifact_size_metrics (
100+ artifact1 ,
101+ metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .APP_CLIP_ARTIFACT ,
102+ identifier = "clip.one" ,
103+ )
85104 artifact2_main = self .create_preprod_artifact_size_metrics (
86105 artifact2 ,
87106 metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .MAIN_ARTIFACT ,
@@ -92,7 +111,7 @@ def test_get_size_metrics_for_artifacts_bulk(self):
92111
93112 assert artifact1 .id in results
94113 assert artifact2 .id in results
95- assert results [artifact1 .id ].count () == 2 # main + watch
114+ assert results [artifact1 .id ].count () == 3 # main + watch + app clip
96115 assert results [artifact2 .id ].count () == 1 # main only
97116
98117 # Test bulk retrieval with type filter (should get only main metrics)
@@ -122,6 +141,18 @@ def test_get_size_metrics_for_artifacts_bulk(self):
122141 assert artifact1_watch_first is not None
123142 assert artifact1_watch_first .id == artifact1_watch .id
124143
144+ app_clip_results = PreprodArtifact .get_size_metrics_for_artifacts (
145+ [artifact1 , artifact2 ],
146+ metrics_artifact_type = PreprodArtifactSizeMetrics .MetricsArtifactType .APP_CLIP_ARTIFACT ,
147+ identifier = "clip.one" ,
148+ )
149+
150+ assert app_clip_results [artifact1 .id ].count () == 1
151+ assert app_clip_results [artifact2 .id ].count () == 0
152+ artifact1_app_clip_first = app_clip_results [artifact1 .id ].first ()
153+ assert artifact1_app_clip_first is not None
154+ assert artifact1_app_clip_first .id == artifact1_app_clip .id
155+
125156 # Test with empty list
126157 empty_results = PreprodArtifact .get_size_metrics_for_artifacts ([])
127158 assert empty_results == {}
@@ -144,6 +175,11 @@ def test_get_size_metrics_ignores_other_artifacts(self):
144175 metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .ANDROID_DYNAMIC_FEATURE ,
145176 identifier = "feature_a" ,
146177 )
178+ artifact1_app_clip = self .create_preprod_artifact_size_metrics (
179+ artifact1 ,
180+ metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .APP_CLIP_ARTIFACT ,
181+ identifier = "clip_a" ,
182+ )
147183
148184 artifact2_main = self .create_preprod_artifact_size_metrics (
149185 artifact2 ,
@@ -158,22 +194,37 @@ def test_get_size_metrics_ignores_other_artifacts(self):
158194 metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .ANDROID_DYNAMIC_FEATURE ,
159195 identifier = "feature_a" , # Same identifier as artifact1 but different artifact
160196 )
197+ artifact2_app_clip = self .create_preprod_artifact_size_metrics (
198+ artifact2 ,
199+ metrics_type = PreprodArtifactSizeMetrics .MetricsArtifactType .APP_CLIP_ARTIFACT ,
200+ identifier = "clip_a" ,
201+ )
161202
162203 # Test artifact1's metrics - should only get artifact1 metrics, not artifact2
163204 artifact1_metrics = artifact1 .get_size_metrics ()
164- assert artifact1_metrics .count () == 3
205+ assert artifact1_metrics .count () == 4
165206
166207 artifact1_ids = {m .id for m in artifact1_metrics }
167- expected_artifact1_ids = {artifact1_main .id , artifact1_watch .id , artifact1_feature .id }
208+ expected_artifact1_ids = {
209+ artifact1_main .id ,
210+ artifact1_watch .id ,
211+ artifact1_feature .id ,
212+ artifact1_app_clip .id ,
213+ }
168214 assert artifact1_ids == expected_artifact1_ids
169215
170216 # Ensure none of artifact2's metrics are included
171- artifact2_ids = {artifact2_main .id , artifact2_watch .id , artifact2_feature .id }
217+ artifact2_ids = {
218+ artifact2_main .id ,
219+ artifact2_watch .id ,
220+ artifact2_feature .id ,
221+ artifact2_app_clip .id ,
222+ }
172223 assert artifact1_ids .isdisjoint (artifact2_ids )
173224
174225 # Test artifact2's metrics - should only get artifact2 metrics, not artifact1
175226 artifact2_metrics = artifact2 .get_size_metrics ()
176- assert artifact2_metrics .count () == 3
227+ assert artifact2_metrics .count () == 4
177228
178229 artifact2_result_ids = {m .id for m in artifact2_metrics }
179230 assert artifact2_result_ids == artifact2_ids
0 commit comments