Skip to content

Handle unprocessed items in batch write responses #107

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

Merged
merged 7 commits into from
Jan 26, 2019

Conversation

woodyza
Copy link

@woodyza woodyza commented Jan 18, 2019

Addresses #92, #91

Changes the encrypt_batch_write_item utility method to check for UnprocessedItems in the response, and replace them with the original plaintext items.

Couple talking points:

  • The encryption process is currently overwriting the plaintext item value, and in order to enable reverting it back I needed to deep copy the RequestItems.
  • Handling the possible lack of schema information when searching out the correct plaintext item meant having a fallback that requires all the attributes not marked for encryption to match; a brute-force way of making sure the key attributes match since they aren't encrypted. Not sure if there's a more elegant way.
  • I may have put my tests in the wrong place :)
  • My tests are low-level implementation tests, should there be a higher-level test that triggers throughput exceeded for e.g. to cover regressions on the higher-level requirement?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mattsb42-aws
Copy link
Member

Hi @woodyza, thanks for this! I'm taking a look at the code today.

should there be a higher-level test that triggers throughput exceeded for e.g. to cover regressions on the higher-level requirement

Yes, we would like end-to-end tests through all affected high-level clients as well.

Copy link
Member

@mattsb42-aws mattsb42-aws left a comment

Choose a reason for hiding this comment

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

I haven't gone through the tests yet, but wanted to get these notes out since I'll be busy for a while today.

@woodyza
Copy link
Author

woodyza commented Jan 21, 2019

Sweet thanks @mattsb42-aws - I'll get onto these later on today.

Btw any pointers toward where the higher-level tests would best be implemented? I'm still figuring out the structure of the tests and how they interact with tox and the different test runs. Bit of a tox n00b tbh, don't spend a lot of time on library code that needs to work on more than one python version or platform.

@mattsb42-aws
Copy link
Member

Sweet thanks @mattsb42-aws - I'll get onto these later on today.

Btw any pointers toward where the higher-level tests would best be implemented? I'm still figuring out the structure of the tests and how they interact with tox and the different test runs. Bit of a tox n00b tbh, don't spend a lot of time on library code that needs to work on more than one python version or platform.

The categories are described here[1]. Notably:

  • functional: mark test as a functional test (does not require network access)
  • integ: mark a test as an integration test (requires network access)
  • ddb_integ: mark a test as an integration test that requires a real DynamoDB table (requires network access and not used in CI)

What I would have in mind for end-to-end tests for this behavior would be functional tests that mock out the DDB client. Unless you can figure out how to get moto to not process certain items, in which case functional tests that use that.

[1] https://github.com/aws/aws-dynamodb-encryption-python/blob/master/setup.cfg#L17-L30

@woodyza
Copy link
Author

woodyza commented Jan 22, 2019

@mattsb42-aws I think I've tackled all your comments so far, I'm just jumping into the e2e tests now.

Copy link
Member

@mattsb42-aws mattsb42-aws left a comment

Choose a reason for hiding this comment

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

Minor formatting fix that autoformat will take care of. Other than that, LGTM.

@mattsb42-aws mattsb42-aws merged commit 23b1857 into aws:master Jan 26, 2019
@mattsb42-aws
Copy link
Member

Thanks of the contribution! I'll update #91 and #92 once we have this published in a new version.

@woodyza woodyza deleted the handle-unprocessed-items branch January 26, 2019 04:31
@woodyza
Copy link
Author

woodyza commented Jan 26, 2019

No probs! Thanks for the patient reviewing 😄

@mattsb42-aws
Copy link
Member

@woodyza 1.1.0 is now live with these changes.

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.

3 participants