Skip to content

chore(rest): Avoid fatal assertions in test handlers - #2103

Merged
laskoviymishka merged 6 commits into
apache:mainfrom
alessandro-nori:anori/rest-test-handler-hygiene
Oct 5, 2026
Merged

laskoviymishka merged 6 commits into
apache:mainfrom
alessandro-nori:anori/rest-test-handler-hygiene

Conversation

@alessandro-nori

@alessandro-nori alessandro-nori commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • replace fatal require and FailNow assertions reachable from catalog/rest HTTP handler goroutines with non-fatal assertions
  • return from handlers immediately after assertion failures when later statements depend on the assertion
  • extend special-character request coverage to create, register, commit, and update table writes

Motivation

Fatal assertions call FailNow and runtime.Goexit. When invoked from an httptest handler goroutine, they terminate HTTP request processing rather than the test goroutine. That can close the connection before a response is completed and surface a misleading transport EOF in the client.

Non-fatal assertions preserve the original handler failure while allowing net/http to finish request cleanup normally.

The expanded request test also pins that a b+c remains raw in JSON bodies while object-name path segments are encoded as a%20b%2Bc, addressing follow-up feedback from #2074.

Testing

  • make lint
  • go test ./catalog/...
  • go test -race ./catalog/rest

@alessandro-nori
alessandro-nori force-pushed the anori/rest-test-handler-hygiene branch from b4792c2 to 24fe2ad Compare October 2, 2026 20:26
@alessandro-nori alessandro-nori changed the title chore(rest): Avoid fatal handler assertions chore(rest): Avoid fatal assertions in test handlers Oct 2, 2026
@alessandro-nori
alessandro-nori marked this pull request as ready for review October 2, 2026 20:37

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The handler conversions are correct, and the a b+c test catches an encoded body name in all four write paths. There are two leftover fatal calls in handlers (inline); please fix them here or in a quick follow-up.


This review was drafted by an AI-assisted tool and
confirmed by an Apache Iceberg maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Iceberg handles maintainer review:
CONTRIBUTING.md.

Comment thread catalog/rest/rest_functions_test.go Resolved
Comment thread catalog/rest/scan_planning_test.go Resolved

@laskoviymishka laskoviymishka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@laskoviymishka
laskoviymishka merged commit c1dad7f into apache:main Oct 5, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants