dynalite
dynalite copied to clipboard
Flag to manually trigger UnprocessedItems on batchWriteItem
When using dynalite
to test libraries there is no good way to confirm that the library being tested handles UnprocessedItems
correctly without rolling your own request handler. It would be cool if there was a way to tell dynalite to not processes items either via a key or some other method as long as that method was constant.
Is this something you'd be interested in adding to dynalite @mhart?
Here is an example of where some code I'm working with is mocking this itself.
https://github.com/mapbox/cardboard/blob/8333b5b4e4a657df0a16b1129a4eb91f36c03f3c/test/batch.test.js#L71-L79
@mhart I'd like to see this happen too. Do you have any ideas on how you want to make this happen? I'm thinking that an additional startup option could be provided, like maxBatchGetSize
or maxBatchGetItem
.
dynalite
does try to emulate DynamoDB in terms of maximum retrieval size – it will put any items that are beyond the max allowed response size in UnprocessedItems
(maxItemSizeKb
is configurable)
See here for more details:
https://github.com/mhart/dynalite/blob/aa510f0ddf586a1a3f71c25317a0f8b9ea46687d/actions/batchGetItem.js#L24
So you should be able to trigger this by putting and getting many large items. I feel like that should cover any testing scenarios – but if there are some that aren't, let me know
@mhart Sweet! After getting your message I added a couple of tests that got really big items and saw that my unprocessed items code was getting triggered! Thanks for implementing my request before I even asked! ;)
@danthegoodman glad to hear it! @mcwhittemore let me know if that tip covers your use case too
@mhart - If I'm reading this right, UnprocessedItems
works in query mode. What I'm looking to test is BatchWriteItem requests which get throttled and end with some things written and some things in UnprocessedItems.
I don't think this is covered from what I'm reading above.
@mcwhittemore you're right, BatchWriteItem
isn't covered