-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 nil check for billing mode in AWS DynamoDB events driver #12445
Conversation
b7f4b57
to
49610cf
Compare
49610cf
to
886971b
Compare
It would be good to have some tests along with these changes. |
From failed unit tests:
|
@Tener I'd love to have reliable tests where I can query against AWS or use an emulator to test this. The issue is that AWS is at best inconsistent here and I've observed multiple variations of populated fields in cases that aren't really distinct which worries me. Same goes for the AWS emulator, which populates them all regardless as one would expect. |
I'll add some test checks for the dynamic.go changes though. I could potentially construct some nil-check tests for AWS but they seem of dubious value to me since I hardly know what behaviour to expect from AWS. |
Co-authored-by: Krzysztof Skrzętnicki <[email protected]>
Please try running this against a real dynamo instance in both billing modes before merging. |
@zmb3 Yep, done. Did that previously as well for the first PR. Issue was that AWS API is inconsistent in what fields it populates and contains zero docs on when it decides to populate certain fields. |
…t think they've ever worked in some time as they appeared quite broke.
* Check for nil in the billing mode getter + fix panic if eventtype is not set * use a better strategy to check if the interface is nil * add godoc * simplify switch * update godoc * simplify unknown field extraction code * ensure underlying type is correct * Update lib/events/dynamic_test.go Co-authored-by: Krzysztof Skrzętnicki <[email protected]> * fix lint * Update AWS dynamo tests as a result of the dynamic.go changes, I don't think they've ever worked in some time as they appeared quite broke. * simplify * simplify 2 Co-authored-by: Krzysztof Skrzętnicki <[email protected]>
* Check for nil in the billing mode getter + fix panic if eventtype is not set * use a better strategy to check if the interface is nil * add godoc * simplify switch * update godoc * simplify unknown field extraction code * ensure underlying type is correct * Update lib/events/dynamic_test.go Co-authored-by: Krzysztof Skrzętnicki <[email protected]> * fix lint * Update AWS dynamo tests as a result of the dynamic.go changes, I don't think they've ever worked in some time as they appeared quite broke. * simplify * simplify 2 Co-authored-by: Krzysztof Skrzętnicki <[email protected]>
Turns out, AWS is inconsistent in what fields they set and they don't always set the
BillingModeSummary
field if the table is in provisioned mode. Wasn't able to find that noted anywhere so I assumed it would be, this turned out to be incorrect.This PR adds some pessimistic null-checks and assumed the billing mode is provisioned if the fields are not set. Still not sure when they are set, just that they sometimes aren't. This was further not helped by our AWS tests somehow not failing on a panic, they just seem to pause and continue? That's for another PR though.
This also fixes a panic case in
dynamic.go
if the provided map is lacking an event type key which caused AWS tests to fail.Fix #12443