Update tests to use test ports for the Dgraph cluster

Moved from GitHub dgraph-js/55

Posted by danielmai:

The tests should be updated to run against the Dgraph test cluster defined in this docker-compose.yml file: dgraph/docker-compose.yml at 43c8d38499fb8795e6e5bb5f6a5facf665f36d64 · dgraph-io/dgraph · GitHub

  • Alpha runs on gRPC port 9180.
  • Enterprise ACLs are enabled and require groot login (this is already done).

danielmai commented :

When changing to port 9180 there’s a test that fails when using the default constructor for the client stub, which defaults to port 9080:

To fix this we should do one of two things (or both):

  1. Remove this test that involves the default constructor
  2. Remove setting a default address in an empty constructor (breaking the existing API).

Setting a default address when constructing a client connection doesn’t happen in any of the other official clients. It’s also such a small thing that it doesn’t need to be tested for, and keeping it means the tests must always run with a Dgraph cluster on port 9080.

paulftw commented :

@danielmai
this change allows specifying dgraph port via an env var:
DGRAPH_SERVER_ADDR=localhost:9180 yarn test

It also removes the constructor unit test.

Please re-open if you need anything else