Add explicit vocabulary and named operation contexts

This commit is contained in:
2026-10-29 22:41:38 +02:00
parent ede45d224a
commit 8413b382b1
14 changed files with 344 additions and 241 deletions
+6 -10
View File
@@ -6,7 +6,7 @@ use wireguard_admin::app::{AppError, Application};
use wireguard_admin::backup::{BackupReason, preview_archive, preview_archive_bytes};
use wireguard_admin::config::{ResolvedSettings, SettingsFile};
use wireguard_admin::domain::{
Client, ClientAddresses, ClientStates, PublicKey, RuntimeObservation, Snapshot,
ApplyStatus, Client, ClientAddresses, ClientStates, PublicKey, Snapshot,
};
use wireguard_admin::persistence::{PersistedState, SavedStore};
use wireguard_admin::vault::{VaultBundle, WireGuardPrivateKey};
@@ -75,12 +75,8 @@ fn fixture(with_client: bool) -> Fixture {
)
.expect("server fixture is private");
let snapshot = Snapshot::new(clients).expect("initial snapshot");
let states = ClientStates::new(
snapshot.clone(),
Some(snapshot),
RuntimeObservation::Verified,
)
.expect("initial states");
let states = ClientStates::new(snapshot.clone(), Some(snapshot), ApplyStatus::Verified)
.expect("initial states");
let store = SavedStore::new(root.path(), settings.clone()).expect("saved store");
Fixture {
root,
@@ -240,7 +236,7 @@ fn restore_reserves_addresses_of_current_saved_clients_that_the_archive_removes(
.expect("new client");
app.add_client(client, None).expect("stage client");
app.commit().expect("save client");
assert_eq!(app.states().applied(), &RuntimeObservation::Unknown);
assert_eq!(app.states().applied(), &ApplyStatus::Unknown);
let preview = app
.preview_restore(archive_name(&empty_archive))
@@ -264,7 +260,7 @@ fn restore_reserves_addresses_of_current_saved_clients_that_the_archive_removes(
.contains(&"fd20::9".to_owned())
);
assert_eq!(app.states().applied(), &RuntimeObservation::Unknown);
assert_eq!(app.states().applied(), &ApplyStatus::Unknown);
assert!(
app.states()
.reserved_addresses()
@@ -520,5 +516,5 @@ fn deletion_uses_public_key_and_removes_only_that_vault_record() {
.expect("vault parses");
assert!(!bundle.contains_record(fixture.key));
assert!(bundle.contains_record(retained_key));
assert_eq!(app.states().applied(), &RuntimeObservation::Unknown);
assert_eq!(app.states().applied(), &ApplyStatus::Unknown);
}