pub mod bridges;
pub mod certmesh;
pub mod orchestrator;
pub mod cores;
pub mod status;
#[cfg(test)]
mod parity_tests {
use std::sync::Arc;
use tokio::task::JoinHandle;
use tokio_util::sync::CancellationToken;
fn test_certmesh() -> Arc<koi_certmesh::CertmeshCore> {
let dir = std::env::temp_dir().join(format!("koi-compose-parity-{}", std::process::id()));
let paths = koi_certmesh::CertmeshPaths::with_data_dir(dir);
Arc::new(koi_certmesh::CertmeshCore::uninitialized_with_paths(paths))
}
fn test_runtime() -> Arc<koi_runtime::RuntimeCore> {
Arc::new(koi_runtime::RuntimeCore::new(koi_runtime::RuntimeConfig {
backend_kind: koi_runtime::RuntimeBackendKind::Auto,
socket_path: None,
}))
}
#[tokio::test]
async fn certmesh_role_loops_spawn_four_tasks_regardless_of_mdns() {
let certmesh = test_certmesh();
let cancel = CancellationToken::new();
let mut tasks: Vec<JoinHandle<()>> = Vec::new();
crate::certmesh::spawn_certmesh_background_tasks(
&certmesh, None, 5641, &cancel, &mut tasks,
);
assert_eq!(tasks.len(), 4, "expected the 4 certmesh role loops");
cancel.cancel();
for task in tasks {
let _ = task.await;
}
}
#[tokio::test]
async fn windows_parity_full_task_inventory() {
let certmesh = test_certmesh();
let runtime = test_runtime();
let cancel = CancellationToken::new();
let mut tasks: Vec<JoinHandle<()>> = Vec::new();
crate::certmesh::spawn_enrollment_approval(
&certmesh,
crate::certmesh::deny_and_log_decider(),
&cancel,
&mut tasks,
)
.await;
crate::certmesh::spawn_certmesh_background_tasks(
&certmesh, None, 5641, &cancel, &mut tasks,
);
tasks.push(crate::orchestrator::spawn_orchestrator(
&runtime,
crate::orchestrator::OrchestrationTargets {
mdns: None,
dns: None,
health: None,
proxy: None,
},
cancel.clone(),
));
assert_eq!(
tasks.len(),
6,
"Windows parity: 1 approval + 4 certmesh loops + 1 orchestrator"
);
cancel.cancel();
for task in tasks {
let _ = task.await;
}
}
}