Fix reconciliation expectations and strict Clippy checks
This commit is contained in:
1 parent
feec06bc41
commit
a85a4e1184
4 files changed
+49
-21
No files matched your search
@@ -104,7 +104,7 @@ fn directory_events_reconcile_only_subtree_and_prune_exclusions() -> Result<()>
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_batches_and_failed_reads_roll_back_all_changes() -> Result<()> {
|
||||
fn invalid_batches_and_unreadable_sources_preserve_records() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let root = temp.path().join("root");
|
||||
fs::create_dir(&root)?;
|
||||
@@ -126,10 +126,14 @@ fn invalid_batches_and_failed_reads_roll_back_all_changes() -> Result<()> {
|
||||
let permissions = {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let previous = fs::metadata(root.join("z.txt"))?.permissions();
|
||||
fs::set_permissions(root.join("z.txt"), fs::Permissions::from_mode(0))?;
|
||||
fs::set_permissions(root.join("z.txt"), fs::Permissions::from_mode(0o000))?;
|
||||
previous
|
||||
};
|
||||
let failed = index.index_paths_with_options(
|
||||
let denied = fs::File::open(root.join("z.txt"))
|
||||
.expect_err("fixture must prevent reading the indexed source")
|
||||
.kind()
|
||||
== std::io::ErrorKind::PermissionDenied;
|
||||
let result = index.index_paths_with_options(
|
||||
&root,
|
||||
&[root.join("a.txt"), root.join("z.txt")],
|
||||
&IndexOptions::default(),
|
||||
@@ -138,9 +142,19 @@ fn invalid_batches_and_failed_reads_roll_back_all_changes() -> Result<()> {
|
||||
drop(locked);
|
||||
#[cfg(unix)]
|
||||
fs::set_permissions(root.join("z.txt"), permissions)?;
|
||||
assert!(failed.is_err());
|
||||
assert_eq!(index.search("beforetransaction", 10)?.len(), 1);
|
||||
assert!(index.search("aftertransaction", 10)?.is_empty());
|
||||
if denied {
|
||||
// Permission denial preserves that file while readable changes commit.
|
||||
let report = result?;
|
||||
assert_eq!(report.skipped, 1);
|
||||
assert_eq!(index.search("aftertransaction", 10)?.len(), 1);
|
||||
assert!(index.search("beforetransaction", 10)?.is_empty());
|
||||
} else {
|
||||
// Other I/O errors, including platform-specific sharing failures, abort.
|
||||
assert!(result.is_err());
|
||||
assert_eq!(index.search("beforetransaction", 10)?.len(), 1);
|
||||
assert!(index.search("aftertransaction", 10)?.is_empty());
|
||||
}
|
||||
assert_eq!(index.search("validlast", 10)?.len(), 1);
|
||||
assert!(index
|
||||
.index_paths_with_options(
|
||||
&root,
|
||||
|
||||
Reference in new issue
Block a user