Skip to content
Merged
Changes from 1 commit
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 @@ -645,7 +645,7 @@ public void testNetworkThreadTimeRecorded() throws Exception {

String message = TestUtils.randomString(1024 * 1024);
NetworkTestUtils.waitForChannelReady(selector, node);
KafkaChannel channel = selector.channel(node);
final KafkaChannel channel = selector.channel(node);
assertTrue("SSL handshake time not recorded", channel.getAndResetNetworkThreadTimeNanos() > 0);
assertEquals("Time not reset", 0, channel.getAndResetNetworkThreadTimeNanos());

Expand All @@ -661,10 +661,20 @@ public void testNetworkThreadTimeRecorded() throws Exception {
assertEquals(0, selector.completedReceives().size());

selector.unmute(node);
while (selector.completedReceives().isEmpty()) {
selector.poll(100L);
assertEquals(0, selector.numStagedReceives(channel));
}
// Wait for echo server to send the message back
TestUtils.waitForCondition(new TestCondition() {
@Override
public boolean conditionMet() {
try {
selector.poll(100L);
assertEquals(0, selector.numStagedReceives(channel));
} catch (IOException e) {
return false;
}
return selector.completedReceives().size() > 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use !isEmpty() instead of .size()?

@omkreddy omkreddy Apr 3, 2018

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajinisivaram Thanks for the review. test is failing most of the times. I will create JIRA with relevant logs.

}
}, "Timed out waiting for a message to receive from echo server");

long receiveTimeNanos = channel.getAndResetNetworkThreadTimeNanos();
assertTrue("Receive time not recorded: " + receiveTimeNanos, receiveTimeNanos > 0);
}
Expand Down