-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Amazon Lambda HTTP resolve native test issues from #7362 #9697
Conversation
@oztimpower Please see: #9717 This has resolved/removed exception stack trace issues when running with test harness. |
new FunctionError(e.getClass().getName(), e.getMessage())); | ||
continue; | ||
} catch (IOException ioException) { | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't eating the exception hide other errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error has already been logged to the console (and hence CloudWatch Logs), before there is an additional attempt to log it to the Lambda service. If the latter fails, there is a more fundamental problem and you should logically exit, indeed that is what the double try-catch was doing at any rate, practically all that was happening was the same exception being shown twice. Outcome was the same.
It was evident in the test framework, that it wasn't adding a lot of value double counting the fact that the thread had closed which is what was triggering the errors. Either way that code needs a bit of re-think in terms of how it is reporting errors to the console and the lambda service. Lambda will log all console stdout and stderr to CloudWatch Logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My latest PR at least got rid of the stack traces when running with the test harness. Just merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Native Tests? That is where the exceptions were being thrown. I've tested #7362 again post the PR and it is still failing with the same stack trace.
The AbstractLambdaPollLoop
is invoked only when using native-image or when the property quarkus.lambda.enable-polling-jvm-mode=true
by virtue of the AmazonLambdaProcessor
build steps. That is what this PR is addressing.
public void testGetTextFunqy() throws Exception { | ||
testGetText("/funqyHello","application/json", "\"hello funqy\""); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, there is an issue with the Funqy tests, it is using content type application/json and generates the below errors when run from the maven archetype (this needs to be fixed). I modified it here.
mvn archetype:generate \
-DarchetypeGroupId=io.quarkus \
-DarchetypeArtifactId=quarkus-amazon-lambda-http-archetype \
-DarchetypeVersion=999-SNAPSHOT
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.tjpower.GreetingTest
2020-06-04 10:35:43,346 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT on JVM started in 1.833s. Listening on: http://0.0.0.0:8081
2020-06-04 10:35:43,347 INFO [io.quarkus] (main) Profile test activated.
2020-06-04 10:35:43,348 INFO [io.quarkus] (main) Installed features: [amazon-lambda, cdi, funqy-http, mutiny, resteasy, servlet, vertx, vertx-web]
[ERROR] Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 4.508 s <<< FAILURE! - in org.tjpower.GreetingTest
[ERROR] testFunqy Time elapsed: 1.058 s <<< FAILURE!
java.lang.AssertionError:
1 expectation failed.
Expected content-type "text/plain" doesn't match actual content-type "application/json".
at org.tjpower.GreetingTest.testFunqy(GreetingTest.java:36)
2020-06-04 10:35:44,659 INFO [io.quarkus] (main) Quarkus stopped in 0.102s
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] GreetingTest.testFunqy:36 1 expectation failed.
Expected content-type "text/plain" doesn't match actual content-type "application/json".
[INFO]
[ERROR] Tests run: 4, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.379 s
[INFO] Finished at: 2020-06-04T10:35:45Z
[INFO] ————————————————————————————————————
I will split this up, seperate the Maven Archetype issue. |
Issue #7362 identified a couple of problems, first that the undertow host
localhost:5387
was not being set for native tests, and second some ugly shutdown exceptions.Addressed the shutdown issues for the Amazon Lambda HTTP in
AbstractLambdaPollLoop
where the requestId was being read on a closed socket (thread no longer running).Also identified an issue in the maven-archetype where the Funqy tests were returning application/json. \cc @patriot1burke. Added the AwsProxy versions of the unit tests, which is used in the quarkus integration tests. The AwsProxy tests also work on native (RestAssured does not), yet left the RestAssured version in the maven-archetype as it works with the JVM.
Shutdown exceptions per #7362 Native Tests pre the change:
Post the changes to
AbstractLambdaPollLoop
Native Tests on #7362:Archetype tested by: