lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

consumer_migration.rs (1432B)


      1 use std::{fs, path::Path};
      2 
      3 const RETIRED: &[&str] = &[
      4     "secret_vault",
      5     "protected_store",
      6     "nostr_accounts",
      7     "runtime",
      8     "simplex_agent_store",
      9 ];
     10 
     11 #[test]
     12 fn predecessor_secret_packages_and_consumers_are_removed() {
     13     let workspace = Path::new(env!("CARGO_MANIFEST_DIR"))
     14         .parent()
     15         .and_then(Path::parent)
     16         .expect("workspace root");
     17     let manifest = fs::read_to_string(workspace.join("Cargo.toml")).expect("workspace manifest");
     18 
     19     for package in RETIRED {
     20         assert!(!workspace.join("crates").join(package).exists());
     21         assert!(!manifest.contains(&format!("\"crates/{package}\"")));
     22         assert!(!manifest.contains(&format!("radroots_{package} =")));
     23     }
     24 }
     25 
     26 #[test]
     27 fn active_manifests_use_only_the_final_secret_owner() {
     28     let crates = Path::new(env!("CARGO_MANIFEST_DIR"))
     29         .parent()
     30         .expect("crates root");
     31     for entry in fs::read_dir(crates).expect("crates directory") {
     32         let manifest = entry.expect("crate entry").path().join("Cargo.toml");
     33         if !manifest.is_file() {
     34             continue;
     35         }
     36         let source = fs::read_to_string(&manifest).expect("crate manifest");
     37         for retired in ["radroots_secret_vault", "radroots_protected_store"] {
     38             assert!(
     39                 !source.contains(retired),
     40                 "{} retains {retired}",
     41                 manifest.display()
     42             );
     43         }
     44     }
     45 }