File tree Expand file tree Collapse file tree 1 file changed +0
-25
lines changed
logstash-core/src/test/java/org/logstash/common Expand file tree Collapse file tree 1 file changed +0
-25
lines changed Original file line number Diff line number Diff line change @@ -135,29 +135,4 @@ public void givenFragmentThatHasTheSecondTokenOverrunsSizeLimitThenAnErrorIsThro
135135 // third token resumes
136136 assertEquals ("ccc" , tokensIterator .next ());
137137 }
138-
139- @ Test
140- public void givenTooLongInputExtractDoesntOverflow () {
141- assertEquals ("Xmx must equals to what's defined in the Gradle's javaTests task" ,
142- 12L * GB , Runtime .getRuntime ().maxMemory ());
143-
144- // re-init the tokenizer with big sizeLimit
145- initSUTWithSizeLimit ((int ) ((2L * GB ) - 3 ));
146- // Integer.MAX_VALUE is 2 * GB
147- String bigFirstPiece = generateString ("a" , Integer .MAX_VALUE - 1024 );
148- sut .extract (bigFirstPiece );
149-
150- // add another small fragment to trigger int overflow
151- // sizeLimit is (2^32-1)-3 first segment length is (2^32-1) - 1024 second is 1024 +2
152- // so the combined length of first and second is > sizeLimit and should throw an expection
153- // but because of overflow it's negative and happens to be < sizeLimit
154- Exception thrownException = assertThrows (IllegalStateException .class , () -> {
155- sut .extract (generateString ("a" , 1024 + 2 )).iterator ().next ();
156- });
157- assertThat (thrownException .getMessage (), containsString ("input buffer full" ));
158- }
159-
160- private String generateString (String fill , int size ) {
161- return fill .repeat (size );
162- }
163138}
You can’t perform that action at this time.
0 commit comments