mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-18 13:40:37 +00:00
add basic test for valueread reuse
This commit is contained in:
@@ -26,6 +26,7 @@ pub trait File: Send {
|
||||
#[derive(Debug)]
|
||||
pub struct ValueRead<B: Buffer> {
|
||||
pos: u32,
|
||||
// TODO: use tri-state enum to distinguish between not started, started, and finished-with-ok-or-err
|
||||
state: MutexRefCell<Result<B, Arc<std::io::Error>>>,
|
||||
}
|
||||
|
||||
@@ -374,6 +375,18 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[should_panic]
|
||||
async fn test_reusing_value_reads_panics() {
|
||||
let ctx = RequestContext::new(TaskKind::UnitTest, DownloadBehavior::Error);
|
||||
let file = InMemoryFile::new_random(DIO_CHUNK_SIZE);
|
||||
let a = file.test_value_read(23, 10);
|
||||
let value_reads = vec![a.make_value_read()];
|
||||
execute(&file, &value_reads, &ctx).await;
|
||||
// reuse pancis
|
||||
execute(&file, &value_reads, &ctx).await;
|
||||
}
|
||||
|
||||
struct RecorderFile<'a> {
|
||||
recorded: RefCell<Vec<RecordedRead>>,
|
||||
file: &'a InMemoryFile,
|
||||
|
||||
Reference in New Issue
Block a user