-
Notifications
You must be signed in to change notification settings - Fork 154
test(tracer): streamline e2e test structure #3031
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
Conversation
I've run the integration tests ~10 times over the past few hours and the flakiness on the Tracer tests is greatly reduced, as well as the runtime for these tests. There have been some transient failures in other areas (Logger & Idempotency) which consistently disappear on the next retry. I'll work on these at some point in the future but for the sake of keeping this PR focused, I'm working only on Tracer. Also, as mentioned in the PR description, there's still some duplication which we will address in the future. For now I wanted mainly to make sure the tests pass more or less consistently, which wasn't the case after the latest changes. |
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.
Hi @dreamorosi! Awesome work refactoring these tests and testing what's important, I mean: handler, standalone function, SDK tracer, HTTP tracer, coldStart, annotation and others.
My only question about the tests in general is the use of for
and logic inside these loops. I don't know if you can break it down into more small tests to test specific things like "first invocation with coldstart", "second invocation" and so on. You already have the data, so if possible, you should be more specific and reduce the cognitive load to understand the test.
Marking this PR as "Request Changes" to hear from you if we can change anything or if we merge this PR as is.
|
Hey @leandrodamascena, thank you for the review & the useful suggestion. I've broken down the tests and ran them again (green): https://github.com/aws-powertools/powertools-lambda-typescript/actions/runs/10775415657 |
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.
APPROVED!
Summary
Changes
This PR simplifies the end to end test structure for the Tracer integration tests by reducing the amount of duplication and overlap between test cases.
The new structure, while still with some room for improvement, tries to address the main code paths & features for each instrumentation method and selectively uses some shared features in each one of them.
In addition to the changes above, I also simplified how values are passed from the test to the AWS Lambda functions ran as part of the tests. Before the change, the values were shared like this:
after the change:
While the change doesn't appear significant in its diagram representation, importing the values directly in both the tests and the function allows us to remove a considerable amount of boilerplate code needed to pass and parse environment variables on both sides.
The PR also improves the X-Ray trace utilities in
packages/testing
to retry loading the trace data when certain subsegments are not present when the trace is first loaded.Issue number: closes #3028
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.