MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_pristine_reopen

Function test_pristine_reopen

atomic-core/src/pristine/txn/pristine.rs:330–352  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

328
329 #[test]
330 fn test_pristine_reopen() {
331 let dir = tempdir().unwrap();
332 let db_path = dir.path().join("pristine");
333
334 // Create and populate
335 {
336 let pristine = Pristine::open(&db_path).unwrap();
337 assert_eq!(pristine.peek_next_node_id(), 1);
338
339 // Allocate some IDs
340 pristine.alloc_node_id();
341 pristine.alloc_node_id();
342 pristine.alloc_node_id();
343 }
344
345 // Reopen - counters won't persist unless we actually write data
346 // This is expected - the counters are derived from the data
347 {
348 let pristine = Pristine::open(&db_path).unwrap();
349 // Since we didn't actually write any changes, counter resets
350 assert_eq!(pristine.peek_next_node_id(), 1);
351 }
352 }
353
354 #[test]
355 fn test_alloc_node_id() {

Callers

nothing calls this directly

Calls 3

alloc_node_idMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected