Skip to content

Commit

Permalink
remove shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
ywangd committed Oct 18, 2024
1 parent b4b94c4 commit 456e42b
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Randomness;
import org.elasticsearch.common.bytes.ReleasableBytesReference;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.ClusterSettings;
Expand Down Expand Up @@ -73,7 +72,6 @@
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.transport.netty4.Netty4Utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.BlockingDeque;
Expand Down Expand Up @@ -179,18 +177,12 @@ public void testClientConnectionCloseMidStream() throws Exception {

assertFalse(handler.streamClosed);

final List<Runnable> runnables = new ArrayList<>(
List.of(
// terminate client connection
ctx.clientChannel::close,
// read the first half of the request
handler.stream::next,
// attempt to read more data and it should notice channel being closed eventually
handler.stream::next
)
);
Randomness.shuffle(runnables);
runnables.forEach(Runnable::run);
// terminate client connection
ctx.clientChannel.close();
// read the first half of the request
handler.stream.next();
// attempt to read more data and it should notice channel being closed eventually
handler.stream.next();

assertBusy(() -> {
assertNull(handler.stream.buf());
Expand Down

0 comments on commit 456e42b

Please sign in to comment.