Getting started with ONIT
Prerequisites
ONIT sets up test clusters and runs test jobs inside Kubernetes. For development and testing, we recommend using KIND or MicroK8s, but ONIT can run on any Kubernetes cluster.
Additionally, Golang 1.12 or later is recommended for downloading/compiling the ONIT binary.
Installation
To install ONIT, fetch and compile the ONIT binary using go get
:
> GO111MODULE=on go get github.com/onosproject/onos-test/cmd/onit
The onit
CLI supports auto-completion of commands for bash and zsh. To enable auto-completion:
bash
- Runsource $(onit completion bash)
zsh
- Runsource <(onit completion zsh)
You can optionally persist the output of the onit completion
command to your shell profile.
Usage
Development Cluster
To setup a cluster for development, after having pushed all the new images to kind
run:
onit create cluster --set onos-cli.enabled=true
Integration Tests
To run a suite of tests, use the onit run test
command, providing a test image to run:
onit test --image <test-image>
For example, to run onos-config suite tests using kind cluster:
onit test --image onosproject/onos-config-tests:latest --suite gnmi --image-pull-policy="Always"
Note: To learn about how you can create a test image, refer to testing document.
Benchmarks can be run with the onit run benchmark
command:
onit benchmark --image <test-image>
To run a suite (e.g. a suite of onos-topo tests):
onit test --image onosproject/onos-topo-tests:latest --suite topo
To run a specific test (e.g. an onos-config test):
onit test --image onosproject/onos-config-tests:latest --suite config --test TestTransaction
More usage examples are provided in debugging document.