fix25: исправлена идемпотентность swap и удаления default qdisc
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user