Testing

golang docker

Testing redis in go with docker

If you want to run integration tests in go, and want an easy way to not have to script all the setup and teardown, you can use dockertest helper. It will let you use docker to run services needed for the integration testing, which lets you easily clean up …

golang testing

Using defer in TestMain

If you’re using TestMain you’ve probably read that you can’t use defer as you need to use os.Exit(m.Run()) to exit from TestMain. The reason for that is that os.Exit() doesn’t honor defer statements. There is an easy way around that, …