Recently I got back to learning Go and started working on some side projects. When it came to tests I needed to get my application up and running so it can be tested for real (I am not a massive fan of mocking*). I wanted to use testcontainers for that purpose as they play well with testing go application (and other languages too, check it out).
And this is where my trouble started as I use Rancher Desktop for container management on my MacOS machine with Apple silicone.
I did some googling and came across this article from Rancher docs. Just in case that site was to disappear I thought I would summarise the tweaks needed to get this working (this setup is for QEMU backend).
- Disable kubernetes support
rdctl set --kubernetes-enabled=false
- Ensure you have admin access enabled in
Preferences->Application->General
- Export the HOST IP of the VM used by Rancher so testcontainers know who to talk to.
export TESTCONTAINERS_HOST_OVERRIDE=$(rdctl shell ip a show rd0 | awk '/inet / {sub("/.*",""); print $2}')
After that, the service should restart and prompt you for your password. Everything is now working as expected.
*
I try not to mock things out if they are easy, and most importantly, fast and reliable to run locally.