Integration Tests¶
The integration tests run end-to-end tests on Rook in a running instance of Kubernetes. The framework includes scripts for starting Kubernetes so users can quickly spin up a Kubernetes cluster. The tests are generally designed to install Rook, run tests, and uninstall Rook.
The CI runs the integration tests with each PR and each master or release branch build. If the tests fail in a PR, access the tmate for debugging.
This document will outline the steps to run the integration tests locally in a minikube environment, should the CI not be sufficient to troubleshoot.
Hint
The CI is generally much simpler to troubleshoot than running these tests locally. Running the tests locally is rarely necessary.
Warning
A risk of running the tests locally is that a local disk is required during the tests. If not running in a VM, your laptop or other test machine could be destroyed.
Install Minikube¶
Follow Rook's developer guide to install Minikube.
Build Rook image¶
Now that the Kubernetes cluster is running we need to populate the Docker registry to allow local image builds to be easily used inside Minikube.
make build
will now build and push the images to the Docker registry inside the Minikube virtual machine.
Tag the newly built images to rook/ceph:local-build
for running tests, or rook/ceph:master
if creating example manifests::
Run integration tests¶
Some settings are available to run the tests under different environments. The settings are all configured with environment variables. See environment.go for the available environment variables.
Set the following variables:
Set TEST_SCRATCH_DEVICE
to the correct block device name based on the driver that's being used.
Hint
If using the virtualbox
minikube driver, the device should be /dev/sdb
Warning
The integration tests erase the contents of TEST_SCRATCH_DEVICE
when the test is completed
To run a specific suite, specify the suite name:
After running tests, see test logs under tests/integration/_output
.
To run specific tests inside a suite:
Info
Only the golang test suites are documented to run locally. Canary and other tests have only ever been supported in the CI.
Running tests on OpenShift¶
- Setup OpenShift environment and export KUBECONFIG
- Make sure
oc
executable file is in the PATH. - Only the
CephSmokeSuite
is currently supported on OpenShift. -
Set the following environment variables depending on the environment:
-
Run the integration tests