Add OpenEBS cStor to addons test 64/4864/1
authorTodd Malsbary <todd.malsbary@intel.com>
Thu, 12 May 2022 23:41:35 +0000 (16:41 -0700)
committerTodd Malsbary <todd.malsbary@intel.com>
Fri, 13 May 2022 18:25:18 +0000 (11:25 -0700)
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Change-Id: I71ff73479594e7c8f51b6680fafb7d2d3f55ce3f

deploy/addons/addons.sh
deploy/addons/openebs-cstor.yaml [new file with mode: 0644]

index f2aa57e..865664f 100755 (executable)
@@ -104,6 +104,15 @@ function is_addon_ready {
     esac
 }
 
+function test_openebs {
+    local -r cluster_name=${CLUSTER_NAME:-icn}
+    local -r cluster_kubeconfig="${BUILDDIR}/${cluster_name}.conf"
+    kubectl --kubeconfig=${cluster_kubeconfig} apply -f ${SCRIPTDIR}/openebs-cstor.yaml
+    kubectl --kubeconfig=${cluster_kubeconfig} wait pod hello-cstor-csi-disk-pod --for=condition=Ready --timeout=5m
+    kubectl --kubeconfig=${cluster_kubeconfig} exec -it hello-cstor-csi-disk-pod -- cat /mnt/store/greet.txt
+    kubectl --kubeconfig=${cluster_kubeconfig} delete -f ${SCRIPTDIR}/openebs-cstor.yaml
+}
+
 function test_addons {
     install_deps
 
@@ -120,7 +129,7 @@ function test_addons {
     popd
 
     pushd ${KUDPATH}/kud/tests
-    failed_kud_tests=""
+    failed_tests=""
     container_runtime=$(KUBECONFIG=${cluster_kubeconfig} kubectl get nodes -o jsonpath='{.items[].status.nodeInfo.containerRuntimeVersion}')
     # TODO Temporarily remove kubevirt from kud_tests below.  The
     # kubevirt self-test needs AllowTcpForwarding yes in
@@ -138,15 +147,18 @@ function test_addons {
         if [[ ! -z ${addon} ]]; then
             wait_for is_addon_ready ${addon}
         fi
-        KUBECONFIG=${cluster_kubeconfig} bash ${test}.sh || failed_kud_tests="${failed_kud_tests} ${test}"
+        KUBECONFIG=${cluster_kubeconfig} bash ${test}.sh || failed_tests="${failed_tests} ${test}"
     done
     # The plugin_fw_v2 test needs the EMCO controllers in place
     register_emco_controllers
-    DEMO_FOLDER=${KUDPATH}/kud/demo KUBECONFIG=${cluster_kubeconfig} bash plugin_fw_v2.sh --external || failed_kud_tests="${failed_kud_tests} plugin_fw_v2"
+    DEMO_FOLDER=${KUDPATH}/kud/demo KUBECONFIG=${cluster_kubeconfig} bash plugin_fw_v2.sh --external || failed_tests="${failed_tests} plugin_fw_v2"
     unregister_emco_controllers
     popd
-    if [[ ! -z "$failed_kud_tests" ]]; then
-        echo "Test cases failed:${failed_kud_tests}"
+
+    test_openebs || failed_tests="${failed_tests} openebs"
+
+    if [[ ! -z "$failed_tests" ]]; then
+        echo "Test cases failed:${failed_tests}"
         exit 1
     fi
     echo "All test cases passed"
diff --git a/deploy/addons/openebs-cstor.yaml b/deploy/addons/openebs-cstor.yaml
new file mode 100644 (file)
index 0000000..d3283a3
--- /dev/null
@@ -0,0 +1,32 @@
+---
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: cstor-csi-disk-pvc
+spec:
+  storageClassName: cstor-csi-disk
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 5G
+---
+apiVersion: v1
+kind: Pod
+metadata:
+  name: hello-cstor-csi-disk-pod
+spec:
+  volumes:
+  - name: pod-volume
+    persistentVolumeClaim:
+      claimName: cstor-csi-disk-pvc
+  containers:
+  - name: hello-container
+    image: busybox
+    command:
+       - sh
+       - -c
+       - 'while true; do echo "`date` [`hostname`] Hello from OpenEBS Local PV." >> /mnt/store/greet.txt; sleep $(($RANDOM % 5 + 300)); done'
+    volumeMounts:
+    - mountPath: /mnt/store
+      name: pod-volume