If set to `client`, a Consul server and client are run, and services are registered against the client. If set to `server`,
only a Consul server is run, and services are registered against the server. By default, `XDS_TARGET` is set to `server`.
See [this comment](https://github.com/hashicorp/consul/blob/70bb6a2abdbc5ed4a6e728e8da243c5394a631d1/test/integration/connect/envoy/run-tests.sh#L178-L212) for more information.
## Investigating Test Failures
* When tests fail in CI, logs and additional debugging data are available in the artifacts of the test run.
* You can re-run the tests locally by running `make test-envoy-integ GO_TEST_FLAGS="-run TestEnvoy/<case-directory>"` where `<case-directory>` is
replaced with the name of the directory, e.g. `case-basic`.
* Locally, all the logs of the failed test will be available in `workdir` in this directory.
* You can run with `DEBUG=1` to print out all the commands being run, e.g. `DEBUG=1 make test-envoy-integ GO_TEST_FLAGS="-run TestEnvoy/case-basic"`.
* If you want to prevent the Docker containers from being spun down after test failure, add a `sleep 9999` to the `verify.bats` test case that's failing.
## Creating a New Test
Below is a rough outline for creating a new test. For the example, assume our test case will be called `my-feature`.
1. Create a new directory named `case-my-feature`
2. If the test involves multiple datacenters/clusters, create a separate subdirectory for each cluster (eg. `case-my-feature/{dc1,dc2}`)
3. Add any necessary configuration to `*.hcl` files in the respective cluster subdirectory (or the test case directory when using a single cluster).
4. Create a `setup.sh` file in the case directory
5. Create a `capture.sh` file in the case directory
6. Create a `verify.bats` file in the case directory
7. Populate the `setup.sh`, `capture.sh` and `verify.bats` files with the appropriate code for running your test, validating its state and capturing any logs or snapshots.