Skip to content

Extract Bootstrap and ServerBootstrap setup to a common method (#15134) - #17289

Merged
normanmaurer merged 1 commit into
4.1from
ch_41
Aug 14, 2026
Merged

normanmaurer merged 1 commit into
4.1from
ch_41

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

This commit refactors the FixedChannelPoolTest class to extract the
repetitive setup of Bootstrap and ServerBootstrap into a private
bootstrap() method. This improves code readability and reduces
redundancy across multiple test methods.

Motivation:

The FixedChannelPoolTest class contained repetitive code for setting
up Bootstrap and ServerBootstrap instances in multiple test methods.

This will also reduce the effort to create new tests that are coming as
part of

Modification:

A new private method bootstrap() was introduced within the
FixedChannelPoolTest class. This method encapsulates the creation and
configuration of a LocalAddress, a Bootstrap configured for
LocalChannel, and a ServerBootstrap configured for
LocalServerChannel.

This commit refactors the `FixedChannelPoolTest` class to extract the
repetitive setup of Bootstrap and ServerBootstrap into a private
`bootstrap()` method. This improves code readability and reduces
redundancy across multiple test methods.

**Motivation:**

The `FixedChannelPoolTest` class contained repetitive code for setting
up `Bootstrap` and `ServerBootstrap` instances in multiple test methods.

This will also reduce the effort to create new tests that are coming as
part of
* #14723
* #15133

**Modification:**

A new private method `bootstrap()` was introduced within the
`FixedChannelPoolTest` class. This method encapsulates the creation and
configuration of a `LocalAddress`, a `Bootstrap` configured for
`LocalChannel`, and a `ServerBootstrap` configured for
`LocalServerChannel`.
@normanmaurer

Copy link
Copy Markdown
Member Author

Cherry-pick 817c7aa to make things easier to port back to 4.1

@normanmaurer
normanmaurer merged commit 7ce3782 into 4.1 Aug 14, 2026
16 of 18 checks passed
@normanmaurer normanmaurer added this to the 4.1.138.Final milestone Aug 14, 2026
@normanmaurer
normanmaurer deleted the ch_41 branch August 14, 2026 14:40
@testlens-app

testlens-app Bot commented Aug 14, 2026

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

Build PR / linux-x86_64-java21 build > Netty/Testsuite

Test Runs Flakiness
DatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) ❌ 1% 🟡

🏷️ Commit: c9bf6fa
▶️ Tests: 338239 executed
🟡 Checks: 17/19 completed

Test Failures

DatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) (Netty/Testsuite in Build PR / linux-x86_64-java21 build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:352)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:184)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:113)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:104)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:101)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:101)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

Muted Tests

Note

Checks are currently running using the configuration below.

Select tests to mute in this pull request:

🔲 DatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo)

Reuse successful test results:

🔲 ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

🔲 Rerun jobs


Learn more about TestLens at testlens.app.

lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…#15134) (netty#17289)

This commit refactors the `FixedChannelPoolTest` class to extract the
repetitive setup of Bootstrap and ServerBootstrap into a private
`bootstrap()` method. This improves code readability and reduces
redundancy across multiple test methods.

**Motivation:**

The `FixedChannelPoolTest` class contained repetitive code for setting
up `Bootstrap` and `ServerBootstrap` instances in multiple test methods.

This will also reduce the effort to create new tests that are coming as
part of
* netty#14723
* netty#15133

**Modification:**

A new private method `bootstrap()` was introduced within the
`FixedChannelPoolTest` class. This method encapsulates the creation and
configuration of a `LocalAddress`, a `Bootstrap` configured for
`LocalChannel`, and a `ServerBootstrap` configured for
`LocalServerChannel`.

Co-authored-by: Diego Lovison <[email protected]>
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.

2 participants