Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add SdkAsyncHttpClientH1TestSuite #829

Merged
merged 6 commits into from
Sep 27, 2024

Conversation

jtjeferreira
Copy link
Contributor

depends on #827

There is a junit test suite in AWS SDK that might be useful to test the PekkoHttpClient

@pjfanning
Copy link
Contributor

pjfanning commented Sep 25, 2024

There is a task associated with this. #655

I'd prefer to cover the integration test CI in a different PR.

The Scala 3 build is failing for this PR. Some classloading issue for junit.

@jtjeferreira
Copy link
Contributor Author

There is a task associated with this. #655

This is a bit different, as these are not integration tests and do not require an AWS account

I'd prefer to cover the integration test CI in a different PR.

Agree

The Scala 3 build is failing for this PR. Some classloading issue for junit.

I will have a look

@jtjeferreira
Copy link
Contributor Author

The Scala 3 build is failing for this PR. Some classloading issue for junit.

I will have a look

I managed to reproduce locally, but only in java 8. I will keep digging...

@jtjeferreira
Copy link
Contributor Author

The Scala 3 build is failing for this PR. Some classloading issue for junit.

I will have a look

I managed to reproduce locally, but only in java 8. I will keep digging...

The error was

[error] org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-vintage' failed to discover tests
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:99)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:77)
[error] 	at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42)
[error] 	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:56)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests0(JupiterTestCollector.java:237)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.invokeWithCustomClassLoader(JupiterTestCollector.java:299)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests(JupiterTestCollector.java:72)
[error] 	at com.github.sbt.junit.jupiter.sbt.JupiterPlugin$.$anonfun$collectTests$1(JupiterPlugin.scala:111)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] 	at sbt.Execute.work(Execute.scala:292)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:750)
[error] Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'org.apache.pekko.stream.connectors.awsspi.RequestRunnerSpec$$anon$1', classLoader = java.net.URLClassLoader@79baaf07] resolution failed
[error] 	at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:103)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
[error] 	at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:42)
[error] 	at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:64)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:99)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:77)
[error] 	at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42)
[error] 	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:56)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests0(JupiterTestCollector.java:237)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.invokeWithCustomClassLoader(JupiterTestCollector.java:299)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests(JupiterTestCollector.java:72)
[error] 	at com.github.sbt.junit.jupiter.sbt.JupiterPlugin$.$anonfun$collectTests$1(JupiterPlugin.scala:111)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] 	at sbt.Execute.work(Execute.scala:292)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:750)
[error] Caused by: java.lang.InternalError: Malformed class name
[error] 	at java.lang.Class.getSimpleBinaryName(Class.java:1478)
[error] 	at java.lang.Class.getSimpleNameImpl(Class.java:1323)
[error] 	at java.lang.Class.getSimpleName(Class.java:1308)
[error] 	at org.junit.vintage.engine.descriptor.RunnerTestDescriptor.<init>(RunnerTestDescriptor.java:50)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.createRunnerTestDescriptor(ClassSelectorResolver.java:79)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.lambda$resolveTestClass$1(ClassSelectorResolver.java:70)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution$DefaultContext.createAndAdd(EngineDiscoveryRequestResolution.java:250)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution$DefaultContext.addToParent(EngineDiscoveryRequestResolution.java:213)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolveTestClass(ClassSelectorResolver.java:70)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:47)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135)
[error] 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
[error] 	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1361)
[error] 	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
[error] 	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
[error] 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
[error] 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
[error] 	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
[error] 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[error] 	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
[error] 	at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:42)
[error] 	at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:64)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:99)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:77)
[error] 	at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42)
[error] 	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:56)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests0(JupiterTestCollector.java:237)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.invokeWithCustomClassLoader(JupiterTestCollector.java:299)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests(JupiterTestCollector.java:72)
[error] 	at com.github.sbt.junit.jupiter.sbt.JupiterPlugin$.$anonfun$collectTests$1(JupiterPlugin.scala:111)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] 	at sbt.Execute.work(Execute.scala:292)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:750)
[error] Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -8
[error] 	at java.lang.String.substring(String.java:1931)
[error] 	at java.lang.Class.getSimpleBinaryName(Class.java:1476)
[error] 	at java.lang.Class.getSimpleNameImpl(Class.java:1323)
[error] 	at java.lang.Class.getSimpleName(Class.java:1308)
[error] 	at org.junit.vintage.engine.descriptor.RunnerTestDescriptor.<init>(RunnerTestDescriptor.java:50)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.createRunnerTestDescriptor(ClassSelectorResolver.java:79)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.lambda$resolveTestClass$1(ClassSelectorResolver.java:70)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution$DefaultContext.createAndAdd(EngineDiscoveryRequestResolution.java:250)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution$DefaultContext.addToParent(EngineDiscoveryRequestResolution.java:213)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolveTestClass(ClassSelectorResolver.java:70)
[error] 	at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:47)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135)
[error] 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
[error] 	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1361)
[error] 	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
[error] 	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
[error] 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
[error] 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
[error] 	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
[error] 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[error] 	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
[error] 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
[error] 	at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:42)
[error] 	at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:64)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
[error] 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:99)
[error] 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:77)
[error] 	at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42)
[error] 	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:56)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests0(JupiterTestCollector.java:237)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.invokeWithCustomClassLoader(JupiterTestCollector.java:299)
[error] 	at com.github.sbt.junit.jupiter.api.JupiterTestCollector.collectTests(JupiterTestCollector.java:72)
[error] 	at com.github.sbt.junit.jupiter.sbt.JupiterPlugin$.$anonfun$collectTests$1(JupiterPlugin.scala:111)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] 	at sbt.Execute.work(Execute.scala:292)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:750)

