On Thu, 27 Aug 2026 12:28:05 GMT, Lee Jiwon <[email protected]> wrote:

>> Replaces the fixed delay in `IsAvailable.java` with reads from the socket 
>> used by `HttpClient::available`.
>> The tests wait for EOF or data on that socket before invoking the existing 
>> `HttpClient::available` assertion.
>> 
>> No production code is changed.
>> 
>> Testing:
>> - `make test TEST='test/jdk/sun/net/www/http/HttpClient/IsAvailable.java' 
>> JTREG='REPEAT_COUNT=200;VERBOSE=summary;RETAIN=fail'` (200/200 passed)
>> - `make test TEST='test/jdk/sun/net/www/http/HttpClient/IsAvailable.java' 
>> JTREG='VERBOSE=summary;RETAIN=fail;VM_OPTIONS=-Dsun.net.client.defaultReadTimeout=200'`
>>  (passed)
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Lee Jiwon has refreshed the contents of this pull request, and previous 
> commits have been removed. The incremental views will show differences 
> compared to the previous content of the PR. The pull request contains one new 
> commit since the last revision:
> 
>   8390064: Stabilize IsAvailable test

Dropped some remarks for the comments. In overall, the changes LGTM. I will run 
this through our internal CI and share the outcome.

(Please don't force-push!)

test/jdk/sun/net/www/http/HttpClient/IsAvailable.java line 125:

> 123:             // not consume data needed by the assertion.
> 124:             assertEquals(-1, infra.readFromHttpClientSocket(),
> 125:                     "Expected EOF after closing the peer socket");

Suggestion:

            // Closing the server socket may not immediately be observable by
            // the client. Read from the client's _internal_ socket to ensure
            // that EOF, which is necessary for the `HttpClient::available`
            // verification, has arrived.
            assertEquals(
                    -1, infra.readFromHttpClientSocket(),
                    "Expected EOF after closing the server socket");

test/jdk/sun/net/www/http/HttpClient/IsAvailable.java line 154:

> 152:             // `HttpClient::available` probe below.
> 153:             assertTrue(infra.readFromHttpClientSocket() >= 0,
> 154:                     "Expected unexpected data on the client socket");

Suggestion:

            // Writing to the server socket may not immediately be observable
            // by the client. Read from the client's _internal_ socket to ensure
            // that the data, which is necessary for the `HttpClient::available`
            // verification, has arrived.
            assertTrue(
                    infra.readFromHttpClientSocket() >= 0,
                    "Unexpected data should have arrived to the client socket");

-------------

PR Review: https://git.openjdk.org/jdk/pull/32539#pullrequestreview-5049355896
PR Review Comment: https://git.openjdk.org/jdk/pull/32539#discussion_r3879204513
PR Review Comment: https://git.openjdk.org/jdk/pull/32539#discussion_r3879136892

Reply via email to