forked from Michael-A-Kuykendall/rustchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_step_validation.rs
More file actions
87 lines (77 loc) · 2.98 KB
/
Copy pathtest_step_validation.rs
File metadata and controls
87 lines (77 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Simple test program to validate step type functionality
use rustchain::core::RuntimeContext;
use rustchain::engine::{DagExecutor, Mission, MissionStep, StepType};
use serde_json::json;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
println!("🔧 RustChain Step Type Validation");
println!("===================================");
// Create runtime context
let ctx = RuntimeContext::new();
// Test 1: Basic Noop Step
println!("\n📋 Test 1: Basic Noop Mission");
let noop_mission = Mission {
version: "1.0".to_string(),
name: "Noop Test Mission".to_string(),
description: Some("Test basic Noop step execution".to_string()),
steps: vec![MissionStep {
id: "noop_1".to_string(),
name: "Test Noop Step".to_string(),
step_type: StepType::Noop,
depends_on: None,
timeout_seconds: None,
continue_on_error: Some(false),
parameters: json!({}),
}],
config: None,
};
match DagExecutor::execute_mission(noop_mission, &ctx).await {
Ok(result) => println!(
" ✅ Noop mission succeeded: {} steps",
result.step_results.len()
),
Err(e) => println!(" ❌ Noop mission failed: {}", e),
}
// Test 2: Step Type Availability Survey (reduced set)
println!("\n📋 Test 2: Core Step Type Survey");
let test_step_types = vec![
(StepType::Noop, "Noop"),
(StepType::Command, "Command"),
(StepType::CreateFile, "CreateFile"),
(StepType::Http, "HTTP"),
];
let mut implemented_count = 0;
let mut not_implemented_count = 0;
for (step_type, type_name) in test_step_types {
let test_mission = Mission {
version: "1.0".to_string(),
name: format!("Test {} Mission", type_name),
description: Some(format!("Test {} step type", type_name)),
steps: vec![MissionStep {
id: format!("test_{}", type_name.replace(" ", "_").to_lowercase()),
name: format!("Test {}", type_name),
step_type: step_type.clone(),
depends_on: None,
timeout_seconds: Some(5), // 5 second timeout for tests
continue_on_error: Some(true),
parameters: json!({}),
}],
config: None,
};
match DagExecutor::execute_mission(test_mission, &ctx).await {
Ok(_) => {
implemented_count += 1;
println!(" ✅ {} - IMPLEMENTED", type_name);
}
Err(e) => {
not_implemented_count += 1;
println!(" 🚧 {} - NOT IMPLEMENTED: {}", type_name, e);
}
}
}
println!("\n📊 CORE STEP TYPE SUMMARY");
println!("=========================");
println!("✅ Implemented: {} step types", implemented_count);
println!("🚧 Not Implemented: {} step types", not_implemented_count);
Ok(())
}