ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/

add test for force_always_local

+32
+2
tests/rust/non_trivial_hive/hive.nix
··· 35 35 source = "hi"; 36 36 }; 37 37 38 + deployment.buildOnTarget = true; 39 + 38 40 nixpkgs.hostPlatform = "x86_64-linux"; 39 41 }; 40 42 }
+30
wire/lib/src/hive/mod.rs
··· 195 195 upload_at: UploadKeyAt::PreActivation, 196 196 environment: im::HashMap::new() 197 197 }], 198 + build_remotely: true, 198 199 ..Default::default() 199 200 }; 200 201 ··· 270 271 }) 271 272 if logs.contains("The option `deployment._keys' is read-only, but it's set multiple times.") 272 273 ); 274 + } 275 + 276 + #[tokio::test] 277 + async fn test_force_always_local() { 278 + let mut location: PathBuf = env::var("WIRE_TEST_DIR").unwrap().into(); 279 + location.push("non_trivial_hive"); 280 + let location = location!(location); 281 + 282 + let mut hive = Hive::new_from_path(&location, SubCommandModifiers::default()) 283 + .await 284 + .unwrap(); 285 + 286 + assert_matches!( 287 + hive.force_always_local(vec!["non-existant".to_string()]), 288 + Err(HiveLibError::HiveInitializationError( 289 + HiveInitializationError::NodeDoesNotExist(node) 290 + )) if node == "non-existant" 291 + ); 292 + 293 + for node in hive.nodes.values() { 294 + assert!(node.build_remotely); 295 + } 296 + 297 + assert_matches!( 298 + hive.force_always_local(vec!["node-a".to_string()]), 299 + Ok(()) 300 + ); 301 + 302 + assert!(!hive.nodes.get(&Name("node-a".into())).unwrap().build_remotely); 273 303 } 274 304 }