Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class Tls13SelectorTest extends SslSelectorTest {

Expand All @@ -47,11 +48,27 @@ protected Map<String, Object> createSslClientConfigs(File trustStoreFile) throws
return configs;
}

@Flaky(value = "KAFKA-14249", comment = "Copied from base class. Remove this override once the flakiness has been resolved.")
@Flaky(value = "KAFKA-14249", comment = "Stabilize TLSv1.3 idle expiry by waiting for READY and allowing a short observe window.")
@Test
@Override
public void testCloseOldestConnection() throws Exception {
super.testCloseOldestConnection();
String id = "0";
selector.connect(id, new InetSocketAddress("localhost", server.port), BUFFER_SIZE, BUFFER_SIZE);
NetworkTestUtils.waitForChannelReady(selector, id);
selector.poll(50);
time.sleep(10_000L);
TestUtils.waitForCondition(() -> {
try {
selector.poll(50);
} catch (IOException e) {
throw new RuntimeException(e);
}
ChannelState state = selector.disconnected().get(id);
return state == ChannelState.EXPIRED;
}, 30_000L, "Expected idle connection to expire");

assertTrue(selector.disconnected().containsKey(id), "The idle connection should have been closed");
assertEquals(ChannelState.EXPIRED, selector.disconnected().get(id));
}

/**
Expand Down