gnomock icon indicating copy to clipboard operation
gnomock copied to clipboard

Implement DynamoDB preset

Open orlangure opened this issue 5 years ago • 11 comments

A short guide on implementing a new preset: https://github.com/orlangure/gnomock/blob/master/CONTRIBUTING.md#new-presets

MySQL preset for inspiration: https://github.com/orlangure/gnomock/tree/master/preset/mysql

The objective is to implement a new Preset that spins up DynamoDB docker container, sets up its initial state (user provided data), waits for it to become ready and kills it in the end.

Please note that there are multiple steps required to create a new preset (see the guide above). I'm here to help😼

orlangure avatar Oct 01 '20 09:10 orlangure

Hi, Can I work on this issue?

imsk17 avatar Oct 03 '20 05:10 imsk17

Hi, @imsk17! Of course. Thank you! If you need any help getting started, I'm here to help.

orlangure avatar Oct 03 '20 11:10 orlangure

it seems this isn't easy. dynamodb requires structs before it makes a table. so u cannot use map[string]interface{}

imsk17 avatar Oct 09 '20 09:10 imsk17

@imsk17, that's fine! I think we should go for quick wins, and having a working preset that creates a dynamodb container, even without initial data, would be great.

What do you think about narrowing the scope of this issue to implementing a preset that only has a working healthcheck function?

If in the future somebody requests initial setup, we handle it then.

orlangure avatar Oct 09 '20 11:10 orlangure

or maybe we can setup a withStructs() method?

imsk17 avatar Oct 15 '20 11:10 imsk17

I think it would complicate the development too much for the value it provides. If you'd like to work on initial data setup in dynamodb, I'd recommend to work on it as an independent task right after we merge a minimal working preset.

orlangure avatar Oct 15 '20 11:10 orlangure

okay! thats fine

imsk17 avatar Oct 15 '20 11:10 imsk17

@imsk17 Are you still working on this?

checkaayush avatar Dec 13 '20 06:12 checkaayush

quite busy nowadays. you can do it if you want to

imsk17 avatar Dec 14 '20 10:12 imsk17

@orlangure Why not to use DynamoDB from localstack and you decided to create a separate preset?

nawa avatar Jan 20 '21 09:01 nawa

@nawa, I think using the official docker image would be as close to the real thing as possible, probably closer than Localstack implementation.

Another factor is the API. Take Localstack S3 for example. We have WithS3Files option, which would be useless if you only need Localstack container to test SQS. Eventually the number of Localstack options could grow too much and add too much noise, so I'd rather "move" these options into separate, dedicated presets wherever possible.

The third factor which I'm not entirely sure about is startup speed. I assume that starting Localstack would take more time than just a DynamoDB container.

But I'm of course glad that there is an option to use DynamoDB via Localstack even though there are no initial state setup features like with other databases.

orlangure avatar Jan 20 '21 09:01 orlangure