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

  •  TehPers   ( @TehPers@beehaw.org ) 
    link
    fedilink
    English
    71 month ago

    Still working on an assertions library that I started a few weeks ago. I finally managed to get async assertions working:

    expect!(foo(), when_ready, all, not, to_equal(0)).await;
    

    It also captures values passed down the assertion chain and reports them on failure (without requiring all types to implement Debug since it uses autoref specialization).

    Hopefully it’ll be ready for a release soon.

  • 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.

    • 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.

  • After controlling a PTZ camera with an Xbox controller, we realized that wasn’t ideal, so now we’re switching to controlling said camera with a Logitech flight stick (to arrive from Amazon this week)