2020-10-12 10:26:26 -07:00
|
|
|
# Boundary CLI Tests
|
|
|
|
|
|
2022-09-16 15:54:55 +00:00
|
|
|
This directory contains [bats tests](https://github.com/bats-core/bats-core) for testing the Boundary CLI against arbitrary Boundary deployments.
|
2020-10-12 10:26:26 -07:00
|
|
|
The tests are meant to mimic common workflows such as creating resources, and connecting to targets. Currently, the tests rely heavily on
|
|
|
|
|
generated resources when running Boundary in `dev` mode. In the future, we hope to remove this dependency and generate all resources through
|
2022-09-16 15:54:55 +00:00
|
|
|
the Boundary CLI from the outset.
|
2020-10-12 10:26:26 -07:00
|
|
|
|
|
|
|
|
The tests are designed to be idempotent.
|
|
|
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
|
|
#### Dependencies
|
|
|
|
|
|
|
|
|
|
- [jq](https://stedolan.github.io/jq/)
|
|
|
|
|
- [bats](https://github.com/bats-core/bats-core)
|
2022-09-16 15:54:55 +00:00
|
|
|
- [netcat](https://nc110.sourceforge.io/)
|
2020-10-12 10:26:26 -07:00
|
|
|
- [boundary](https://github.com/hashicorp/boundary)
|
|
|
|
|
|
|
|
|
|
#### Running Tests
|
|
|
|
|
|
|
|
|
|
1. Start boundary in dev mode
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
boundary dev
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
or direct the tests towards an existing install by setting
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
export BOUNDARY_ADDR=<your_install>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Run the tests
|
|
|
|
|
|
|
|
|
|
```bash
|
2021-05-04 10:25:11 -04:00
|
|
|
# for an untagged non-version of boundary
|
2020-10-12 10:26:26 -07:00
|
|
|
bats -p boundary/
|
2021-05-04 10:25:11 -04:00
|
|
|
|
|
|
|
|
# for an official boundary version
|
|
|
|
|
IS_VERSION=true bats -p boundary/
|
2020-10-12 10:26:26 -07:00
|
|
|
```
|
2020-10-13 07:41:32 -07:00
|
|
|
|
|
|
|
|
## Running Tests Against Other Deployments
|
|
|
|
|
|
|
|
|
|
You can run this suite against an arbitrary cluster by overriding the following env vars:
|
|
|
|
|
|
|
|
|
|
```bash
|
2022-09-16 15:54:55 +00:00
|
|
|
DEFAULT_LOGIN=<my_login> \
|
2020-10-13 07:41:32 -07:00
|
|
|
DEFAULT_PASSWORD=<my_password> \
|
|
|
|
|
BOUNDARY_ADDR=http://boundary-test-controller-salmon-b70f2710539143b4.elb.us-east-1.amazonaws.com:9200 \
|
|
|
|
|
bats boundary/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
~> Note that these tests currently expect generated resources to exist. Failure to run against a Boundary deployment that does
|
|
|
|
|
not have generated resources will result in a lot of test failures. Future work includes breaking thses tests out in a way
|
2022-09-16 15:54:55 +00:00
|
|
|
that makes them not dependent on generated resources.
|