test: cover file task delivery, replacement, cancellation and provider failures
Verify Tessera GUI / verify (push) Failing after 9m15s

This commit is contained in:
2026-10-23 12:06:44 +08:00
parent 047e008729
commit 05b727a4a5
6 changed files with 225 additions and 31 deletions
+23 -26
View File
@@ -125,30 +125,27 @@ fn pool() -> Result<&'static SyncSender<Job>, &'static str> {
.map_err(|_| "file provider unavailable")
}
fn read_text(path: &str) -> Completion {
let read = || -> Result<String, String> {
let metadata = std::fs::metadata(path).map_err(|error| error.to_string())?;
if !metadata.is_file() {
return Err("text source must be a regular file".into());
}
if metadata.len() > MAX_TEXT as u64 {
return Err("text source exceeds 1 MiB".into());
}
let file = File::open(path).map_err(|error| error.to_string())?;
if !file
.metadata()
.map_err(|error| error.to_string())?
.is_file()
{
return Err("text source must be a regular file".into());
}
let mut bytes = Vec::new();
file.take(MAX_TEXT as u64 + 1)
.read_to_end(&mut bytes)
.map_err(|error| error.to_string())?;
if bytes.len() > MAX_TEXT {
return Err("text source exceeds 1 MiB".into());
}
String::from_utf8(bytes).map_err(|_| "text source must be UTF-8".into())
};
read()
let metadata = std::fs::metadata(path).map_err(|error| error.to_string())?;
if !metadata.is_file() {
return Err("text source must be a regular file".into());
}
if metadata.len() > MAX_TEXT as u64 {
return Err("text source exceeds 1 MiB".into());
}
let file = File::open(path).map_err(|error| error.to_string())?;
if !file
.metadata()
.map_err(|error| error.to_string())?
.is_file()
{
return Err("text source must be a regular file".into());
}
let mut bytes = Vec::new();
file.take(MAX_TEXT as u64 + 1)
.read_to_end(&mut bytes)
.map_err(|error| error.to_string())?;
if bytes.len() > MAX_TEXT {
return Err("text source exceeds 1 MiB".into());
}
String::from_utf8(bytes).map_err(|_| "text source must be UTF-8".into())
}