Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
cheme committed Dec 5, 2023
1 parent 14d09fb commit 0ffcdf7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions substrate/primitives/trie/src/cache/shared_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,9 @@ mod tests {
assert_eq!(1, cache.lru.limiter_mut().known_storage_keys.len());
assert_eq!(
3, // Two instances inside the cache + one extra in `known_storage_keys`.
Arc::strong_count(cache.lru.limiter_mut().known_storage_keys.get(&key[..]).unwrap())
Arc::strong_count(
cache.lru.limiter_mut().known_storage_keys.get_key_value(&key[..]).unwrap().0
)
);
assert_eq!(key.len(), cache.lru.limiter().heap_size);
assert_eq!(cache.lru.len(), 2);
Expand All @@ -792,7 +794,9 @@ mod tests {
assert_eq!(1, cache.lru.limiter_mut().known_storage_keys.len());
assert_eq!(
3,
Arc::strong_count(cache.lru.limiter_mut().known_storage_keys.get(&key[..]).unwrap())
Arc::strong_count(
cache.lru.limiter_mut().known_storage_keys.get_key_value(&key[..]).unwrap().0
)
);
assert_eq!(key.len(), cache.lru.limiter().heap_size);
assert_eq!(cache.lru.len(), 2);
Expand All @@ -812,7 +816,9 @@ mod tests {
assert_eq!(1, cache.lru.limiter_mut().known_storage_keys.len());
assert_eq!(
3,
Arc::strong_count(cache.lru.limiter_mut().known_storage_keys.get(&key[..]).unwrap())
Arc::strong_count(
cache.lru.limiter_mut().known_storage_keys.get_key_value(&key[..]).unwrap().0
)
);
assert_eq!(key.len(), cache.lru.limiter().heap_size);
assert_eq!(cache.lru.len(), 2);
Expand All @@ -833,7 +839,7 @@ mod tests {
assert_eq!(cache.lru.limiter().items_evicted, 2);
assert_eq!(10, cache.lru.len());
assert_eq!(10, cache.lru.limiter_mut().known_storage_keys.len());
assert!(cache.lru.limiter_mut().known_storage_keys.get(&key[..]).is_none());
assert!(cache.lru.limiter_mut().known_storage_keys.get_key_value(&key[..]).is_none());
assert_eq!(key.len() * 10, cache.lru.limiter().heap_size);
assert_eq!(cache.lru.len(), 10);
assert!(cache.lru.limiter().heap_size <= cache.lru.limiter().max_heap_size);
Expand All @@ -854,6 +860,6 @@ mod tests {
vec![],
);

assert!(cache.lru.limiter_mut().known_storage_keys.get(&key[..]).is_none());
assert!(cache.lru.limiter_mut().known_storage_keys.get_key_value(&key[..]).is_none());
}
}

0 comments on commit 0ffcdf7

Please sign in to comment.