mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
fix forloop empty no step afterward
This commit is contained in:
+38
-1
@@ -1390,7 +1390,6 @@ def main():
|
||||
assert_eq!(result, serde_json::json!("hello world"));
|
||||
}
|
||||
|
||||
|
||||
#[sqlx::test(fixtures("base"))]
|
||||
async fn test_empty_loop(db: DB) {
|
||||
initialize_tracing().await;
|
||||
@@ -1443,6 +1442,44 @@ def main():
|
||||
assert_eq!(result, serde_json::json!(0));
|
||||
}
|
||||
|
||||
#[sqlx::test(fixtures("base"))]
|
||||
async fn test_empty_loop_2(db: DB) {
|
||||
initialize_tracing().await;
|
||||
|
||||
let flow: FlowValue = serde_json::from_value(serde_json::json!({
|
||||
"modules": [
|
||||
{
|
||||
"value": {
|
||||
"type": "forloopflow",
|
||||
"iterator": { "type": "static", "value": [] },
|
||||
"value": {
|
||||
"modules": [
|
||||
{
|
||||
"input_transform": {
|
||||
"n": {
|
||||
"type": "javascript",
|
||||
"expr": "previous_result.iter.value",
|
||||
},
|
||||
},
|
||||
"value": {
|
||||
"type": "rawscript",
|
||||
"language": "python3",
|
||||
"content": "def main(n): return n",
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
}))
|
||||
.unwrap();
|
||||
|
||||
let flow = JobPayload::RawFlow { value: flow, path: None };
|
||||
let result = run_job_in_new_worker_until_complete(&db, flow).await;
|
||||
|
||||
assert_eq!(result, serde_json::json!([]));
|
||||
}
|
||||
|
||||
#[sqlx::test(fixtures("base"))]
|
||||
async fn test_step_after_loop(db: DB) {
|
||||
|
||||
@@ -550,6 +550,24 @@ async fn push_next_flow_job(
|
||||
push_next_flow_job(&new_job, flow, schedule_path, db, json!([])).await?,
|
||||
);
|
||||
} else {
|
||||
add_completed_job(
|
||||
db,
|
||||
&new_job,
|
||||
true,
|
||||
false,
|
||||
json!([]),
|
||||
"Forloop completed without iteration".to_string(),
|
||||
)
|
||||
.await?;
|
||||
postprocess_queued_job(
|
||||
false,
|
||||
new_job.schedule_path,
|
||||
new_job.script_path,
|
||||
&new_job.workspace_id,
|
||||
new_job.id,
|
||||
db,
|
||||
)
|
||||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user