Skip to content

Commit

Permalink
Update e2e test guidelines
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Jun 18, 2024
1 parent 95178a1 commit fc71058
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 19 deletions.
45 changes: 26 additions & 19 deletions edgeless/tests/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
# CSI driver e2e tests

Run end to end tests using the kubernetes `e2e.test` binary.
Run CSI e2e tests using [`sonobuoy`](https://github.com/vmware-tanzu/sonobuoy/releases/latest).

## Generate test framework

Generate CSI e2e test sonobuoy config:

Download the binary for the your Kubernetes version:
```shell
K8S_VER=1.23.0
curl --location https://dl.k8s.io/v${K8S_VER}/kubernetes-test-linux-amd64.tar.gz | \
tar --strip-components=3 -zxf - kubernetes/test/bin/e2e.test
KUBECONFIG=</path/to/kubeconfig`
sonobuoy gen --e2e-focus='External.Storage' --e2e-skip='\[Disruptive\]' --kubeconfig=${KUBECONFIG} > sonobuoy.yaml
```

For an overview on how to run tests read the [Kubernetes blog post](https://kubernetes.io/blog/2020/01/08/testing-of-csi-drivers/#end-to-end-testing).
Apply driver patch:

```shell
patch sonobuoy.yaml < patch.diff
```

## Running the test suite

1. Set up the CSI driver
Start the test:

```shell
kubectl apply -k ./deploy/kubernetes/overlays/edgeless/v1.0.0
kubectl wait -n kube-system csi-gce-pd-controller --for condition=available
```
```shell
kubectl apply -f sonobuoy.yaml
```

1. Run the tests
Wait for tests to complete:

```shell
./e2e.test \
-ginkgo.v \
-ginkgo.focus='External.Storage' \
-ginkgo.skip='\[Disruptive\]' \
-storage.testdriver=driver.yaml
```
```shell
sonobuoy wait
```

Analyze results:

```shell
sonobuoy results $(sonobuoy retrieve)
```
58 changes: 58 additions & 0 deletions edgeless/tests/patch.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
--- o.yaml 2023-04-13 12:13:33.181285060 +0200
+++ sonobuoy.yaml 2023-04-13 09:36:28.475532271 +0200
@@ -64,6 +64,10 @@
data:
plugin-0.yaml: |-
podSpec:
+ volumes:
+ - name: csi-driver-config-volume
+ configMap:
+ name: csi-driver-test-config
containers: []
nodeSelector:
kubernetes.io/os: linux
@@ -86,7 +90,7 @@
- /run_e2e.sh
env:
- name: E2E_EXTRA_ARGS
- value: --progress-report-url=http://localhost:8099/progress
+ value: --progress-report-url=http://localhost:8099/progress -storage.testdriver=/tmp/csi-cfg/driver.yaml
- name: E2E_FOCUS
value: External.Storage
- name: E2E_PARALLEL
@@ -113,6 +117,8 @@
volumeMounts:
- mountPath: /tmp/sonobuoy/results
name: results
+ - mountPath: /tmp/csi-cfg
+ name: csi-driver-config-volume
plugin-1.yaml: |-
podSpec:
containers: []
@@ -245,4 +251,28 @@
sonobuoy-component: aggregator
type: ClusterIP
---
-
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: csi-driver-test-config
+ namespace: sonobuoy
+data:
+ driver.yaml: |
+ StorageClass:
+ FromName: true
+ DriverInfo:
+ Name: gcp.csi.confidential.cloud
+ SupportedFsType:
+ ext4: {}
+ xfs: {}
+ Capabilities:
+ persistence: true
+ block: true
+ exec: true
+ nodeExpansion: true
+ controllerExpansion: true
+ onlineExpansion: true
+ topology: true

0 comments on commit fc71058

Please sign in to comment.