fix: rename overview.md files to avoid conflicts and add collection name
This commit is contained in:
@@ -139,22 +139,14 @@ async fn test_02_simple_heroscript() {
|
||||
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 complete
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||
|
||||
// Check job status
|
||||
let status = client.get_status(&job_id).await.expect("Failed to get job status");
|
||||
println!("Job status: {:?}", status);
|
||||
|
||||
// Get result or error
|
||||
if let Some(result) = client.get_result(&job_id).await.expect("Failed to get result") {
|
||||
println!("Job result: {}", result);
|
||||
}
|
||||
if let Some(error) = client.get_error(&job_id).await.expect("Failed to get error") {
|
||||
println!("Job error: {}", error);
|
||||
match client.job_run_wait(&job, RUNNER_ID, 5).await {
|
||||
Ok(result) => {
|
||||
println!("✅ Job succeeded with result:\n{}", result);
|
||||
}
|
||||
Err(e) => {
|
||||
println!("❌ Job failed with error: {:?}", e);
|
||||
panic!("Job execution failed");
|
||||
}
|
||||
}
|
||||
|
||||
println!("✅ Heroscript job completed");
|
||||
@@ -180,11 +172,19 @@ async fn test_03_job_with_env_vars() {
|
||||
|
||||
// Check job status
|
||||
let status = client.get_status(&job_id).await.expect("Failed to get job status");
|
||||
println!("Job status: {:?}", status);
|
||||
println!("📊 Job status: {:?}", status);
|
||||
|
||||
// Get result
|
||||
if let Some(result) = client.get_result(&job_id).await.expect("Failed to get result") {
|
||||
println!("Job result: {}", result);
|
||||
// Get result or error
|
||||
match (client.get_result(&job_id).await, client.get_error(&job_id).await) {
|
||||
(Ok(Some(result)), _) => {
|
||||
println!("✅ Job succeeded with result:\n{}", result);
|
||||
}
|
||||
(_, Ok(Some(error))) => {
|
||||
println!("❌ Job failed with error:\n{}", error);
|
||||
}
|
||||
_ => {
|
||||
println!("⚠️ No result or error available");
|
||||
}
|
||||
}
|
||||
|
||||
println!("✅ Job with env vars completed");
|
||||
@@ -196,8 +196,13 @@ async fn test_04_job_timeout() {
|
||||
|
||||
let client = create_client().await;
|
||||
|
||||
// Create job with short timeout
|
||||
let mut job = create_test_job("sleep 10");
|
||||
// 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
|
||||
let job_id = job.id.clone();
|
||||
|
||||
@@ -210,15 +215,17 @@ async fn test_04_job_timeout() {
|
||||
|
||||
// Check job status - should be error due to timeout
|
||||
let status = client.get_status(&job_id).await.expect("Failed to get job status");
|
||||
println!("Job status: {:?}", 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): {}", 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");
|
||||
} else {
|
||||
println!("⚠️ Expected timeout error but got none");
|
||||
panic!("Job should have timed out");
|
||||
}
|
||||
|
||||
println!("✅ Job timeout handled correctly");
|
||||
}
|
||||
|
||||
/// Final test that ensures cleanup happens
|
||||
|
||||
Reference in New Issue
Block a user