mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
306 lines
7.3 KiB
JSON
306 lines
7.3 KiB
JSON
[
|
|
{
|
|
"name": "bare pipeline marker",
|
|
"code": "// pipeline\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "pipeline keyword with trailing text is not a marker",
|
|
"code": "// pipeline for billing\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "asset triggers across kinds, duplicates deduped",
|
|
"code": "-- pipeline\n-- on datatable://main/orders\n-- on s3://bucket/raw.parquet\n-- on ducklake://lake/events\n-- on datatable://main/orders\nSELECT 1;",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": [
|
|
"datatable:main/orders",
|
|
"s3object:bucket/raw.parquet",
|
|
"ducklake:lake/events"
|
|
],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "native trigger markers",
|
|
"code": "# pipeline\n# on kafka\n# on schedule\n# on data_upload\nprint(1)",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": [],
|
|
"native_triggers": ["kafka", "schedule", "data_upload"],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "native keyword must be a whole word and end the line",
|
|
"code": "// on kafkalike\n// on kafka topic-extra\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "partitioned daily with options",
|
|
"code": "// pipeline\n// partitioned daily tz=Europe/Paris format=%Y-%m-%d start=2024-01-01\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": {
|
|
"kind": "daily",
|
|
"tz": "Europe/Paris",
|
|
"format": "%Y-%m-%d",
|
|
"start": "2024-01-01"
|
|
},
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "partitioned dynamic requires key, quoted values parse",
|
|
"code": "// partitioned dynamic key=\"customer id\"\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": {
|
|
"kind": "dynamic",
|
|
"key": "customer id",
|
|
"tz": null,
|
|
"format": null,
|
|
"start": null
|
|
},
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "partitioned with unknown kind is rejected",
|
|
"code": "// partitioned fortnightly\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "partitioned keyword does not match partition prefix",
|
|
"code": "// partition daily\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "freshness and tag, first value wins on duplicates",
|
|
"code": "# pipeline\n# freshness 1h\n# freshness 2h\n# tag heavy\n# tag light\nprint(1)",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": "1h",
|
|
"tag": "heavy",
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "retry with count and delay",
|
|
"code": "// pipeline\n// retry 3 5s\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": { "count": 3, "delay": "5s" }
|
|
}
|
|
},
|
|
{
|
|
"name": "retry count only",
|
|
"code": "// retry 2\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": { "count": 2, "delay": null }
|
|
}
|
|
},
|
|
{
|
|
"name": "retry zero or malformed count is rejected",
|
|
"code": "// retry 0\n// retry 3foo\n// retry -1\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "annotations only count inside comments",
|
|
"code": "on datatable://main/raw\npipeline\nconst s = 'on s3://bucket/x'\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "partition token preserved in trigger path",
|
|
"code": "// pipeline\n// on s3://bucket/daily/{partition}/data.parquet\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": ["s3object:bucket/daily/{partition}/data.parquet"],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "leading whitespace and mixed comment prefixes",
|
|
"code": " -- pipeline\n\t-- on datatable://main/x\nSELECT 1;",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": ["datatable:main/x"],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "on with empty or unparseable spec is ignored",
|
|
"code": "// on\n// on \n// on notaprefix/foo\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
},
|
|
{
|
|
"name": "materialize managed (default) with merge key",
|
|
"code": "// pipeline\n// materialize ducklake://analytics/orders_daily key=order_id\nSELECT 1;",
|
|
"expected": {
|
|
"in_pipeline": true,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null,
|
|
"materialize": {
|
|
"target_kind": "ducklake",
|
|
"target_path": "analytics/orders_daily",
|
|
"unique_key": "order_id"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "materialize manual escape hatch, first value wins",
|
|
"code": "// materialize manual ducklake://analytics/orders_daily\n// materialize ducklake://other/x\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null,
|
|
"materialize": {
|
|
"target_kind": "ducklake",
|
|
"target_path": "analytics/orders_daily",
|
|
"manual": true
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "materialize default-syntax shorthand with append",
|
|
"code": "// materialize ducklake append\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null,
|
|
"materialize": {
|
|
"target_kind": "ducklake",
|
|
"target_path": "main",
|
|
"append": true
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "materialize manual with no target is dropped",
|
|
"code": "// materialize manual\nexport function main() {}",
|
|
"expected": {
|
|
"in_pipeline": false,
|
|
"asset_triggers": [],
|
|
"native_triggers": [],
|
|
"partition": null,
|
|
"freshness": null,
|
|
"tag": null,
|
|
"retry": null
|
|
}
|
|
}
|
|
]
|