jason810496 commented on code in PR #74667:
URL: https://github.com/apache/airflow/pull/74667#discussion_r4273312665
##########
go-sdk/cmd/airflow-go-pack/pack_test.go:
##########
@@ -481,6 +481,34 @@ func TestRunPack_PacksABundleWithNoDags(t *testing.T) {
assert.Contains(t, stdout.String(), "task_handler_dags=0,
native_dags=0")
}
+// --strict turns the "nothing registered" warning into a packing failure.
+func TestRunPack_StrictFailsWhenNoDagsRegistered(t *testing.T) {
+ dir := t.TempDir()
+ exe := filepath.Join(dir, "generated")
+ require.NoError(t, os.WriteFile(exe, []byte("generated-binary-bytes"),
0o755))
+ source := filepath.Join(dir, "main.go")
+ require.NoError(t, os.WriteFile(source, []byte("package main\nfunc
main() {}\n"), 0o644))
+ meta := filepath.Join(dir, "airflow-metadata.json")
+ require.NoError(t, os.WriteFile(meta, []byte(
+ `{"airflow_bundle_metadata_version":"1.0",`+
+
`"sdk":{"language":"go","version":"0.1.0","supervisor_schema_version":"2026-06-16"},`+
Review Comment:
```suggestion
`"sdk":{"language":"go","version":"0.1.0","supervisor_schema_version":"2026-10-30"},`+
```
##########
go-sdk/cmd/airflow-go-pack/pack.go:
##########
@@ -165,6 +166,13 @@ func runPack(stdout, stderr io.Writer, opts *packOptions)
error {
return err
}
if len(meta.Dags) == 0 && len(meta.DagSourceFiles) == 0 {
+ if opts.strict {
+ return fmt.Errorf(
+ "no Dags or task handlers were registered at
pack time; " +
+ "--strict requires at least one. Drop
--strict if the bundle " +
+ "generates its Dags at run time",
+ )
Review Comment:
IIUC, we didn't check the task handlers. We only check the "Dag" here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]