use crate::tests::{test_db::TestDB, util::random_bytes};
#[tokio::test]
async fn read_many_smoke() {
let chunk_size = 100;
let max_file_size = 10_000;
let bytes_one = random_bytes(max_file_size);
let bytes_two = random_bytes(chunk_size);
let bytes_three = random_bytes(max_file_size);
let bytes_four = random_bytes(chunk_size);
let mut test_db = TestDB::open("read_many_smoke", Some(chunk_size), Some(max_file_size))
.await
.unwrap();
let block_key_one = test_db.write(&bytes_one, true).await.unwrap();
let block_key_two = test_db.write(&bytes_two, true).await.unwrap();
let block_key_three = test_db.write(&bytes_three, false).await.unwrap();
let block_key_four = test_db.write(&bytes_four, true).await.unwrap();
test_db.free(&block_key_two, &bytes_two).await.unwrap();
test_db.free(&block_key_four, &bytes_four).await.unwrap();
let read_map = test_db
.block_db
.read_many(vec![
&block_key_one,
&block_key_two,
&block_key_three,
&block_key_four,
])
.await
.unwrap();
assert_eq!(read_map.get(&block_key_one).unwrap(), &Some(bytes_one));
assert_eq!(read_map.get(&block_key_two).unwrap(), &None);
assert_eq!(read_map.get(&block_key_three).unwrap(), &Some(bytes_three));
assert_eq!(read_map.get(&block_key_four).unwrap(), &None);
test_db.cleanup().await.unwrap();
}