Skip to content

Commit 4e6e0d4

Browse files
committed
Fix testLogsSlowInboundProcessing (elastic#121895)
This test creates an incorrectly-serialized handshake which cannot be validated, and elastic#121747 made that validation compulsory. This test corrects the serialization. Closes elastic#121816
1 parent d71fd86 commit 4e6e0d4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,12 @@ public void testLogsSlowInboundProcessing() throws Exception {
290290
);
291291
BytesStreamOutput byteData = new BytesStreamOutput();
292292
TaskId.EMPTY_TASK_ID.writeTo(byteData);
293-
TransportVersion.writeVersion(remoteVersion, byteData);
293+
// simulate bytes of a transport handshake: vInt transport version then release version string
294+
try (var payloadByteData = new BytesStreamOutput()) {
295+
TransportVersion.writeVersion(remoteVersion, payloadByteData);
296+
payloadByteData.writeString(randomIdentifier());
297+
byteData.writeBytesReference(payloadByteData.bytes());
298+
}
294299
final InboundMessage requestMessage = new InboundMessage(
295300
requestHeader,
296301
ReleasableBytesReference.wrap(byteData.bytes()),

0 commit comments

Comments
 (0)