You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by he...@apache.org on 2026/09/20 04:57:21 UTC

(airflow) branch main updated: Assert the panic value in TestNewContextRejectsNilArgs (#73372)

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

henry3260 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 61db43fba9a Assert the panic value in TestNewContextRejectsNilArgs (#73372)
61db43fba9a is described below

commit 61db43fba9ac86a6f35df19ffd985278b97b4c1b
Author: Jason(Zhe-You) Liu <68...@users.noreply.github.com>
AuthorDate: Sun Sep 20 12:57:11 2026 +0800

    Assert the panic value in TestNewContextRejectsNilArgs (#73372)
---
 go-sdk/airflow/context_test.go | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/go-sdk/airflow/context_test.go b/go-sdk/airflow/context_test.go
index 2e6b4504685..38a3973fcbe 100644
--- a/go-sdk/airflow/context_test.go
+++ b/go-sdk/airflow/context_test.go
@@ -68,14 +68,22 @@ func TestNewContextAccessors(t *testing.T) {
 func TestNewContextRejectsNilArgs(t *testing.T) {
 	logger, client, ti, dagRun := testValues()
 
+	// Keyed by the expected panic value: context.WithValue panics on a nil ctx
+	// by itself, so asserting the value is what pins the check to ours.
 	cases := map[string]func(){
-		"nil context": func() { NewContext(nil, logger, client, ti, dagRun) },
-		"nil logger":  func() { NewContext(context.Background(), nil, client, ti, dagRun) },
-		"nil client":  func() { NewContext(context.Background(), logger, nil, ti, dagRun) },
+		"airflow.NewContext: nil context.Context": func() {
+			NewContext(nil, logger, client, ti, dagRun)
+		},
+		"airflow.NewContext: nil logger": func() {
+			NewContext(context.Background(), nil, client, ti, dagRun)
+		},
+		"airflow.NewContext: nil client": func() {
+			NewContext(context.Background(), logger, nil, ti, dagRun)
+		},
 	}
-	for name, build := range cases {
-		t.Run(name, func(t *testing.T) {
-			assert.Panics(t, build)
+	for want, build := range cases {
+		t.Run(want, func(t *testing.T) {
+			assert.PanicsWithValue(t, want, build)
 		})
 	}
 }