|
|
@@ -351,6 +351,11 @@ ib_disable = 0
|
|
|
|
|
|
[before_serve."extra"]
|
|
|
commands = ["echo hi"]
|
|
|
+
|
|
|
+[home_assistant]
|
|
|
+url = "http://ha.lan:8123"
|
|
|
+token = "sufficiently-long-test-token"
|
|
|
+shutdown_delay_seconds = 30
|
|
|
"#,
|
|
|
)
|
|
|
.unwrap();
|
|
|
@@ -378,11 +383,26 @@ commands = ["echo hi"]
|
|
|
assert!(cfg.clusters.iter().any(|c| c.name == "extra"));
|
|
|
assert!(cfg.nccl.contains_key("extra"));
|
|
|
assert!(cfg.before_serve.contains_key("extra"));
|
|
|
- // A main-config ssh_user is never overridden by a source.
|
|
|
+ // HA config merges from the source when main has none (power on from
|
|
|
+ // other cwds depends on this).
|
|
|
+ assert!(cfg.home_assistant.is_some(), "home_assistant filled from source");
|
|
|
+ assert_eq!(cfg.home_assistant.as_ref().unwrap().url, "http://ha.lan:8123");
|
|
|
+ // A main-config ssh_user is never overridden by a source; same rule
|
|
|
+ // for home_assistant.
|
|
|
let mut cfg2 = tcfg();
|
|
|
cfg2.cluster_sources = vec![src_path.to_string_lossy().into_owned()];
|
|
|
+ cfg2.home_assistant = Some(crate::config::HomeAssistantConfig {
|
|
|
+ url: "http://main-ha:8123".into(),
|
|
|
+ token: "main".into(),
|
|
|
+ shutdown_delay_seconds: 5,
|
|
|
+ });
|
|
|
merge_cluster_sources(&mut cfg2).await.unwrap();
|
|
|
assert_eq!(cfg2.ssh_user, "u", "main ssh_user wins over source");
|
|
|
+ assert_eq!(
|
|
|
+ cfg2.home_assistant.as_ref().unwrap().url,
|
|
|
+ "http://main-ha:8123",
|
|
|
+ "main home_assistant wins over source"
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
#[tokio::test]
|