Jetty 10 - Improve test reliability (#8868)
* Don't care about stop failures in this test * More consistent ConnectTimeoutTest + using IANA example.com (as it will route to a real machine, and will never have this specific port open) Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
cd737489f9
commit
cf7353f274
|
@ -23,6 +23,7 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
|||
import org.eclipse.jetty.toolchain.test.PathAssert;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
@ -61,7 +62,7 @@ public class GlobalWebappConfigBindingTest
|
|||
public void teardownEnvironment() throws Exception
|
||||
{
|
||||
// Stop jetty.
|
||||
jetty.stop();
|
||||
LifeCycle.stop(jetty);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.jetty.http2.api.Session;
|
|||
import org.eclipse.jetty.http2.api.server.ServerSessionListener;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
@ -33,10 +34,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
public class ConnectTimeoutTest extends AbstractTest
|
||||
{
|
||||
@Test
|
||||
@Tag("external")
|
||||
public void testConnectTimeout() throws Exception
|
||||
{
|
||||
final String host = "10.255.255.1";
|
||||
final int port = 80;
|
||||
// Using IANA hosted example.com:81 to reliably produce a Connect Timeout.
|
||||
final String host = "example.com";
|
||||
final int port = 81;
|
||||
int connectTimeout = 1000;
|
||||
assumeConnectTimeout(host, port, connectTimeout);
|
||||
|
||||
|
|
|
@ -47,11 +47,13 @@ public class HttpClientConnectTimeoutTest extends AbstractTest<TransportScenario
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(TransportProvider.class)
|
||||
@Tag("external")
|
||||
public void testConnectTimeout(Transport transport) throws Exception
|
||||
{
|
||||
init(transport);
|
||||
final String host = "10.255.255.1";
|
||||
final int port = 80;
|
||||
// Using IANA hosted example.com:81 to reliably produce a Connect Timeout.
|
||||
final String host = "example.com";
|
||||
final int port = 81;
|
||||
int connectTimeout = 1000;
|
||||
assumeConnectTimeout(host, port, connectTimeout);
|
||||
|
||||
|
@ -74,11 +76,13 @@ public class HttpClientConnectTimeoutTest extends AbstractTest<TransportScenario
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(TransportProvider.class)
|
||||
@Tag("external")
|
||||
public void testConnectTimeoutIsCancelledByShorterRequestTimeout(Transport transport) throws Exception
|
||||
{
|
||||
init(transport);
|
||||
String host = "10.255.255.1";
|
||||
int port = 80;
|
||||
// Using IANA hosted example.com:81 to reliably produce a Connect Timeout.
|
||||
final String host = "example.com";
|
||||
final int port = 81;
|
||||
int connectTimeout = 2000;
|
||||
assumeConnectTimeout(host, port, connectTimeout);
|
||||
|
||||
|
@ -104,11 +108,13 @@ public class HttpClientConnectTimeoutTest extends AbstractTest<TransportScenario
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(TransportProvider.class)
|
||||
@Tag("external")
|
||||
public void retryAfterConnectTimeout(Transport transport) throws Exception
|
||||
{
|
||||
init(transport);
|
||||
final String host = "10.255.255.1";
|
||||
final int port = 80;
|
||||
// Using IANA hosted example.com:81 to reliably produce a Connect Timeout.
|
||||
final String host = "example.com";
|
||||
final int port = 81;
|
||||
int connectTimeout = 1000;
|
||||
assumeConnectTimeout(host, port, connectTimeout);
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.eclipse.jetty.util.IO;
|
|||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ArgumentsSource;
|
||||
import org.opentest4j.TestAbortedException;
|
||||
|
@ -282,6 +283,7 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(TransportProvider.class)
|
||||
@Tag("external")
|
||||
public void testBlockingConnectTimeoutFailsRequest(Transport transport) throws Exception
|
||||
{
|
||||
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
|
||||
|
@ -292,6 +294,7 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(TransportProvider.class)
|
||||
@Tag("external")
|
||||
public void testNonBlockingConnectTimeoutFailsRequest(Transport transport) throws Exception
|
||||
{
|
||||
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
|
||||
|
@ -302,8 +305,9 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
|||
|
||||
private void testConnectTimeoutFailsRequest(boolean blocking) throws Exception
|
||||
{
|
||||
String host = "10.255.255.1";
|
||||
int port = 80;
|
||||
// Using IANA hosted example.com:81 to reliably produce a Connect Timeout.
|
||||
final String host = "example.com";
|
||||
final int port = 81;
|
||||
int connectTimeout = 1000;
|
||||
assumeConnectTimeout(host, port, connectTimeout);
|
||||
|
||||
|
@ -329,6 +333,7 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(TransportProvider.class)
|
||||
@Tag("external")
|
||||
public void testConnectTimeoutIsCancelledByShorterRequestTimeout(Transport transport) throws Exception
|
||||
{
|
||||
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
|
||||
|
@ -336,8 +341,9 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
|||
|
||||
init(transport);
|
||||
|
||||
String host = "10.255.255.1";
|
||||
int port = 80;
|
||||
// Using IANA hosted example.com:81 to reliably produce a Connect Timeout.
|
||||
final String host = "example.com";
|
||||
final int port = 81;
|
||||
int connectTimeout = 2000;
|
||||
assumeConnectTimeout(host, port, connectTimeout);
|
||||
|
||||
|
@ -365,6 +371,7 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(TransportProvider.class)
|
||||
@Tag("external")
|
||||
public void testRetryAfterConnectTimeout(Transport transport) throws Exception
|
||||
{
|
||||
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
|
||||
|
@ -372,8 +379,9 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
|||
|
||||
init(transport);
|
||||
|
||||
final String host = "10.255.255.1";
|
||||
final int port = 80;
|
||||
// Using IANA hosted example.com:81 to reliably produce a Connect Timeout.
|
||||
final String host = "example.com";
|
||||
final int port = 81;
|
||||
int connectTimeout = 1000;
|
||||
assumeConnectTimeout(host, port, connectTimeout);
|
||||
|
||||
|
|
Loading…
Reference in New Issue