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 {
14301430 ) ;
14311431 }
14321432
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+
14331452 #[ test]
14341453 fn pin_unpin_works ( ) {
14351454 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
You can’t perform that action at this time.
0 commit comments