Testing tricks in Rust

Use verbs as test module names Who said that the test module needs to be named test ? Experiment with different module names, pay attention to how the test runner displays the results. A structure that I like, an example: worker.rs: // some production code here mod should{#[test]fn consume_message_from_queue(){// mock queue, create worker with that queue injected // start worker // check if queue's 'get_message' was invoked }}Cargo prints worker::should::consume_message_from_queue when running this test, which reads nicely and exposes the requirement. [Read More]

Rust - controlling side effects from the test.

Rust: controlling side effects from the test. Hello and welcome to the newest episode on testing in Rust. Imagine you want to write a timestamping repository of some sorts, that will associate the timestamp of when the storage operation was invoked with the stored value. How to write it in Rust ? And more importantly - how to test it ? I would like to share a solution I found and talk a bit about how it works. [Read More]

Resources for starting your adventure with Rust

As I’ve been running several intro to Rust sessions throughout the last year, I’ve assembled a set of resources that help people ease into the language. Depending on your learning style you might like: Rustlings - This is a good set of starter exercises if you want to have a feeling for the language - have links to relevant book sections for each exercises so you can either start with the book or trying to figure it out yourself first. [Read More]

I’m running Rust pair programming sessions !

Why ? Rust has such a wonderful community and I want to give back as much as I can. I am not an expert in Rust but I am not a beginner either. In addition to that I love pair programming ! The result is always much better than I could produce myself. I am happy to both share the knowledge and learn. I would love to pair with you ! [Read More]

Configure AWS Elastic Beanstalk Docker environment variables

AWS Beanstalk is a good ‘intermediate’ level hosting for Docker containers. It gives you load balancing and scalability pretty much out of the box in exchange for being a bit more opaque to configure. The Docker bits are a bit more hidden away there. In a typical production setup you would want to have Docker images not containing anything environment related, e.g. to be able to run them both in production and locally. [Read More]

Waiting for AWS Elastic Beanstalk environment to become ready

Elastic Beanstalk on AWS seems to be one of those services that are pretty cool but it’s hard to get to know them. One of the tasks you may encounter while working with it is that after making some change to its configuration you would like to wait for it to be finished before proceeding further. The change may be setting an environment variable but can also be deploying a new version of the application. [Read More]

Setting up Rust development environment using VSCode on a Mac

Completion and highlighting While on Linux VSCode with the Rust plugin seems to work more or less out of the box, on a Mac I needed to spend some time configuring it. First things first though, let’s start by installing Rust version manager, rustup. curl https://sh.rustup.rs -sSf | sh We will be using nightly version of rust as to have one version that can compile all of our tools. This is mostly due to clippy requiring a nightly compiler. [Read More]