From fc710582ff94487eb6670736238faf7cb7c7400d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= Date: Thu, 13 Apr 2023 12:52:48 +0200 Subject: [PATCH] Update e2e test guidelines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Weiße --- edgeless/tests/README.md | 45 +++++++++++++++++------------- edgeless/tests/patch.diff | 58 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 edgeless/tests/patch.diff diff --git a/edgeless/tests/README.md b/edgeless/tests/README.md index 44369a58..9838168d 100644 --- a/edgeless/tests/README.md +++ b/edgeless/tests/README.md @@ -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= 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) +``` diff --git a/edgeless/tests/patch.diff b/edgeless/tests/patch.diff new file mode 100644 index 00000000..3a398b80 --- /dev/null +++ b/edgeless/tests/patch.diff @@ -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