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.


You will have to setup a dgraph cluster. You can refer to various guides here 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

What is the best way to check that the Dgraph instance has fully launched and stabilized programmatically? For example, I run this command from the tutorial:

docker run --rm -it -p 8000:8000 -p 8080:8080 -p 9080:9080 dgraph/standalone:latest

After that runs in my setup script, I’d like to update the schema, load data, etc. What’s the best way to make sure that the instance has launched and is running before trying to begin updating data?

You can check the states

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.