fix25: исправлена идемпотентность swap и удаления default qdisc

This commit is contained in:
2026-05-12 14:24:02 +05:00
parent a64fae7fe6
commit ead1130e5f
2 changed files with 9 additions and 1 deletions
+4 -1
View File
@@ -339,7 +339,7 @@ fn render_fstab_line(path: &Path, priority: i32) -> String {
fn enable_desired_swap(desired: &DesiredSwap) -> anyhow::Result<()> {
let active = read_active_swaps()?;
if let Some(found) = active.iter().find(|v| v.name == desired.path)
&& found.size_bytes == desired.size_bytes
&& active_swap_size_matches(found.size_bytes, desired.size_bytes)
&& found.priority == desired.priority
{
return Ok(());
@@ -553,8 +553,11 @@ mod tests {
#[test]
fn active_swap_size_accepts_mkswap_usable_size_delta() {
// Debian 13: swapon may report 4096 bytes less than file size.
assert!(active_swap_size_matches(2147479552, 2147483648));
assert!(active_swap_size_matches(2147483648, 2147483648));
assert!(!active_swap_size_matches(2146435072, 2147483648));
assert!(!active_swap_size_matches(2147487744, 2147483648));
}
#[test]