Skip to content

Commit 7034252

Browse files
committed
Fix version confusion in testHandshakeRequestFutureVersionsCompatibility (elastic#121883)
Today we use the ID from `Version#CURRENT` in this test, which only works if its ID is no less than that of `TranportVersion#current()`. This commit fixes the test to ensure it always picks a transport version ID that is not from the past.
1 parent ddd80c5 commit 7034252

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

server/src/test/java/org/elasticsearch/transport/TransportHandshakerTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
package org.elasticsearch.transport;
1010

1111
import org.elasticsearch.TransportVersion;
12-
import org.elasticsearch.Version;
1312
import org.elasticsearch.action.support.PlainActionFuture;
1413
import org.elasticsearch.cluster.node.DiscoveryNode;
1514
import org.elasticsearch.cluster.node.DiscoveryNodeUtils;
@@ -144,7 +143,7 @@ public void testHandshakeRequestFutureVersionsCompatibility() throws IOException
144143
TaskId.EMPTY_TASK_ID.writeTo(lengthCheckingHandshake);
145144
TaskId.EMPTY_TASK_ID.writeTo(futureHandshake);
146145
try (BytesStreamOutput internalMessage = new BytesStreamOutput()) {
147-
Version.writeVersion(Version.CURRENT, internalMessage);
146+
internalMessage.writeVInt(TransportVersion.current().id() + between(0, 100));
148147
lengthCheckingHandshake.writeBytesReference(internalMessage.bytes());
149148
internalMessage.write(new byte[1024]);
150149
futureHandshake.writeBytesReference(internalMessage.bytes());

0 commit comments

Comments
 (0)