You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2026/10/02 20:54:17 UTC

Re: [PR] chore(rest): Avoid fatal assertions in test handlers [iceberg-go]

zeroshade commented on code in PR #2103:
URL: https://github.com/apache/iceberg-go/pull/2103#discussion_r4169751455


##########
catalog/rest/scan_planning_test.go:
##########
@@ -650,7 +680,9 @@ func TestFetchPlanningResultMapsNotFound(t *testing.T) {
 
 			cat := newScanPlanningTestCatalog(t, []endpoint{endpointFetchPlanResult}, func(mux *http.ServeMux) {
 				mux.HandleFunc("/v1/namespaces/db/tables/tbl/plan/plan-123", func(w http.ResponseWriter, req *http.Request) {
-					require.Equal(t, http.MethodGet, req.Method)
+					if !assert.Equal(t, http.MethodGet, req.Method) {
+						return
+					}
 					writeRESTNotFound(t, w, tc.errType)

Review Comment:
   `writeRESTNotFound` (line 1011) ends with `require.NoError` and runs inside this handler (also at :728, :771 and `wait_for_plan_test.go:174`). Switching it to `assert.NoError` fixes all four call sites.



##########
catalog/rest/rest_functions_test.go:
##########
@@ -102,7 +104,9 @@ func (r *RestCatalogSuite) TestListFunctions200() {
 func (r *RestCatalogSuite) TestListFunctionsPagination() {
 	namespace := "accounting"
 	r.mux.HandleFunc("/v1/namespaces/"+namespace+"/functions", func(w http.ResponseWriter, req *http.Request) {
-		r.Require().Equal(http.MethodGet, req.Method)
+		if !r.Equal(http.MethodGet, req.Method) {

Review Comment:
   Missed spot: `r.FailNow(...)` on the unexpected-`pageToken` branch (line 122 here, also :208 and `rest_test.go:756`/`:2596`) still calls `t.FailNow()` from the handler goroutine. Each is the last statement in its handler, so `r.Fail(...)` is enough.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org