where the important part is org.junit.platform.commons.JUnitException: ClassSelector [className = 'org.apache.pekko.stream.connectors.awsspi.RequestRunnerSpec$$anon$1', classLoader = java.net.URLClassLoader@79baaf07]

I tried to upgrade scala to 3.3.4, upgrade junit-jupiter-engine, but in the end the easiest fix was to rework RequestRunnerSpec

@pjfanning
Copy link
Contributor

@jtjeferreira I merged #827 - can you rebase this and get it ready for merging?

exceptions in toPekkoRequest should be wrapped in a future failed
SdkAsyncHttpClientH1TestSuite uses netty to simulate a server...
…ala 3

Error was:
org.junit.platform.commons.JUnitException: ClassSelector [className = 'org.apache.pekko.stream.connectors.awsspi.RequestRunnerSpec$$anon$1', classLoader = java.net.URLClassLoader@79baaf07] resolution failed : ClassSelector [className = 'org.apache.pekko.stream.connectors.awsspi.RequestRunnerSpec$$anon$1', classLoader = java.net.URLClassLoader@79baaf07] resolution failed
@jtjeferreira jtjeferreira force-pushed the SdkAsyncHttpClientH1TestSuite branch from 5ce5778 to e593362 Compare September 27, 2024 12:37
@jtjeferreira
Copy link
Contributor Author

@jtjeferreira I merged #827 - can you rebase this and get it ready for merging?

done

@jtjeferreira jtjeferreira marked this pull request as ready for review September 27, 2024 12:37
@@ -53,9 +60,11 @@ class PekkoHttpClient(shutdownHandle: () => Unit, private[awsspi] val connection
lazy val runner = new RequestRunner()

override def execute(request: AsyncExecuteRequest): CompletableFuture[Void] = {
val pekkoHttpRequest = toPekkoRequest(request.request(), request.requestContentPublisher())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving pekkoHttpRequest inside runner.run and changes below in RequestRunner.scala were needed to make test naughtyHeaderCharactersDoNotGetToServer pass.

The test is defined as:

@Test
public void naughtyHeaderCharactersDoNotGetToServer() {
    String naughtyHeader = "foo\r\nbar";
    assertThatThrownBy(() -> HttpTestUtils.sendRequest(client,
                                                       SdkHttpFullRequest.builder()
                                                                         .uri(URI.create("https://localhost:" + server.port()))
                                                                         .method(SdkHttpMethod.POST)
                                                                         .appendHeader("h", naughtyHeader)
                                                                         .build())
                                          .join())
        .hasCauseInstanceOf(Exception.class);
}

and it was failing because toPekkoRequest is throwing an exception, but that exception should be inside a Future.failed.

See a734b17

@@ -185,14 +194,20 @@ object PekkoHttpClient {
connectionPoolSettings.getOrElse(ConnectionPoolSettings(as)),
resolvedOptions
)

val connectionContext =
if (resolvedOptions.get(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES).booleanValue())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add support for TRUST_ALL_CERTIFICATES option so the test suite can connect to an insecure server. Unfortunately, skipping cert validation is not so easy (see for example akka/akka-http#4042)

Comment on lines +37 to +38
// Future.unit.flatMap(expr) is a scala 2.12 equivalent of Future.delegate(expr)
val result = Future.unit.flatMap(_ => runRequest()).flatMap { response =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open for suggestions

@@ -44,7 +43,7 @@

import static org.junit.Assert.assertEquals;

public class S3Test extends JUnitSuite {
public class S3Test {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, using JUnitSuite from scalatest+junit is not needed, and we can remove dependency on "org.scalatestplus" %% "junit-4-13"

@@ -15,7 +15,7 @@
<appender-ref ref="STDOUT" />
</root>

<logger name="io.netty" level="trace" additivity="false">
<logger name="io.netty" level="info" additivity="false">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SdkAsyncHttpClientH1TestSuite uses netty, and netty bootstrapping is very verbose, so I increased the log level

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this comment why these changes were needed...

@jtjeferreira jtjeferreira changed the title WIP: SdkAsyncHttpClientH1TestSuite add SdkAsyncHttpClientH1TestSuite Sep 27, 2024
Copy link
Contributor

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @jtjeferreira - I will merge this now

@pjfanning pjfanning merged commit 56a2ee8 into apache:main Sep 27, 2024
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants