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

Function test_pristine_reopen

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

Source from the content-addressed store, hash-verified

1112
1113 #[test]
1114 fn test_pristine_reopen() {
1115 let dir = tempdir().unwrap();
1116 let db_path = dir.path().join("pristine");
1117
1118 // Create and populate
1119 {
1120 let pristine = Pristine::open(&db_path).unwrap();
1121 assert_eq!(pristine.peek_next_node_id(), 1);
1122
1123 // Allocate some IDs
1124 pristine.alloc_node_id();
1125 pristine.alloc_node_id();
1126 pristine.alloc_node_id();
1127 }
1128
1129 // Reopen - counters won't persist unless we actually write data
1130 // This is expected - the counters are derived from the data
1131 {
1132 let pristine = Pristine::open(&db_path).unwrap();
1133 // Since we didn't actually write any changes, counter resets
1134 assert_eq!(pristine.peek_next_node_id(), 1);
1135 }
1136 }
1137
1138 #[test]
1139 fn test_reopen_allocates_after_unbound_tree_inodes() {

Callers

nothing calls this directly

Calls 4

openFunction · 0.85
alloc_node_idMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected