MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_buffer_pool_size_limit

Function test_buffer_pool_size_limit

src/protocol/buffer_pool.rs:440–457  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

438
439 #[test]
440 fn test_buffer_pool_size_limit() {
441 let config = BufferPoolConfig {
442 max_pool_size: 2,
443 ..Default::default()
444 };
445 let pool = BufferPool::with_config(config);
446
447 // Allocate more buffers than pool size
448 {
449 let _b1 = pool.get_buffer();
450 let _b2 = pool.get_buffer();
451 let _b3 = pool.get_buffer();
452 } // All buffers returned
453
454 let stats = pool.get_stats();
455 assert_eq!(stats.current_pool_size, 2); // Only 2 should be kept
456 assert_eq!(stats.buffers_discarded, 1); // 1 should be discarded
457 }
458
459 #[test]
460 fn test_buffer_capacity_limit() {

Callers

nothing calls this directly

Calls 2

get_bufferMethod · 0.80
get_statsMethod · 0.45

Tested by

no test coverage detected