Apache Software Foundation / SeaTunnel
Merged upstreamTestingMerged Oct 3, 2026

Stabilize the GA4 oversized-response test

Made one GA4 mock handler tolerate the expected body-write failure that occurs after the reader rejects an oversized response from its Content-Length header.

apache/seatunnel · #12471

Cross-platform CI reliability

The Google Analytics 4 connector test no longer reports a mock-server failure when the client correctly aborts an oversized HTTP response.

Problem

The reader correctly rejected a 2,048-byte response against a 1,024-byte limit and aborted the connection before reading the body. The mock server still attempted to write that body, racing the client abort and test teardown; Broken pipe, connection-reset, or stream-closed errors were then misclassified as mock contract failures in unrelated pull requests.

Approach

The oversized-response test now sends its headers directly and catches only the IOException from the expected body write. Assertions for the size-limit error, exactly one request, no retry, and no completion signal remain unchanged, while every other mock handler retains strict failure reporting.

Impact and scope

  • Removes a reproduced flaky-test source from Linux and Windows pull-request validation.
  • Keeps the production size-limit behavior and all reader assertions unchanged.
  • Scopes exception tolerance to the one mock write whose failure is an expected result of the client abort.
  • Avoids weakening the shared mock-server failure mechanism used by the connector's other tests.
  • Changes test code only; no connector runtime, API, retry, or configuration behavior was modified.

Validation

  • The unchanged test failed 6 times across 900 stressed JDK 8 and JDK 11 iterations; the patched test completed 300 of 300 iterations on each JDK without failure.
  • A forced race failed 20 of 20 times per JDK before the change and 0 of 20 after it; the connector module passed 23 tests and Spotless on JDK 8 and JDK 11.
  • The hosted matrix passed the affected Windows and Linux lanes, an Apache SeaTunnel member approved the final authored change, and the merged record changes one test file only.