diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2024-10-05 14:51:14 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2024-10-05 15:06:46 +0200 |
| commit | 94b9400e89ba2e661a5046411080d1b44769a5a6 (patch) | |
| tree | c33f2bc0005c844a0e18f71c586ea3ef3ac5eade /tests/integration.rs | |
| parent | 9f59bf5c621d36fb956ea8a8602b0c37ceaadfe6 (diff) | |
Fix a bug in read_exact
Diffstat (limited to 'tests/integration.rs')
| -rw-r--r-- | tests/integration.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/integration.rs b/tests/integration.rs index 2bebc6d..fc1d0cc 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -299,6 +299,39 @@ fn test_initialize_and_read_from_primary_memtable_fixture_db2() { } #[test] +fn test_initialize_without_memtables_fixture_db3() { + let data_dir = tmp_dir(); + // Copy the fixture DB to the test data directory + fs::create_dir_all(&data_dir).expect("Failed to create the test data directory"); + fs::copy( + &Path::new(TEST_RESOURCES_DIR).join("test_db3"), + &Path::new(&data_dir).join("db"), + ) + .expect("Failed to copy the fixture DB"); + + let mut db = DB::configure() + .data_dir(&data_dir) + .fields(&vec![ + (Field::Id, RecordFieldType::Int), + (Field::Name, RecordFieldType::String), + (Field::Data, RecordFieldType::Bytes), + ]) + .memtable_capacity(0) + .primary_key(Field::Id) + .initialize() + .expect("Failed to initialize DB instance"); + + let result = db.get(&RecordValue::Int(1)).unwrap().unwrap(); + + // Check that the IDs match + let expected = RecordValue::Int(1); + assert!(match (&result.values[0], &expected) { + (RecordValue::Int(a), RecordValue::Int(b)) => a == b, + _ => false, + }); +} + +#[test] fn test_multiple_writing_threads() { let data_dir = tmp_dir(); let mut threads = vec![]; |
