clnrm_core/testing/
mod.rs1#[cfg(test)]
7pub mod property_generators;
8
9use crate::error::Result;
11
12#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
14pub struct FrameworkTestResults {
15 pub total_tests: u32,
17 pub passed_tests: u32,
19 pub failed_tests: u32,
21 pub total_duration_ms: u64,
23 pub test_results: Vec<TestResult>,
25}
26
27#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
29pub struct TestResult {
30 pub name: String,
32 pub passed: bool,
34 pub duration_ms: u64,
36 pub error: Option<String>,
38}
39
40pub async fn run_framework_tests() -> Result<FrameworkTestResults> {
42 let start_time = std::time::Instant::now();
43 let mut results = FrameworkTestResults {
44 total_tests: 0,
45 passed_tests: 0,
46 failed_tests: 0,
47 total_duration_ms: 0,
48 test_results: Vec::new(),
49 };
50
51 results.total_tests += 1;
53 let test_start = std::time::Instant::now();
54 match test_container_execution().await {
55 Ok(_) => {
56 results.passed_tests += 1;
57 results.test_results.push(TestResult {
58 name: "Container Execution".to_string(),
59 passed: true,
60 duration_ms: test_start.elapsed().as_millis() as u64,
61 error: None,
62 });
63 }
64 Err(e) => {
65 results.failed_tests += 1;
66 results.test_results.push(TestResult {
67 name: "Container Execution".to_string(),
68 passed: false,
69 duration_ms: test_start.elapsed().as_millis() as u64,
70 error: Some(e.to_string()),
71 });
72 }
73 }
74
75 results.total_tests += 1;
77 let test_start = std::time::Instant::now();
78 match test_plugin_system().await {
79 Ok(_) => {
80 results.passed_tests += 1;
81 results.test_results.push(TestResult {
82 name: "Plugin System".to_string(),
83 passed: true,
84 duration_ms: test_start.elapsed().as_millis() as u64,
85 error: None,
86 });
87 }
88 Err(e) => {
89 results.failed_tests += 1;
90 results.test_results.push(TestResult {
91 name: "Plugin System".to_string(),
92 passed: false,
93 duration_ms: test_start.elapsed().as_millis() as u64,
94 error: Some(e.to_string()),
95 });
96 }
97 }
98
99 results.total_duration_ms = start_time.elapsed().as_millis() as u64;
100 Ok(results)
101}
102
103async fn test_container_execution() -> Result<()> {
104 Ok(())
106}
107
108async fn test_plugin_system() -> Result<()> {
109 Ok(())
111}