test-agent-cli
lets you write TestSys test using Bash and help in receiving and sending information from/to the TestSys cluster.
- kind: https://kind.sigs.k8s.io/docs/user/quick-start/
- Kubectl: https://kubernetes.io/docs/tasks/tools/
- Docker : https://docs.docker.com/get-started/
Set the TESTSYS_DIR variable to point to the directory in which you have cloned the project. For example:
export TESTSYS_DIR="${HOME}/repos/bottlerocket-test-system"
Set alias
alias cli="${TESTSYS_DIR}/.cargo/bin/cli"
Install the cli
command line tool into the local CARGO_HOME as:
cd "${TESTSYS_DIR}"
cargo install --path "${TESTSYS_DIR}/cli" --force
The following commands can be used to communicate with a TestSys cluster. Create a bash script like Example test.
# Get the configuration details and set the task state running
test-agent-cli init
# Get the number of retires allowed in case of failing tests
test-agent-cli retry-count
# Get the secret value using the secret key
test-agent-cli get-secret secret-key
# Send the result of every test run to test object in Controller
test-agent-cli send-result -o pass -p 1 -f 0 -s 0
# Save the test results in tar archive
test-agent-cli save-results -f results.txt -d my_results
# Send any error encountered in test
test-agent-cli send-error error-message
# Mark the test as completed
test-agent-cli terminate
Create a Dockerfile. Remember to set the ENTRYPOINT to the test Bash script and install the required packages.
Create the docker image.
Note: Add a target to the Makefile
to create the new image.
make example-test-agent-cli
docker image tag example-test-agent-cli example-test-agent-cli:bash
Create and tag the controller image.
make controller
docker image tag controller controller:bash
Check if the cluster already exists:
kind get clusters
If the cluster already exists, it should be deleted.
kind delete cluster --name <testsys_cluster_name>
Create the new cluster.
kind create cluster --name <testsys_cluster_name>
Now the images created earlier need to be added to the cluster.
kind load docker-image controller:bash example-test-agent-cli:bash --name <testsys_cluster_name>
Install TestSys to the cluster.
cli install --controller-uri controller:bash
Create a yaml file for Test.
Run the test.
cli run file <filename>
Check the status of the test.
cli status -c
Cleanup all the resources.
cli delete