Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions crates/vykar-core/src/app/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ mod tests {
let fast = sched(true, Some("1s"), false);
let slow = sched(true, Some("1h"), false);
let (plan, errors) = SchedulePlan::new(&[&slow, &fast], false);
assert!(errors.is_empty());
assert_eq!(errors.len(), 0);

let fast_at = plan.next_run(1).unwrap();
assert_eq!(plan.next_wake(), Some(fast_at));

// Before the fast slot nothing is due; after it only the fast repo is.
assert!(plan.due(SystemTime::now()).is_empty());
assert_eq!(plan.due(SystemTime::now()).len(), 0);
assert_eq!(plan.due(fast_at), vec![1]);
}

Expand All @@ -381,7 +381,7 @@ mod tests {
let off = sched(false, Some("1h"), false);
let on = sched(true, Some("1h"), false);
let (plan, errors) = SchedulePlan::new(&[&off, &on], false);
assert!(errors.is_empty());
assert_eq!(errors.len(), 0);
assert!(plan.next_run(0).is_none());
assert!(plan.next_run(1).is_some());
assert_eq!(plan.next_wake(), plan.next_run(1));
Expand All @@ -396,7 +396,7 @@ mod tests {
assert_eq!(honored.due(SystemTime::now()), vec![0]);

let (ignored, _) = SchedulePlan::new(&[&startup, &plain], false);
assert!(ignored.due(SystemTime::now()).is_empty());
assert_eq!(ignored.due(SystemTime::now()).len(), 0);
}

#[test]
Expand All @@ -421,10 +421,10 @@ mod tests {

let future_before = plan.next_run(1).unwrap();
let errors = plan.reschedule_overdue(&[&overdue, &future], SystemTime::now());
assert!(errors.is_empty());
assert_eq!(errors.len(), 0);

assert_eq!(plan.next_run(1), Some(future_before));
assert!(plan.due(SystemTime::now()).is_empty());
assert_eq!(plan.due(SystemTime::now()).len(), 0);
}

#[test]
Expand All @@ -450,10 +450,10 @@ mod tests {
fn plan_all_disabled_has_no_wake() {
let off = sched(false, None, false);
let (plan, errors) = SchedulePlan::new(&[&off, &off], true);
assert!(errors.is_empty());
assert_eq!(errors.len(), 0);
assert_eq!(plan.len(), 2);
assert!(plan.next_wake().is_none());
assert!(plan.due(SystemTime::now()).is_empty());
assert_eq!(plan.due(SystemTime::now()).len(), 0);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/app/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ mod tests {
(row.nfiles, row.size_bytes, row.added_bytes),
(None, None, None)
);
assert!(row.source_paths.is_empty());
assert_eq!(row.source_paths.len(), 0);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/vykar-core/src/commands/backup/command_dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ mod tests {
&mut None,
)
.unwrap();
assert!(!refs.is_empty());
assert_ne!(refs.len(), 0);
assert!(total_size > 0);
}

Expand Down Expand Up @@ -443,7 +443,7 @@ mod tests {
&mut None,
)
.unwrap();
assert!(refs.is_empty());
assert_eq!(refs.len(), 0);
assert_eq!(total_size, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/commands/backup/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ mod tests {
);
// On the error path, nothing should have been attributed to stats
// or written into `item.chunks`.
assert!(item.chunks.is_empty());
assert_eq!(item.chunks.len(), 0);
assert_eq!(stats.nfiles, 0);
assert_eq!(stats.original_size, 0);
assert_eq!(stats.compressed_size, 0);
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/commands/backup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ mod tests {

#[test]
fn dataless_summary_silent_when_nothing_skipped() {
assert!(dataless_warnings(0, 0).is_empty());
assert_eq!(dataless_warnings(0, 0).len(), 0);
}

fn dataless_metadata(size: u64, mtime_ns: i64) -> fs::MetadataSummary {
Expand Down
6 changes: 3 additions & 3 deletions crates/vykar-core/src/commands/backup/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ mod tests {
let resolved = result.unwrap();
match resolved.policy {
RootEmission::EmitRoot { prefix } => {
assert!(!prefix.is_empty(), "prefix should not be empty");
assert_ne!(prefix, "", "prefix should not be empty");
assert!(!prefix.contains("/./"), "got: {prefix}");
assert!(!prefix.contains("/../"), "got: {prefix}");
assert!(!prefix.starts_with('/'), "got: {prefix}");
Expand All @@ -596,7 +596,7 @@ mod tests {
let resolved = result.unwrap();
match resolved.policy {
RootEmission::EmitRoot { prefix } => {
assert!(!prefix.is_empty());
assert_ne!(prefix, "");
assert!(!prefix.contains(".."), "got: {prefix}");
}
_ => panic!("expected EmitRoot"),
Expand Down Expand Up @@ -734,7 +734,7 @@ mod tests {
assert_ne!(prefix, "..", "got: {prefix}");
// With the current sanitizing fallback, `/..` produces an empty
// prefix so resolve() can surface a clean error.
assert!(prefix.is_empty(), "got: {prefix}");
assert_eq!(prefix, "", "got: {prefix}");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/commands/backup/walk/inode_walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ mod tests {
_ => None,
})
.collect();
assert!(!entries.is_empty());
assert_ne!(entries.len(), 0);

// Root entry emitted first; under the new multi-path prefix scheme,
// the prefix is the full absolute configured path with leading `/`
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/commands/check/repair_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ mod tests {

let (applied, errors) =
execute_repair(&mut repo, &plan, &scan.issues, &HashMap::new()).unwrap();
assert!(errors.is_empty(), "{errors:?}");
assert_eq!(errors.len(), 0, "{errors:?}");
assert!(applied
.iter()
.any(|a| matches!(a, RepairAction::RestoreKeyCopy { .. })));
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/commands/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ mod repack_chunk_tests {

#[test]
fn empty_input_yields_no_batches() {
assert!(chunk_repack_operations(vec![]).is_empty());
assert_eq!(chunk_repack_operations(vec![]).len(), 0);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/commands/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ mod tests {
],
);

assert!(entries.is_empty());
assert_eq!(entries.len(), 0);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/commands/restore/finalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ mod tests {
#[cfg(not(unix))]
let _ = (i, meta);
}
assert!(stats.warnings.is_empty(), "{:?}", stats.warnings);
assert_eq!(stats.warnings.len(), 0, "{:?}", stats.warnings);
}

/// Warnings respect the global budget: every file yields exactly one chown
Expand Down
8 changes: 4 additions & 4 deletions crates/vykar-core/src/commands/restore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ where
Ok(())
},
)
.map_err(&cleanup)?;
.map_err(cleanup)?;

drop(items_stream);
repo.clear_chunk_index();
Expand All @@ -437,7 +437,7 @@ where
// security-sensitive lchown, and a `rename` never disturbs a symlink's own
// metadata.
finalize::apply_symlink_metadata(&plan_out.symlinks, restore_as_root, &mut stats, shutdown)
.map_err(&cleanup)?;
.map_err(cleanup)?;

// Relink hard-link group members now that every representative is written
// and still in `temp_root` — both link operands share the temp filesystem,
Expand All @@ -457,7 +457,7 @@ where
&mut stats,
shutdown,
)
.map_err(&cleanup)?;
.map_err(cleanup)?;

// Phase 5a: rename temp subtrees into the final destination. All file
// metadata is already on the inodes, so the rename has no observable TOCTOU
Expand All @@ -478,7 +478,7 @@ where
// poll the flag.
#[cfg(test)]
fault_pre_publish_shutdown(&temp_root, shutdown);
check_interrupted(shutdown).map_err(&cleanup)?;
check_interrupted(shutdown).map_err(cleanup)?;
finalize::move_temp_to_dest(&temp_root, &dest_root)?;

// Directory metadata (F1/F2: chown → xattrs → mode → mtime, deepest-first)
Expand Down
6 changes: 3 additions & 3 deletions crates/vykar-core/src/commands/restore/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ mod tests {
collect_all(&stream, dest, |_| true, false, &mut stats).unwrap();

assert_eq!(stats.symlinks, 1);
assert!(stats.warnings.is_empty(), "got: {:?}", stats.warnings);
assert_eq!(stats.warnings.len(), 0, "got: {:?}", stats.warnings);
}

#[test]
Expand Down Expand Up @@ -1530,8 +1530,8 @@ mod tests {
None,
|files, chunks, verified, _stats| {
flush_calls += 1;
assert!(files.is_empty());
assert!(chunks.is_empty());
assert_eq!(files.len(), 0);
assert_eq!(chunks.len(), 0);
last_verified.clone_from(verified);
Ok(())
},
Expand Down
3 changes: 2 additions & 1 deletion crates/vykar-core/src/commands/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ mod tests {
assert_eq!(list.0[0].id, "sess1");
assert_eq!(d.hostname, "host-a");
assert_eq!(d.pid, 7);
assert!(!d.age.is_empty() && d.age != "unknown");
assert_ne!(d.age, "");
assert_ne!(d.age, "unknown");
assert!(!list.has_malformed());
}

Expand Down
24 changes: 12 additions & 12 deletions crates/vykar-core/src/config/resolve/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ repositories: []
fs::write(&path, yaml).unwrap();

let result = load_and_resolve(&path).unwrap();
assert!(result.is_empty(), "expected empty vec for repositories: []");
assert_eq!(result.len(), 0, "expected empty vec for repositories: []");
}

#[test]
Expand Down Expand Up @@ -958,7 +958,7 @@ repositories:
let sources = vec![make_test_source("docs")];

let result = select_sources(&sources, &[]).unwrap();
assert!(result.is_empty());
assert_eq!(result.len(), 0);
}
}

Expand Down Expand Up @@ -990,7 +990,7 @@ hooks:
assert_eq!(repos[0].global_hooks.get_hooks("before_backup").len(), 1);
assert_eq!(repos[0].global_hooks.get_hooks("finally_backup").len(), 1);
assert_eq!(repos[0].global_hooks.get_hooks("after").len(), 1);
assert!(repos[0].global_hooks.get_hooks("before").is_empty());
assert_eq!(repos[0].global_hooks.get_hooks("before").len(), 0);
}

#[test]
Expand All @@ -1004,8 +1004,8 @@ repositories:
fs::write(&path, yaml).unwrap();

let repos = load_and_resolve(&path).unwrap();
assert!(repos[0].global_hooks.is_empty());
assert!(repos[0].repo_hooks.is_empty());
assert_eq!(repos[0].global_hooks.hooks.len(), 0);
assert_eq!(repos[0].repo_hooks.hooks.len(), 0);
}

#[test]
Expand All @@ -1025,7 +1025,7 @@ repositories:
fs::write(&path, yaml).unwrap();

let repos = load_and_resolve(&path).unwrap();
assert!(repos[0].global_hooks.is_empty());
assert_eq!(repos[0].global_hooks.hooks.len(), 0);
assert_eq!(repos[0].repo_hooks.get_hooks("before").len(), 1);
assert_eq!(repos[0].repo_hooks.get_hooks("finally").len(), 1);
}
Expand Down Expand Up @@ -1330,13 +1330,13 @@ sources:
fs::write(&path, yaml).unwrap();

let repos = load_and_resolve(&path).unwrap();
assert!(repos[0].config.exclude_if_present.is_empty());
assert_eq!(repos[0].config.exclude_if_present.len(), 0);
assert!(!repos[0].config.one_file_system);
assert!(!repos[0].config.git_ignore);
assert!(repos[0].config.xattrs.enabled);

let src = &repos[0].sources[0];
assert!(src.exclude_if_present.is_empty());
assert_eq!(src.exclude_if_present.len(), 0);
assert!(!src.one_file_system);
assert!(!src.git_ignore);
assert!(src.xattrs_enabled);
Expand Down Expand Up @@ -1452,8 +1452,8 @@ sources:
let hooks = &repos[0].sources[0].hooks;
assert_eq!(hooks.before, vec!["echo single"]);
assert_eq!(hooks.after, vec!["echo first", "echo second"]);
assert!(hooks.failed.is_empty());
assert!(hooks.finally.is_empty());
assert_eq!(hooks.failed.len(), 0);
assert_eq!(hooks.finally.len(), 0);
}

#[test]
Expand Down Expand Up @@ -1494,7 +1494,7 @@ repositories:
fs::write(&path, yaml).unwrap();

let repos = load_and_resolve(&path).unwrap();
assert!(repos[0].sources.is_empty());
assert_eq!(repos[0].sources.len(), 0);
}

#[test]
Expand Down Expand Up @@ -1815,7 +1815,7 @@ sources:

let repos = load_and_resolve(&path).unwrap();
let source = &repos[0].sources[0];
assert!(source.paths.is_empty());
assert_eq!(source.paths.len(), 0);
assert_eq!(source.label, "databases");
assert_eq!(source.command_dumps.len(), 1);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/config/resolve/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ mod tests {
// With repositories commented out, resolve_document should return an empty vec.
let raw = parsed.unwrap();
let result = resolve_document(raw).unwrap();
assert!(result.is_empty(), "expected empty vec for template config");
assert_eq!(result.len(), 0, "expected empty vec for template config");
}
}
12 changes: 6 additions & 6 deletions crates/vykar-core/src/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ mod tests {
#[test]
fn pending_journal_round_trip() {
let mut journal = PendingIndexJournal::new();
assert!(journal.is_empty());
assert_eq!(journal.len(), 0);
assert_eq!(journal.len(), 0);

let pack1 = make_pack_id(1);
Expand Down Expand Up @@ -543,7 +543,7 @@ mod tests {
);

assert_eq!(journal.len(), 2);
assert!(!journal.is_empty());
assert_ne!(journal.len(), 0);

// Serialize → deserialize round-trip
let wire = journal.to_wire();
Expand Down Expand Up @@ -604,7 +604,7 @@ mod tests {

let reconciled = delta.reconcile(&fresh).unwrap();
// new_entries should be empty (converted to bump)
assert!(reconciled.new_entries.is_empty());
assert_eq!(reconciled.new_entries.len(), 0);
// refcount_bumps should have chunk_a with count=1
assert_eq!(reconciled.refcount_bumps.get(&chunk_a), Some(&1));
}
Expand Down Expand Up @@ -636,7 +636,7 @@ mod tests {
delta.bump_refcount(&chunk_a);

let reconciled = delta.reconcile(&fresh).unwrap();
assert!(reconciled.new_entries.is_empty());
assert_eq!(reconciled.new_entries.len(), 0);
assert_eq!(reconciled.refcount_bumps.get(&chunk_a), Some(&1));
}

Expand Down Expand Up @@ -699,8 +699,8 @@ mod tests {
let mut delta = IndexDelta::new();
delta.add_new_entry(make_chunk_id(1), 100, make_pack_id(1), 0, 1);
delta.rollback(cp);
assert!(delta.new_entries.is_empty());
assert!(delta.refcount_bumps.is_empty());
assert_eq!(delta.new_entries.len(), 0);
assert_eq!(delta.refcount_bumps.len(), 0);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/vykar-core/src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ mod tests {
let response = wrapped
.server_verify_packs(&plan)
.expect("verify forwarded");
assert!(response.results.is_empty());
assert_eq!(response.results.len(), 0);
wrapped.server_init().expect("init forwarded");

assert_eq!(verify_calls.load(Ordering::SeqCst), 1);
Expand Down
Loading
Loading