fix: Fix opnsense test, Host.tll now optional and run cargo fmt

This commit is contained in:
Jean-Gabriel Gill-Couture 2025-05-06 12:00:56 -04:00
parent 1fb7132c64
commit e62ef001ed
7 changed files with 35 additions and 22 deletions

View File

@ -6,8 +6,8 @@ lazy_static! {
.unwrap()
.data_dir()
.join("harmony");
pub static ref REGISTRY_URL: String = std::env::var("HARMONY_REGISTRY_URL")
.unwrap_or_else(|_| "hub.nationtech.io".to_string());
pub static ref REGISTRY_URL: String =
std::env::var("HARMONY_REGISTRY_URL").unwrap_or_else(|_| "hub.nationtech.io".to_string());
pub static ref REGISTRY_PROJECT: String =
std::env::var("HARMONY_REGISTRY_PROJECT").unwrap_or_else(|_| "harmony".to_string());
}

View File

@ -370,10 +370,13 @@ mod tests {
let result = get_servers_for_backend(&backend, &haproxy);
// Check the result
assert_eq!(result, vec![BackendServer {
assert_eq!(
result,
vec![BackendServer {
address: "192.168.1.1".to_string(),
port: 80,
},]);
},]
);
}
#[test]
fn test_get_servers_for_backend_no_linked_servers() {
@ -430,7 +433,9 @@ mod tests {
// Call the function
let result = get_servers_for_backend(&backend, &haproxy);
// Check the result
assert_eq!(result, vec![
assert_eq!(
result,
vec![
BackendServer {
address: "some-hostname.test.mcd".to_string(),
port: 80,
@ -439,6 +444,7 @@ mod tests {
address: "192.168.1.2".to_string(),
port: 8080,
},
]);
]
);
}
}

View File

@ -166,7 +166,11 @@ impl DhcpInterpret {
InterpretStatus::SUCCESS,
format!(
"Dhcp Interpret Set next boot to [{:?}], boot_filename to [{:?}], filename to [{:?}], filename64 to [{:?}], filenameipxe to [:{:?}]",
self.score.boot_filename, self.score.boot_filename, self.score.filename, self.score.filename64, self.score.filenameipxe
self.score.boot_filename,
self.score.boot_filename,
self.score.filename,
self.score.filename64,
self.score.filenameipxe
),
))
}

View File

@ -3,6 +3,7 @@ pub mod dns;
pub mod dummy;
pub mod helm;
pub mod http;
pub mod ipxe;
pub mod k3d;
pub mod k8s;
pub mod lamp;
@ -10,4 +11,3 @@ pub mod load_balancer;
pub mod okd;
pub mod opnsense;
pub mod tftp;
pub mod ipxe;

View File

@ -46,7 +46,10 @@ impl OKDBootstrapDhcpScore {
None, // To allow UEFI boot we cannot provide a legacy file
Some("undionly.kpxe".to_string()),
Some("ipxe.efi".to_string()),
Some(format!("http://{}:8080/boot.ipxe", topology.router.get_gateway())),
Some(format!(
"http://{}:8080/boot.ipxe",
topology.router.get_gateway()
)),
),
}
}

View File

@ -1223,7 +1223,7 @@ pub struct Host {
pub rr: String,
pub mxprio: MaybeString,
pub mx: MaybeString,
pub ttl: MaybeString,
pub ttl: Option<MaybeString>,
pub server: String,
pub description: Option<String>,
}
@ -1238,7 +1238,7 @@ impl Host {
rr,
server,
mxprio: MaybeString::default(),
ttl: MaybeString::default(),
ttl: Some(MaybeString::default()),
mx: MaybeString::default(),
description: None,
}