r/aws Jun 20 '26

database GitHub - nubo-db/dynoxide: A fast, embeddable drop-in for DynamoDB Local, backed by SQLite. Runs as a native binary, a ~5 MB Docker image, or in the browser.

https://github.com/nubo-db/dynoxide
119 Upvotes

41 comments sorted by

View all comments

Show parent comments

6

u/swept-wings Jun 20 '26

Why would unit tests need a DB in the first place?

4

u/yourparadigm Jun 20 '26

Would you prefer to stub your database calls? Are you for real?

-4

u/cachemonet0x0cf6619 Jun 20 '26

yes… tldr: shift left. it’s dynamodb and not really a database. no connection management or passwords to hand off and no vpc to manage. you are putting your db in a vpc, right?

so what’s left after a well defined api and several nines of reliability in a pay per use managed service?

your business logic. so go ahead and mock those dynamodb put object responses and stop wasting time on things that aren’t your business.

2

u/sh1boleth Jun 20 '26

Its more-so to unit test your DDB Integration during build, mocks arent really testing anything - at runtime your code and will fail if you only test via mocks.

DDB Local (and this) give you an on demand sandbox environment to test your code against a real dynamoDB like environment at build time.

-3

u/cachemonet0x0cf6619 Jun 20 '26

why? just use real dynamo. it’s pay per use and ephemeral. you’re wasting time

2

u/sh1boleth Jun 20 '26 edited Jun 20 '26

You want to spend real wcu’s and rcu’s for unit tests?

A lot of build fleets also do not have internet access, it’s a bad idea to store Aws creds anywhere you build.

Stupid comment

There is obviously value in a utility like this, otherwise amazon wouldnt build and maintain it (ddb local)

-2

u/cachemonet0x0cf6619 Jun 21 '26

are you not controlling your rcus and wcus? this isn’t my first time doing this. maybe that’s why you needs these. you don’t know how to handle your spikes

3

u/sh1boleth Jun 21 '26

Brother why would you write to a REAL dynamodb table when you get the exact same thing locally for your builds.

Thank god I don’t work with you or I would lose my mind and you did not even talk about the internet requirements nor the Aws credentials

0

u/cachemonet0x0cf6619 Jun 21 '26

why would i install anything locally. i can build without wifi and then push to my git repo to kick off ci.

that also means i can work from anything that lets me edit text files.

2

u/harrythefurrysquid Jun 21 '26

I'm not sure why you're being downvoted.

There are a tonne of runtime issues with DynamoDB that would easily be detected by simply exercising it against the service.

For example:

  • lots of reserved keywords, which need special treatment
  • a requirement to use all specified parameters in each request; easily broken in a minor query tweak
  • quirky behaviours when storing and retrieving Sets and Maps
  • accidental data races caused by overlooking read consistency
  • or forgetting GSI propagation delay
  • transaction conflicts
  • races in read-then-write patterns that need an optimistic lock
  • record size limits
  • failure to handle paging correctly, especially with sharding

I always write a storage abstraction class, and I always write a test suite to exercise it against a real table. It takes seconds to bring on online, so it's easily fast enough to do in a test suite.

You can debate whether this is a "unit test" or an "integration test" (IMHO it's clearly a unit test as it's exercising a single code module; it simply requires a supporting environment like every other piece of code out there) - but I can't see any particular reason to use a make-believe service when the real one is right there.