2019-06-03 10:06:15 +00:00
|
|
|
# End-to-End Testing
|
|
|
|
|
|
|
|
- [End-to-End Testing](#end-to-end-testing)
|
|
|
|
- [Introduction](#introduction)
|
|
|
|
- [Install Kubernetes](#install-kubernetes)
|
2021-09-20 10:16:55 +00:00
|
|
|
- [Deploy Rook](#deploy-rook)
|
2019-06-03 10:06:15 +00:00
|
|
|
- [Test parameters](#test-parameters)
|
2020-08-10 03:17:20 +00:00
|
|
|
- [E2E for snapshot](#e2e-for-snapshot)
|
2019-06-03 10:06:15 +00:00
|
|
|
- [Running E2E](#running-e2e)
|
|
|
|
|
|
|
|
## Introduction
|
|
|
|
|
|
|
|
End-to-end (e2e) in cephcsi provides a mechanism to test the end-to-end
|
|
|
|
behavior of the system, These tests will interact with live instances of ceph
|
|
|
|
cluster just like how a user would.
|
|
|
|
|
|
|
|
The primary objectives of the e2e tests are to ensure a consistent and reliable
|
|
|
|
behavior of the cephcsi code base and to catch hard-to-test bugs before
|
|
|
|
users do when unit and integration tests are insufficient.
|
|
|
|
|
|
|
|
The Test framework is designed
|
|
|
|
to install Rook, run cephcsi tests, and uninstall Rook.
|
|
|
|
|
|
|
|
The e2e test are built on top of [Ginkgo](http://onsi.github.io/ginkgo/) and
|
|
|
|
[Gomega](http://onsi.github.io/gomega/)
|
|
|
|
|
|
|
|
## Install Kubernetes
|
|
|
|
|
|
|
|
The cephcsi also provides a script for starting Kubernetes using
|
|
|
|
[minikube](../scripts/minikube.sh) so users can quickly spin up a Kubernetes
|
|
|
|
cluster.
|
|
|
|
|
|
|
|
the following parameters are available to configure kubernetes cluster
|
|
|
|
|
2020-04-06 20:19:13 +00:00
|
|
|
| flag | description |
|
2020-03-27 18:21:18 +00:00
|
|
|
| ----------------- | ------------------------------------------------------------- |
|
|
|
|
| up | Starts a local kubernetes cluster and prepare a disk for rook |
|
|
|
|
| down | Stops a running local kubernetes cluster |
|
|
|
|
| clean | Deletes a local kubernetes cluster |
|
|
|
|
| ssh | Log into or run a command on a minikube machine with SSH |
|
|
|
|
| deploy-rook | Deploy rook to minikube |
|
|
|
|
| create-block-pool | Creates a rook block pool (named $ROOK_BLOCK_POOL_NAME) |
|
|
|
|
| delete-block-pool | Deletes a rook block pool (named $ROOK_BLOCK_POOL_NAME) |
|
|
|
|
| clean-rook | Deletes a rook from minikube |
|
|
|
|
| cephcsi | Copy built docker images to kubernetes cluster |
|
|
|
|
| k8s-sidecar | Copy kubernetes sidecar docker images to kubernetes cluster |
|
2019-06-03 10:06:15 +00:00
|
|
|
|
|
|
|
following environment variables can be exported to customize kubernetes deployment
|
|
|
|
|
2020-04-06 20:19:13 +00:00
|
|
|
| ENV | Description | Default |
|
|
|
|
|----------------------|--------------------------------------------------|--------------------------------------------------------------------|
|
|
|
|
| MINIKUBE_VERSION | minikube version to install | latest |
|
2020-08-27 13:17:39 +00:00
|
|
|
| KUBE_VERSION | kubernetes version to install | latest |
|
2020-09-28 12:58:53 +00:00
|
|
|
| MEMORY | Amount of RAM allocated to the minikube VM in MB | 4096 |
|
2020-04-06 20:19:13 +00:00
|
|
|
| VM_DRIVER | VM driver to create virtual machine | virtualbox |
|
|
|
|
| CEPHCSI_IMAGE_REPO | Repo URL to pull cephcsi images | quay.io/cephcsi |
|
2020-10-13 05:17:42 +00:00
|
|
|
| K8S_IMAGE_REPO | Repo URL to pull kubernetes sidecar images | k8s.gcr.io/sig-storage |
|
2020-04-06 20:19:13 +00:00
|
|
|
| K8S_FEATURE_GATES | Feature gates to enable on kubernetes cluster | BlockVolume=true,CSIBlockVolume=true,VolumeSnapshotDataSource=true |
|
|
|
|
| ROOK_BLOCK_POOL_NAME | Block pool name to create in the rook instance | newrbdpool |
|
2019-06-03 10:06:15 +00:00
|
|
|
|
|
|
|
- creating kubernetes cluster
|
|
|
|
|
2020-10-13 10:53:37 +00:00
|
|
|
From the ceph-csi root directory, run:
|
|
|
|
|
|
|
|
```console
|
|
|
|
./scripts/minikube.sh up
|
|
|
|
```
|
2019-06-03 10:06:15 +00:00
|
|
|
|
|
|
|
- Teardown kubernetes cluster
|
|
|
|
|
2020-10-13 10:53:37 +00:00
|
|
|
```console
|
|
|
|
./scripts/minikube.sh clean
|
|
|
|
```
|
|
|
|
|
|
|
|
## Deploy Rook
|
|
|
|
|
|
|
|
The cephcsi E2E tests expects that you already have rook running in your cluster.
|
|
|
|
|
|
|
|
Thanks to [minikube](../scripts/minikube.sh) script for the handy `deploy-rook` option.
|
|
|
|
|
2019-06-03 10:06:15 +00:00
|
|
|
```console
|
2020-10-13 10:53:37 +00:00
|
|
|
./scripts/minikube.sh deploy-rook
|
2019-06-03 10:06:15 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Test parameters
|
|
|
|
|
|
|
|
In addition to standard go tests parameters, the following custom parameters
|
|
|
|
are available while running tests:
|
|
|
|
|
2020-02-25 11:45:54 +00:00
|
|
|
| flag | description |
|
|
|
|
| ----------------- | ----------------------------------------------------------------------------- |
|
2020-02-26 08:11:05 +00:00
|
|
|
| deploy-timeout | Timeout to wait for created kubernetes resources (default: 10 minutes) |
|
2022-04-11 09:15:13 +00:00
|
|
|
| deploy-cephfs | Deploy cephFS CSI driver as part of E2E (default: true) |
|
|
|
|
| deploy-rbd | Deploy rbd CSI driver as part of E2E (default: true) |
|
|
|
|
| test-cephfs | Test cephFS CSI driver as part of E2E (default: true) |
|
2020-07-25 16:38:27 +00:00
|
|
|
| upgrade-testing | Perform upgrade testing (default: false) |
|
2022-04-11 09:51:12 +00:00
|
|
|
| upgrade-version | Target version for upgrade testing (default: "v3.5.1") |
|
2022-04-11 09:15:13 +00:00
|
|
|
| test-rbd | Test rbd CSI driver as part of E2E (default: true) |
|
2020-02-25 11:45:54 +00:00
|
|
|
| cephcsi-namespace | The namespace in which cephcsi driver will be created (default: "default") |
|
|
|
|
| rook-namespace | The namespace in which rook operator is installed (default: "rook-ceph") |
|
|
|
|
| kubeconfig | Path to kubeconfig containing embedded authinfo (default: $HOME/.kube/config) |
|
|
|
|
| timeout | Panic test binary after duration d (default 0, timeout disabled) |
|
|
|
|
| v | Verbose: print additional output |
|
2022-04-07 15:36:45 +00:00
|
|
|
| filesystem | Name of the CephFS filesystem (default: "myfs") |
|
2022-04-07 15:42:48 +00:00
|
|
|
| is-openshift | Run in OpenShift compatibility mode, skips certain new feature tests |
|
2019-06-03 10:06:15 +00:00
|
|
|
|
2020-08-10 03:17:20 +00:00
|
|
|
## E2E for snapshot
|
|
|
|
|
|
|
|
After the support for snapshot/clone has been added to ceph-csi,
|
|
|
|
you need to follow these steps before running e2e.
|
|
|
|
|
|
|
|
- Install snapshot controller and Beta snapshot CRD
|
|
|
|
|
|
|
|
```console
|
2020-10-13 10:53:37 +00:00
|
|
|
./scripts/install-snapshot.sh install
|
2020-08-10 03:17:20 +00:00
|
|
|
```
|
|
|
|
|
2020-10-13 10:53:37 +00:00
|
|
|
Once you are done running e2e please perform the cleanup by running following:
|
2020-08-10 03:17:20 +00:00
|
|
|
|
2020-10-13 10:53:37 +00:00
|
|
|
```console
|
|
|
|
./scripts/install-snapshot.sh cleanup
|
|
|
|
```
|
2020-08-10 03:17:20 +00:00
|
|
|
|
2019-06-03 10:06:15 +00:00
|
|
|
## Running E2E
|
|
|
|
|
|
|
|
`
|
|
|
|
Note:- Prior to running the tests, you may need to copy the kubernetes configuration
|
|
|
|
file to `$HOME/.kube/config` which is required to communicate with kubernetes
|
|
|
|
cluster or you can pass `kubeconfig`flag while running tests.
|
|
|
|
`
|
|
|
|
|
|
|
|
Functional tests are run by the `go test` command.
|
|
|
|
|
2020-10-13 10:53:37 +00:00
|
|
|
```console
|
|
|
|
go test ./e2e/ -timeout=20m -v -mod=vendor
|
|
|
|
```
|
2019-06-03 10:06:15 +00:00
|
|
|
|
2021-01-19 11:48:45 +00:00
|
|
|
To run specific tests, you can specify options
|
|
|
|
|
|
|
|
```console
|
|
|
|
go test ./e2e/ --test-cephfs=false --test-rbd=false --upgrade-testing=true
|
|
|
|
```
|
|
|
|
|
|
|
|
To run e2e for specific tests with `make`, use
|
|
|
|
|
|
|
|
```console
|
|
|
|
make run-e2e E2E_ARGS="--test-cephfs=false --test-rbd=true --upgrade-testing=false"
|
|
|
|
```
|
|
|
|
|
2020-10-13 10:53:37 +00:00
|
|
|
You can also invoke functional tests with `make` command
|
2019-06-03 10:06:15 +00:00
|
|
|
|
|
|
|
```console
|
2020-10-13 10:53:37 +00:00
|
|
|
make func-test TESTOPTIONS="-deploy-timeout=10 -timeout=30m -v"
|
2019-06-03 10:06:15 +00:00
|
|
|
```
|