this post was submitted on 04 Aug 2024
19 points (100.0% liked)

Rust

6041 readers
6 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] Ephera@lemmy.ml 4 points 3 months ago (1 children)

testcontainers is a cool crate. It basically allows you to launch a container to test against in your unit tests.

My use-case was when integrating Postgres+Diesel for persisting our data.
I really wanted to make sure that we can save our data into there and load it back out in identical form.
And yeah, rather than writing some elaborate scripts to do a full-blown integration test, it's three lines of code with this crate to launch a Postgres container and have it cleaned up after the test.

Diesel is also quite cool here when you've got your migrations embedded, as it will automatically set up your database schema in the blank Postgres.

[โ€“] secana@programming.dev 2 points 3 months ago

I use that too. Unfortunately it does only work with Docker and on some machines I've only containerd+nerdctl available. Would be cool if test containers supports more than Docker as a runtime.