aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 11:06:46 +01:00
parent df99318392
commit 86e7c72e5f
10383 changed files with 749164 additions and 749170 deletions

View File

@@ -0,0 +1,32 @@
//! Tests maintenance ownership across shared guards and duplicated file handles.
use std::io;
use std::sync::Arc;
use tempfile::TempDir;
use super::try_acquire_rollout_maintenance_lock;
#[test]
fn dropping_last_guard_releases_lock_with_duplicated_handle() -> io::Result<()> {
let home = TempDir::new()?;
let guard = Arc::new(
try_acquire_rollout_maintenance_lock(home.path())?.expect("acquire maintenance lock"),
);
let retained_guard = Arc::clone(&guard);
let duplicated_file = guard.file.try_clone()?;
assert!(try_acquire_rollout_maintenance_lock(home.path())?.is_none());
drop(guard);
assert!(try_acquire_rollout_maintenance_lock(home.path())?.is_none());
drop(retained_guard);
let next_guard = try_acquire_rollout_maintenance_lock(home.path())?
.expect("dropping the last guard releases the lock despite the duplicated handle");
drop(duplicated_file);
assert!(try_acquire_rollout_maintenance_lock(home.path())?.is_none());
drop(next_guard);
assert!(try_acquire_rollout_maintenance_lock(home.path())?.is_some());
Ok(())
}