summaryrefslogtreecommitdiffstats
path: root/kud/tests/optane.sh
diff options
context:
space:
mode:
authorChen, Tingjie <tingjie.chen@intel.com>2020-05-25 14:26:26 +0800
committerChen, Tingjie <tingjie.chen@intel.com>2020-05-30 11:48:31 +0800
commit22f755508a107c689f325042c4abaa98c5bd450e (patch)
tree669bf0079f12b96f156d7cfc7041f7ee5c8b9f2f /kud/tests/optane.sh
parent079d214800484b0bfedd22fc72f4b3c61ecc6f83 (diff)
Add support for pmem-csi plugin and e2e test
Issue-ID: MULTICLOUD-1046 Change-Id: I1853e071a99702c5e6f7ba9ca819746576fd0aca Signed-off-by: Chen, Tingjie <tingjie.chen@intel.com>
Diffstat (limited to 'kud/tests/optane.sh')
-rwxr-xr-xkud/tests/optane.sh89
1 files changed, 89 insertions, 0 deletions
diff --git a/kud/tests/optane.sh b/kud/tests/optane.sh
new file mode 100755
index 00000000..a8bf464e
--- /dev/null
+++ b/kud/tests/optane.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+# PDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+echo "[OPTANE-TEST] Check the NVDIMM hardware ..."
+ndctl_region=`ndctl list -R`
+if [[ $ndctl_region == "" ]] ; then
+ echo "No NVDIMM hardware, exit ..."
+ exit 0
+fi
+
+pod_sc_01=pod-sc-case-01
+pod_pvc_01=pod-pvc-case-01
+pod_app_01=pod-app-case-01
+
+cat << POD > $HOME/$pod_sc_01.yaml
+apiVersion: storage.k8s.io/v1
+kind: StorageClass
+metadata:
+ name: pmem-csi-sc-ext4
+parameters:
+ csi.storage.k8s.io/fstype: ext4
+ eraseafter: "true"
+provisioner: pmem-csi.intel.com
+reclaimPolicy: Delete
+volumeBindingMode: Immediate
+POD
+
+cat << POD > $HOME/$pod_pvc_01.yaml
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: pmem-csi-pvc-ext4
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 4Gi
+ storageClassName: pmem-csi-sc-ext4
+POD
+
+cat << POD > $HOME/$pod_app_01.yaml
+kind: Pod
+apiVersion: v1
+metadata:
+ name: my-csi-app-1
+spec:
+ containers:
+ - name: my-frontend
+ image: busybox
+ command: [ "sleep", "100000" ]
+ volumeMounts:
+ - mountPath: "/data"
+ name: my-csi-volume
+ volumes:
+ - name: my-csi-volume
+ persistentVolumeClaim:
+ claimName: pmem-csi-pvc-ext4
+POD
+
+kubectl apply -f $HOME/$pod_sc_01.yaml
+kubectl apply -f $HOME/$pod_pvc_01.yaml
+kubectl apply -f $HOME/$pod_app_01.yaml
+
+echo "Sleep for several minutes ..."
+sleep 300
+
+pvc_meta="$(kubectl get pvc -o jsonpath='{.items[0].metadata.name}')"
+pvc_status="$(kubectl get pvc -o jsonpath='{.items[0].status.phase}')"
+if [[ $pvc_meta == "pmem-csi-pvc-ext4" ]] && [[ $pvc_status == "Bound" ]] ; then
+ echo "[OPTANE] SUCCESS: created PMEM-CSI volume!"
+else
+ echo "[OPTANE] FAILED: cannot create PMEM-CSI volume!"
+fi
+
+echo "Wait and remove the test resource ..."
+sleep 60
+
+kubectl delete -f $HOME/$pod_sc_01.yaml
+kubectl delete -f $HOME/$pod_pvc_01.yaml
+kubectl delete -f $HOME/$pod_app_01.yaml
+