-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[ESM] Fix flaky discarding record age test #12552
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
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 23m 59s ⏱️ - 34m 24s Results for commit cf95416. ± Comparison against base commit 49dcd93. This pull request removes 1188 and adds 4 tests. Note that renamed tests count towards both.
This pull request removes 102 skipped tests and adds 4 skipped tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
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.
Thanks for tackling test flakiness @gregfurman
TCP connections to Kinesis Mock timing out/going stale
question: Is there a way/need to solve the underlying problem of expiring TCP connections? The workaround mitigates test flakiness, but wouldn't users experience the root cause without patching these internals?
StreamName=stream_name, | ||
) | ||
# The first record in the batch will have expired with the remaining batch not exceeding any age-limits. | ||
aws_client.kinesis.put_records( |
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.
good batching 👍
): | ||
# snapshot setup | ||
snapshot.add_transformer(snapshot.transform.key_value("MD5OfBody")) | ||
snapshot.add_transformer(snapshot.transform.key_value("ReceiptHandle")) | ||
snapshot.add_transformer(snapshot.transform.key_value("startSequenceNumber")) | ||
|
||
snapshot.add_transformer( | ||
SortingTransformer( | ||
"Records", lambda x: base64.b64decode(x["kinesis"]["data"]).decode("utf-8") |
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.
question: Does the same partition key not enforce ordering? Maybe, I miss something why this is needed 🤔
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 test now writes the data in as a batch request, which could mess with the ordering 🫠
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.
might be worth a comment since it's not obvious
@@ -1107,15 +1110,26 @@ def test_kinesis_maximum_record_age_exceeded( | |||
"StreamDescription" | |||
]["StreamARN"] | |||
|
|||
if not is_aws_cloud(): | |||
# Override the MaximumRecordAgeInSeconds to make test shorter in LS | |||
# which would otherwise fail validations (where MaximumRecordAgeInSeconds >= 60s). |
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.
clarification: I didn't quite understand the second line of this comment. I guess it's to byepass AWS validations, which wouldn't allow setting it as low, right?
Idea: Maybe we can clearly label this as LS test optimization and say that we are patching the implementation directly to byepass AWS API validation 💭
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.
MaximumRecordAgeInSeconds
can only ever be greater than 60s
. This means that if we were properly validating this field (which we are not) then the below would fail:
create_event_source_mapping_response = create_event_source_mapping(
FunctionName=function_name,
MaximumRecordAgeInSeconds=60 if is_aws_cloud() else 5, # <-- should raise ValidationException
# other params
)
Hence, we set the value (as normal) to 60
seconds and then need to monkeypatch it at the provider level to ensure these tests don't last 60+ seconds.
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.
Would something along these lines be clearer and more specific?
LocalStack test optimization: Override MaximumRecordAgeInSeconds directly in the poller to bypass the AWS API validation (where MaximumRecordAgeInSeconds >= 60s). This saves 55s waiting time.
@joe4dev regarding this question:
Yeah there is a way we can do this. I've started extending the |
Motivation
Fixes a flaky test that was triggerd by TCP connections to Kinesis Mock timing out/going stale.
Changes