Reading List

How I'm testing MongoDB calls in Go (for now) from Liza Shulyayeva RSS feed.

How I'm testing MongoDB calls in Go (for now)

I started working on a little hobby project over this Easter vacation that makes use of MongoDB. But one thing I wasn’t sure about was how to test Mongo operations. Spanner provides the very helpful spannertest package. Redis has miniredis, allowing you to spin up a little Redis instance for each test. I was thinking I’d likely have to mock Mongo myself, but it turns out its Go driver comes with a helpful (but unstable!) mocking package called mtest. I learned about this in this post and suggest checking it out if you’re curious about this experimental mocking feature of mongo-go-driver.