diff --git a/ci/ci-test.sh b/ci/ci-test.sh index f48626516..e408ddd24 100755 --- a/ci/ci-test.sh +++ b/ci/ci-test.sh @@ -4,32 +4,34 @@ set -e SNAP_CLASS=deploy/sample/zfssnapclass.yaml TEST_DIR="tests" +OPENEBS_NAMESPACE="openebs" # Prepare env for running BDD tests # Minikube is already running -helm install zfs-localpv ./deploy/helm/charts -n "$OPENEBS_NAMESPACE" --create-namespace --set zfsPlugin.pullPolicy=Never --set analytics.enabled=false +helm install zfs-localpv ./deploy/helm/charts -n "openebs" --create-namespace --set zfsPlugin.pullPolicy=Never --set analytics.enabled=false kubectl apply -f "$SNAP_CLASS" dumpAgentLogs() { NR=$1 - AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n openebs) - kubectl describe po "$AgentPOD" -n openebs + AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n "openebs") + kubectl describe po "$AgentPOD" -n "openebs" printf "\n\n" - kubectl logs --tail="${NR}" "$AgentPOD" -n openebs -c openebs-zfs-plugin + kubectl logs --tail="${NR}" "$AgentPOD" -n "openebs" -c openebs-zfs-plugin printf "\n\n" } dumpControllerLogs() { NR=$1 - ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n openebs) - kubectl describe po "$ControllerPOD" -n openebs + ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n "openebs") + kubectl describe po "$ControllerPOD" -n "openebs" printf "\n\n" - kubectl logs --tail="${NR}" "$ControllerPOD" -n openebs -c openebs-zfs-plugin + kubectl logs --tail="${NR}" "$ControllerPOD" -n "openebs" -c openebs-zfs-plugin printf "\n\n" } isPodReady(){ + echo $1 [ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n openebs)" = 'True' ] } @@ -44,10 +46,13 @@ isDriverReady(){ waitForZFSDriver() { period=120 interval=1 - + echo "Ashish" + echo openebs + echo "Fetching pods with label 'role=openebs-zfs' in namespace 'openebs'" i=0 while [ "$i" -le "$period" ]; do zfsDriver="$(kubectl get pods -l role=openebs-zfs -o 'jsonpath={.items[*].metadata.name}' -n openebs)" + echo "$zfsDriver" if isDriverReady "$zfsDriver"; then return 0 fi @@ -70,7 +75,7 @@ runTestSuite() { cd $TEST_DIR - kubectl get po -n openebs + kubectl get po -n "openebs" set +e @@ -103,10 +108,10 @@ runTestSuite() { kubectl get sc --all-namespaces -oyaml echo "get zfs volume details" - kubectl get zfsvolumes.zfs.openebs.io -n openebs -oyaml + kubectl get zfsvolumes.zfs.openebs.io -n "openebs" -oyaml echo "get zfs snapshot details" - kubectl get zfssnapshots.zfs.openebs.io -n openebs -oyaml + kubectl get zfssnapshots.zfs.openebs.io -n "openebs" -oyaml exit 1 fi @@ -115,17 +120,17 @@ runTestSuite() { runTestSuite bdd_coverage.txt "!custom-node-id" prepareCustomNodeIdEnv() { - for node in $(kubectl get nodes -n openebs -o jsonpath='{.items[*].metadata.name}'); do - local zfsNode=$(kubectl get zfsnode -n openebs -o jsonpath="{.items[?(@.metadata.ownerReferences[0].name=='${node}')].metadata.name}") + for node in $(kubectl get nodes -n "openebs" -o jsonpath='{.items[*].metadata.name}'); do + local zfsNode=$(kubectl get zfsnode -n "openebs" -o jsonpath="{.items[?(@.metadata.ownerReferences[0].name=='${node}')].metadata.name}") echo "Relabeling node ${node} with ${node}-custom-id" kubectl label node "${node}" openebs.io/nodeid="${node}-custom-id" --overwrite - local nodeDriver=$(kubectl get pods -l name=openebs-zfs-node -o jsonpath="{.items[?(@.spec.nodeName=='${node}')].metadata.name}" -n openebs) + local nodeDriver=$(kubectl get pods -l name=openebs-zfs-node -o jsonpath="{.items[?(@.spec.nodeName=='${node}')].metadata.name}" -n "openebs") echo "Restarting ${nodeDriver} on ${node} to pick up the new node id" - kubectl delete pod "${nodeDriver}" -n openebs + kubectl delete pod "${nodeDriver}" -n "openebs" echo "Deleting old zfsnode ${zfsNode}" - kubectl delete zfsnode "${zfsNode}" -n openebs + kubectl delete zfsnode "${zfsNode}" -n "openebs" done }