Skip to content
Merged
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 @@ -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().isEmpty();
}
}, "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