Add coordinator client library, installation scripts, and new test runners

- Add coordinator client library to workspace
- Add installation documentation and heroscript
- Add new test runners for Osiris and Sal
- Update hero runner test to handle invalid heroscript errors
- Update README with installation instructions
This commit is contained in:
Timur Gordon
2025-11-17 10:56:13 +01:00
parent c95be9339e
commit f66edba1d3
12 changed files with 1650 additions and 17 deletions

View File

@@ -191,40 +191,37 @@ async fn test_03_job_with_env_vars() {
}
#[tokio::test]
async fn test_04_job_timeout() {
println!("\n🧪 Test: Job Timeout");
async fn test_04_invalid_heroscript() {
println!("\n🧪 Test: Invalid Heroscript Error Handling");
let client = create_client().await;
// Create job with short timeout - use a heroscript that loops forever
let mut job = create_test_job(r#"
for i in 1..1000 {
print("Loop iteration: ${i}")
sleep(100)
}
"#);
job.timeout = 2; // 2 second timeout
// Create job with invalid heroscript syntax
let job = create_test_job("!!invalid.command.that.does.not.exist");
let job_id = job.id.clone();
// Save and queue job
client.store_job_in_redis(&job).await.expect("Failed to save job");
client.job_run(&job_id, RUNNER_ID).await.expect("Failed to queue job");
// Wait for job to timeout
// Wait for job to complete
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
// Check job status - should be error due to timeout
// Check job status - should be error due to invalid command
let status = client.get_status(&job_id).await.expect("Failed to get job status");
println!("📊 Job status: {:?}", status);
// Should have error
if let Some(error) = client.get_error(&job_id).await.expect("Failed to get error") {
println!("❌ Job error (expected timeout):\n{}", error);
assert!(error.contains("timeout") || error.contains("timed out"), "Error should mention timeout");
println!("✅ Job timeout handled correctly");
println!("❌ Job error (expected):\n{}", error);
println!("✅ Invalid heroscript error handled correctly");
} else {
println!("⚠️ Expected timeout error but got none");
panic!("Job should have timed out");
println!("⚠️ Expected error for invalid heroscript but got none");
// Check if there's a result instead
if let Some(result) = client.get_result(&job_id).await.expect("Failed to get result") {
println!("Got result instead: {}", result);
}
panic!("Job with invalid heroscript should have failed");
}
}