This is an automated email from the ASF dual-hosted git repository.

jason810496 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 5667fb5044b Skip the Go SDK rule constants test outside the Airflow 
repository (#76888)
5667fb5044b is described below

commit 5667fb5044b4ba0fe100c02aefc7ebd821930542
Author: Jason(Zhe-You) Liu <[email protected]>
AuthorDate: Wed Nov 11 15:46:33 2026 +0800

    Skip the Go SDK rule constants test outside the Airflow repository (#76888)
    
    TestRuleConstantsMatchPython reads the trigger rule and weight rule enums
    from airflow-core, so `go test ./...` failed in the Go SDK source package,
    which ships go-sdk alone.
---
 go-sdk/airflow/enums_test.go | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/go-sdk/airflow/enums_test.go b/go-sdk/airflow/enums_test.go
index 2cde5a791f4..48ffedb57d8 100644
--- a/go-sdk/airflow/enums_test.go
+++ b/go-sdk/airflow/enums_test.go
@@ -34,6 +34,10 @@ import (
 // enumsPath is the path, relative to this package, of the file that declares 
each enum.
 const enumsPath = "enums.go"
 
+// airflowCorePath is the path, relative to this package, of the airflow-core 
directory of the
+// Airflow repository.
+const airflowCorePath = "../../airflow-core"
+
 func readMatches(t *testing.T, path, pattern string) [][]string {
        t.Helper()
 
@@ -100,7 +104,13 @@ func toStrings[T ~string](values []T) []string {
 // checks. The test also compares triggerRules and weightRules with the Python 
enums.
 // checkTaskSpec accepts only the values in those lists, so an author cannot 
set a rule that the
 // lists leave out.
+//
+// The test skips outside the Airflow repository, such as in the SDK's source 
package, which has
+// no airflow-core directory.
 func TestRuleConstantsMatchPython(t *testing.T) {
+       if _, err := os.Stat(filepath.FromSlash(airflowCorePath)); 
os.IsNotExist(err) {
+               t.Skipf("%s not found: this test needs the Airflow repository", 
airflowCorePath)
+       }
        for _, tt := range []struct {
                goType     string
                pythonPath string
@@ -108,12 +118,12 @@ func TestRuleConstantsMatchPython(t *testing.T) {
        }{
                {
                        goType:     "TriggerRule",
-                       pythonPath: 
"../../airflow-core/src/airflow/task/trigger_rule.py",
+                       pythonPath: airflowCorePath + 
"/src/airflow/task/trigger_rule.py",
                        valid:      toStrings(triggerRules),
                },
                {
                        goType:     "WeightRule",
-                       pythonPath: 
"../../airflow-core/src/airflow/task/weight_rule.py",
+                       pythonPath: airflowCorePath + 
"/src/airflow/task/weight_rule.py",
                        valid:      toStrings(weightRules),
                },
        } {

Reply via email to