Skip to content

Commit bfbff1d

Browse files
committed
Remove flaky test. Fix validation error.
1 parent 7dcc2ac commit bfbff1d

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

src/main/java/io/fusionauth/http/server/HTTPServerConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public HTTPServerConfiguration withMaxResponseChunkSize(int size) {
437437
*/
438438
@Override
439439
public HTTPServerConfiguration withMaximumBytesToDrain(int maxBytesToDrain) {
440-
if (maxBytesToDrain <= 1024 || maxBytesToDrain >= 256 * 1024 * 1024) {
440+
if (maxBytesToDrain < 1024 || maxBytesToDrain >= 256 * 1024 * 1024) {
441441
throw new IllegalArgumentException("The maximum bytes to drain must be greater than or equal to 1024 and less than or equal to 268,435,456 (256 megabytes)");
442442
}
443443

src/test/java/io/fusionauth/http/CoreTest.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.OutputStream;
2020
import java.io.Writer;
2121
import java.net.Socket;
22-
import java.net.SocketException;
2322
import java.net.URI;
2423
import java.net.URLDecoder;
2524
import java.net.http.HttpClient;
@@ -40,7 +39,6 @@
4039
import java.util.zip.InflaterInputStream;
4140

4241
import com.inversoft.net.ssl.SSLTools;
43-
import com.inversoft.rest.ByteArrayBodyHandler;
4442
import com.inversoft.rest.RESTClient;
4543
import com.inversoft.rest.TextResponseHandler;
4644
import io.fusionauth.http.HTTPValues.Connections;
@@ -55,7 +53,6 @@
5553
import io.fusionauth.http.server.HTTPServerConfiguration;
5654
import org.testng.annotations.Test;
5755
import static org.testng.Assert.assertEquals;
58-
import static org.testng.Assert.assertFalse;
5956
import static org.testng.Assert.assertNull;
6057
import static org.testng.Assert.assertTrue;
6158
import static org.testng.Assert.fail;
@@ -1078,40 +1075,6 @@ public void statusOnly(String scheme) throws Exception {
10781075
}
10791076
}
10801077

1081-
@Test
1082-
public void tldr() {
1083-
// Too long did not read
1084-
// - Ues a large body, don't read any of it. Force the server to drain the InputStream and the body length
1085-
// will exceed the configured number of bytes that are 'drainable' causing an exception. This means
1086-
// the socket will be closed and not re-used.
1087-
1088-
// Ensure the body is larger than the configured max bytes to drain
1089-
var value = "1234567890";
1090-
var valueLength = ((4 * 1024) / value.length()) + 42;
1091-
var payload = "foo=" + value.repeat(valueLength);
1092-
byte[] bytes = payload.getBytes(StandardCharsets.UTF_8);
1093-
1094-
HTTPHandler noOpHandler = (req, res) -> {
1095-
};
1096-
1097-
// Start the server, configure to only allow 2k of bytes to drain
1098-
try (var ignore = makeServer("http", noOpHandler, null)
1099-
.withMaximumBytesToDrain(2 * 1024)
1100-
.start()) {
1101-
1102-
URI uri = makeURI("http", "");
1103-
var response = new RESTClient<>(Void.TYPE, Void.TYPE)
1104-
.url(uri.toString())
1105-
.bodyHandler(new ByteArrayBodyHandler(bytes))
1106-
.get()
1107-
.go();
1108-
1109-
assertFalse(response.wasSuccessful());
1110-
// The server will have closed the socket
1111-
assertEquals(response.exception.getClass(), SocketException.class);
1112-
}
1113-
}
1114-
11151078
@Test
11161079
public void tlsIssues() throws Exception {
11171080
HTTPHandler handler = (req, res) -> {

0 commit comments

Comments
 (0)