[ https://issues.apache.org/jira/browse/KAFKA-7513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16652026#comment-16652026 ]
ASF GitHub Bot commented on KAFKA-7513: --------------------------------------- rajinisivaram closed pull request #5805: KAFKA-7513: Fix timing issue in SaslAuthenticatorFailureDelayTest URL: https://github.com/apache/kafka/pull/5805 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/clients/src/test/java/org/apache/kafka/common/network/NetworkTestUtils.java b/clients/src/test/java/org/apache/kafka/common/network/NetworkTestUtils.java index b08c8c19a87..e6c0eda6f41 100644 --- a/clients/src/test/java/org/apache/kafka/common/network/NetworkTestUtils.java +++ b/clients/src/test/java/org/apache/kafka/common/network/NetworkTestUtils.java @@ -28,7 +28,6 @@ import org.apache.kafka.common.security.auth.SecurityProtocol; import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.security.authenticator.CredentialCache; -import org.apache.kafka.common.utils.MockTime; import org.apache.kafka.common.utils.Time; import org.apache.kafka.common.utils.Utils; import org.apache.kafka.test.TestUtils; @@ -87,7 +86,7 @@ public static void waitForChannelReady(Selector selector, String node) throws IO assertTrue(selector.isChannelReady(node)); } - public static ChannelState waitForChannelClose(Selector selector, String node, ChannelState.State channelState, MockTime mockTime) + public static ChannelState waitForChannelClose(Selector selector, String node, ChannelState.State channelState) throws IOException { boolean closed = false; for (int i = 0; i < 300; i++) { @@ -96,8 +95,6 @@ public static ChannelState waitForChannelClose(Selector selector, String node, C closed = true; break; } - if (mockTime != null) - mockTime.setCurrentTimeMs(mockTime.milliseconds() + 150); } assertTrue("Channel was not closed by timeout", closed); ChannelState finalState = selector.disconnected().get(node); @@ -105,10 +102,6 @@ public static ChannelState waitForChannelClose(Selector selector, String node, C return finalState; } - public static ChannelState waitForChannelClose(Selector selector, String node, ChannelState.State channelState) throws IOException { - return waitForChannelClose(selector, node, channelState, null); - } - public static void completeDelayedChannelClose(Selector selector, long currentTimeNanos) { selector.completeDelayedChannelClose(currentTimeNanos); } diff --git a/clients/src/test/java/org/apache/kafka/common/network/NioEchoServer.java b/clients/src/test/java/org/apache/kafka/common/network/NioEchoServer.java index 76d37c26c67..68b3f9dc112 100644 --- a/clients/src/test/java/org/apache/kafka/common/network/NioEchoServer.java +++ b/clients/src/test/java/org/apache/kafka/common/network/NioEchoServer.java @@ -153,7 +153,7 @@ public void run() { try { acceptorThread.start(); while (serverSocketChannel.isOpen()) { - selector.poll(1000); + selector.poll(100); synchronized (newChannels) { for (SocketChannel socketChannel : newChannels) { String id = id(socketChannel); diff --git a/clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorFailureDelayTest.java b/clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorFailureDelayTest.java index b0dfc7a123b..c8e6edb4a44 100644 --- a/clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorFailureDelayTest.java +++ b/clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorFailureDelayTest.java @@ -53,8 +53,8 @@ @RunWith(value = Parameterized.class) public class SaslAuthenticatorFailureDelayTest { private static final int BUFFER_SIZE = 4 * 1024; - private static MockTime time = new MockTime(50); + private final MockTime time = new MockTime(10); private NioEchoServer server; private Selector selector; private ChannelBuilder channelBuilder; @@ -221,7 +221,7 @@ private ChannelState createAndCheckClientConnectionFailure(SecurityProtocol secu throws Exception { createClientConnection(securityProtocol, node); ChannelState finalState = NetworkTestUtils.waitForChannelClose(selector, node, - ChannelState.State.AUTHENTICATION_FAILED, time); + ChannelState.State.AUTHENTICATION_FAILED); selector.close(); selector = null; return finalState; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Flaky test SaslAuthenticatorFailureDelayTest.testInvalidPasswordSaslPlain > ------------------------------------------------------------------------- > > Key: KAFKA-7513 > URL: https://issues.apache.org/jira/browse/KAFKA-7513 > Project: Kafka > Issue Type: Bug > Components: security > Affects Versions: 2.1.0 > Reporter: Rajini Sivaram > Assignee: Rajini Sivaram > Priority: Major > Fix For: 2.1.0 > > > Have seen this test fail quite a few times in PR builds (e.g. > https://builds.apache.org/job/kafka-pr-jdk11-scala2.12/123): > {code} > java.lang.AssertionError: expected:<AUTHENTICATION_FAILED> but was:<EXPIRED> > at org.junit.Assert.fail(Assert.java:88) > at org.junit.Assert.failNotEquals(Assert.java:834) > at org.junit.Assert.assertEquals(Assert.java:118) > at org.junit.Assert.assertEquals(Assert.java:144) > at > org.apache.kafka.common.network.NetworkTestUtils.waitForChannelClose(NetworkTestUtils.java:114) > at > org.apache.kafka.common.security.authenticator.SaslAuthenticatorFailureDelayTest.createAndCheckClientConnectionFailure(SaslAuthenticatorFailureDelayTest.java:223) > at > org.apache.kafka.common.security.authenticator.SaslAuthenticatorFailureDelayTest.createAndCheckClientAuthenticationFailure(SaslAuthenticatorFailureDelayTest.java:212) > at > org.apache.kafka.common.security.authenticator.SaslAuthenticatorFailureDelayTest.testInvalidPasswordSaslPlain(SaslAuthenticatorFailureDelayTest.java:115) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)