Issue #6728 - QUIC and HTTP/3

- Fixed UNIX_DOMAIN tests.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2021-10-29 09:50:47 +02:00
parent 44132b966d
commit 6fbe79af46
3 changed files with 43 additions and 4 deletions

View File

@ -121,7 +121,6 @@ public class HttpChannelAssociationTest extends AbstractTest<TransportScenario>
{ {
case HTTP: case HTTP:
case HTTPS: case HTTPS:
case UNIX_DOMAIN:
{ {
ClientConnector clientConnector = new ClientConnector(); ClientConnector clientConnector = new ClientConnector();
clientConnector.setSelectors(1); clientConnector.setSelectors(1);
@ -236,6 +235,34 @@ public class HttpChannelAssociationTest extends AbstractTest<TransportScenario>
} }
}; };
} }
case UNIX_DOMAIN:
{
ClientConnector clientConnector = ClientConnector.forUnixDomain(scenario.unixDomainPath);
clientConnector.setSelectors(1);
clientConnector.setSslContextFactory(scenario.newClientSslContextFactory());
return new HttpClientTransportOverHTTP(clientConnector)
{
@Override
public org.eclipse.jetty.io.Connection newConnection(EndPoint endPoint, Map<String, Object> context)
{
return new HttpConnectionOverHTTP(endPoint, context)
{
@Override
protected HttpChannelOverHTTP newHttpChannel()
{
return new HttpChannelOverHTTP(this)
{
@Override
public boolean associate(HttpExchange exchange)
{
return code.test(exchange) && super.associate(exchange);
}
};
}
};
}
};
}
default: default:
{ {
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@ -50,6 +50,7 @@ import org.eclipse.jetty.util.FuturePromise;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.provider.ArgumentsSource;
import org.opentest4j.TestAbortedException; import org.opentest4j.TestAbortedException;
@ -283,6 +284,8 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
@ArgumentsSource(TransportProvider.class) @ArgumentsSource(TransportProvider.class)
public void testBlockingConnectTimeoutFailsRequest(Transport transport) throws Exception public void testBlockingConnectTimeoutFailsRequest(Transport transport) throws Exception
{ {
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
Assumptions.assumeTrue(transport != Transport.UNIX_DOMAIN);
init(transport); init(transport);
testConnectTimeoutFailsRequest(true); testConnectTimeoutFailsRequest(true);
} }
@ -291,6 +294,8 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
@ArgumentsSource(TransportProvider.class) @ArgumentsSource(TransportProvider.class)
public void testNonBlockingConnectTimeoutFailsRequest(Transport transport) throws Exception public void testNonBlockingConnectTimeoutFailsRequest(Transport transport) throws Exception
{ {
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
Assumptions.assumeTrue(transport != Transport.UNIX_DOMAIN);
init(transport); init(transport);
testConnectTimeoutFailsRequest(false); testConnectTimeoutFailsRequest(false);
} }
@ -326,6 +331,9 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
@ArgumentsSource(TransportProvider.class) @ArgumentsSource(TransportProvider.class)
public void testConnectTimeoutIsCancelledByShorterRequestTimeout(Transport transport) throws Exception public void testConnectTimeoutIsCancelledByShorterRequestTimeout(Transport transport) throws Exception
{ {
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
Assumptions.assumeTrue(transport != Transport.UNIX_DOMAIN);
init(transport); init(transport);
String host = "10.255.255.1"; String host = "10.255.255.1";
@ -357,8 +365,11 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
@ParameterizedTest @ParameterizedTest
@ArgumentsSource(TransportProvider.class) @ArgumentsSource(TransportProvider.class)
public void retryAfterConnectTimeout(Transport transport) throws Exception public void testRetryAfterConnectTimeout(Transport transport) throws Exception
{ {
// Failure to connect is based on InetSocket address failure, which Unix-Domain does not use.
Assumptions.assumeTrue(transport != Transport.UNIX_DOMAIN);
init(transport); init(transport);
final String host = "10.255.255.1"; final String host = "10.255.255.1";

View File

@ -194,7 +194,7 @@ public class RoundRobinConnectionPoolTest extends AbstractTest<TransportScenario
int base = i % maxConnections; int base = i % maxConnections;
int expected = remotePorts.get(base); int expected = remotePorts.get(base);
int candidate = remotePorts.get(i); int candidate = remotePorts.get(i);
assertThat(scenario.client.dump() + System.lineSeparator() + remotePorts.toString(), expected, Matchers.equalTo(candidate)); assertThat(scenario.client.dump() + System.lineSeparator() + remotePorts, expected, Matchers.equalTo(candidate));
if (transport != Transport.UNIX_DOMAIN && i > 0) if (transport != Transport.UNIX_DOMAIN && i > 0)
assertThat(remotePorts.get(i - 1), Matchers.not(Matchers.equalTo(candidate))); assertThat(remotePorts.get(i - 1), Matchers.not(Matchers.equalTo(candidate)));
} }
@ -254,6 +254,7 @@ public class RoundRobinConnectionPoolTest extends AbstractTest<TransportScenario
// [p1, p2, p3 | p1, p2, p3 | p4, p4, p5 | p6, p5, p7] // [p1, p2, p3 | p1, p2, p3 | p4, p4, p5 | p6, p5, p7]
// Opening p5 and p6 was delayed, so the opening of p7 was triggered // Opening p5 and p6 was delayed, so the opening of p7 was triggered
// to replace p4 while p5 and p6 were busy sending their requests. // to replace p4 while p5 and p6 were busy sending their requests.
assertThat(remotePorts.toString(), count / maxUsage, lessThanOrEqualTo(results.size())); if (transport != Transport.UNIX_DOMAIN)
assertThat(remotePorts.toString(), count / maxUsage, lessThanOrEqualTo(results.size()));
} }
} }