File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1430,6 +1430,25 @@ mod tests {
1430
1430
) ;
1431
1431
}
1432
1432
1433
+ #[ test]
1434
+ fn heavy_metrics_works ( ) {
1435
+ let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1436
+ let checksum = cache. save_wasm ( CONTRACT ) . unwrap ( ) ;
1437
+
1438
+ cache. pin ( & checksum) . unwrap ( ) ;
1439
+
1440
+ let heavy_metrics = cache. heavy_metrics ( ) ;
1441
+ assert_eq ! ( heavy_metrics. hits_per_pinned_contract, vec![ ( checksum, 0 ) ] ) ;
1442
+
1443
+ let backend = mock_backend ( & [ ] ) ;
1444
+ let _ = cache
1445
+ . get_instance ( & checksum, backend, TESTING_OPTIONS )
1446
+ . unwrap ( ) ;
1447
+
1448
+ let heavy_metrics = cache. heavy_metrics ( ) ;
1449
+ assert_eq ! ( heavy_metrics. hits_per_pinned_contract, vec![ ( checksum, 1 ) ] ) ;
1450
+ }
1451
+
1433
1452
#[ test]
1434
1453
fn pin_unpin_works ( ) {
1435
1454
let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
You can’t perform that action at this time.
0 commit comments