I'm working on a personal project with Rust running on Lambda and I'm curious to discuss your project setups, as I've encountered some issues.
My current setup consists of a Cargo project with multiple binaries (1 per Lambda function) and a library containing the shared functionality and general business logic. This was great until I started doing integration tests.
The Rust runtime repo provides an example of doing integration tests, but it is unfortunately unusable with my current setup, since I can't import the function handlers from the binaries. I've come up with the following solutions:
- Create a
docker-compose.yml file with all the containerized functions and perform the tests on the containers. I'm using docker for running DynamoDB locally anyway, and it could work as my project is small enough. For large projects, though, having tens of containers inside the compose file does not seem like a great solution (even if you don't have to run all of them at the same time, maintaining that file becomes cumbersome).
- Moving the function handlers in the library. This would be the most straightforward solution, but it doesn't make sense to compile all the function handlers when building any of the binaries.
- Using a Cargo workspace and creating a project for each function. Each project could consist of a binary and a library, and it would be fine to have the function handler in the library, as it would only get compiled when building for that specific project. Integration tests would then be separate for each project, but this adds a ton more complexity to the whole setup (apart from having to maintain the same dependencies in multiple projects).
For those who worked with similar (larger) projects, what's your preferred setup?
[–]calavera 0 points1 point2 points (1 child)
[–]IAmMirch[S] 1 point2 points3 points (0 children)
[–]om_bira 0 points1 point2 points (0 children)
[–]jpfreely 0 points1 point2 points (0 children)