Skip to content

Commit

Permalink
Fix task manager tests, use reserved port range (#81979) (#81988)
Browse files Browse the repository at this point in the history
TransportTasksActionTests#testFailedTasksCount would rarely fail, with
symptoms looking like an external client connecting and doing a
handshake. Now switch to using the test worker specific port range.

Relates #69731
  • Loading branch information
henningandersen committed Dec 21, 2021
1 parent bdada63 commit a76d824
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.transport.TransportSettings;
import org.elasticsearch.transport.nio.MockNioTransport;
import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -78,8 +79,12 @@ public void setupTestNodes(Settings settings) {
public void setupTestNodes(Settings settings, Version version) {
nodesCount = randomIntBetween(2, 10);
testNodes = new TestNode[nodesCount];
final Settings reservedPortRangeSettings = Settings.builder()
.put(TransportSettings.PORT.getKey(), getPortRange())
.put(settings)
.build();
for (int i = 0; i < testNodes.length; i++) {
testNodes[i] = new TestNode("node" + i, threadPool, version, settings);
testNodes[i] = new TestNode("node" + i, threadPool, version, reservedPortRangeSettings);
}
}

Expand Down

0 comments on commit a76d824

Please sign in to comment.