Integration testing with Go client

I’m using Dgraph as the core database within an application I’m working on but I’d like to first tinker with unit/integration tests. For the former, I’ll be constructing mocks using interfaces (since I’m using the Go client) but for the latter, I’d like to have as minimal Dgraph resources running as possible for the duration of the tests. Is there a recommended way to handle this? I wasn’t able to get a clear understanding from the running tests section of the README for the Go client.

Thanks!

You will have to setup a dgraph cluster. You can refer to various guides here https://docs.dgraph.io/deploy/#single-host-setup. Then you can run go test -v ./... to run the tests.

Okay, cool. So even when a production environment has a multi-instance setup I’ll set it to single-instance for integration tests.

1 Like