forked from NationTech/harmony
chore: Cargo fmt
This commit is contained in:
parent
15785dd219
commit
2229e9d7af
@ -14,10 +14,10 @@ use super::DnsServer;
|
||||
use super::Firewall;
|
||||
use super::HttpServer;
|
||||
use super::IpAddress;
|
||||
use super::K8sclient;
|
||||
use super::LoadBalancer;
|
||||
use super::LoadBalancerService;
|
||||
use super::LogicalHost;
|
||||
use super::K8sclient;
|
||||
use super::Router;
|
||||
use super::TftpServer;
|
||||
|
||||
@ -48,7 +48,9 @@ impl Topology for HAClusterTopology {
|
||||
todo!()
|
||||
}
|
||||
async fn ensure_ready(&self) -> Result<Outcome, InterpretError> {
|
||||
todo!("ensure_ready, not entirely sure what it should do here, probably something like verify that the hosts are reachable and all services are up and ready.")
|
||||
todo!(
|
||||
"ensure_ready, not entirely sure what it should do here, probably something like verify that the hosts are reachable and all services are up and ready."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,11 @@ use log::{info, warn};
|
||||
use tokio::sync::OnceCell;
|
||||
|
||||
use crate::{
|
||||
interpret::{InterpretError, Outcome}, inventory::Inventory, maestro::Maestro, modules::k3d::K3DInstallationScore, topology::LocalhostTopology
|
||||
interpret::{InterpretError, Outcome},
|
||||
inventory::Inventory,
|
||||
maestro::Maestro,
|
||||
modules::k3d::K3DInstallationScore,
|
||||
topology::LocalhostTopology,
|
||||
};
|
||||
|
||||
use super::{Topology, k8s::K8sClient};
|
||||
|
||||
@ -15,6 +15,8 @@ impl Topology for LocalhostTopology {
|
||||
}
|
||||
|
||||
async fn ensure_ready(&self) -> Result<Outcome, InterpretError> {
|
||||
Ok(Outcome::success("Localhost is Chuck Norris, always ready.".to_string()))
|
||||
Ok(Outcome::success(
|
||||
"Localhost is Chuck Norris, always ready.".to_string(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@ mod host_binding;
|
||||
mod http;
|
||||
mod k8s_anywhere;
|
||||
mod localhost;
|
||||
pub use localhost::*;
|
||||
pub use k8s_anywhere::*;
|
||||
mod load_balancer;
|
||||
pub use localhost::*;
|
||||
pub mod k8s;
|
||||
mod load_balancer;
|
||||
mod router;
|
||||
mod tftp;
|
||||
use async_trait::async_trait;
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
mod install;
|
||||
pub use install::*;
|
||||
|
||||
|
||||
@ -2,10 +2,10 @@ pub mod dhcp;
|
||||
pub mod dns;
|
||||
pub mod dummy;
|
||||
pub mod http;
|
||||
pub mod k3d;
|
||||
pub mod k8s;
|
||||
pub mod lamp;
|
||||
pub mod load_balancer;
|
||||
pub mod okd;
|
||||
pub mod opnsense;
|
||||
pub mod tftp;
|
||||
pub mod k3d;
|
||||
|
||||
@ -142,20 +142,20 @@ mod tests {
|
||||
|
||||
TEST_SERVER.get_or_init(|| {
|
||||
let listener = TcpListener::bind(format!("127.0.0.1:{}", TEST_SERVER_PORT)).unwrap();
|
||||
|
||||
|
||||
thread::spawn(move || {
|
||||
for stream in listener.incoming() {
|
||||
thread::spawn(move || {
|
||||
let mut stream = stream.expect("Stream opened correctly");
|
||||
let mut buffer = [0; 1024];
|
||||
let _ = stream.read(&mut buffer);
|
||||
|
||||
|
||||
let response = format!(
|
||||
"HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nContent-Length: {}\r\n\r\n{}",
|
||||
TEST_CONTENT.len(),
|
||||
TEST_CONTENT
|
||||
);
|
||||
|
||||
|
||||
stream.write_all(response.as_bytes()).expect("Can write to stream");
|
||||
stream.flush().expect("Can flush stream");
|
||||
});
|
||||
@ -203,7 +203,7 @@ mod tests {
|
||||
|
||||
let folder = PathBuf::from(&test.download_path);
|
||||
let result = asset.download_to_path(folder).await.unwrap();
|
||||
|
||||
|
||||
let downloaded_content = std::fs::read_to_string(result).unwrap();
|
||||
assert_eq!(downloaded_content, TEST_CONTENT);
|
||||
}
|
||||
@ -212,7 +212,7 @@ mod tests {
|
||||
async fn test_download_to_path_already_exists() {
|
||||
let test = setup_test();
|
||||
let folder = PathBuf::from(&test.download_path);
|
||||
|
||||
|
||||
let asset = DownloadableAsset {
|
||||
url: Url::parse(&format!("http://{}/test.txt", test.domain)).unwrap(),
|
||||
file_name: "test.txt".to_string(),
|
||||
@ -230,14 +230,16 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn test_download_to_path_failure() {
|
||||
let test = setup_test();
|
||||
|
||||
|
||||
let asset = DownloadableAsset {
|
||||
url: Url::parse("http://127.0.0.1:9999/test.txt").unwrap(),
|
||||
file_name: "test.txt".to_string(),
|
||||
checksum: "some_checksum".to_string(),
|
||||
};
|
||||
|
||||
let result = asset.download_to_path(PathBuf::from(&test.download_path)).await;
|
||||
let result = asset
|
||||
.download_to_path(PathBuf::from(&test.download_path))
|
||||
.await;
|
||||
assert!(result.is_err());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user