feat(zfspv): check pod-status in BDD test (#171)

Signed-off-by: vaniisgh <vanisingh@live.co.uk>
This commit is contained in:
vaniisgh 2020-07-02 14:07:43 +05:30 committed by GitHub
parent 051f26fe16
commit a19877e4c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 2 deletions

View file

@ -0,0 +1 @@
Add checks to ensure zfs-driver status is running in BDD test

View file

@ -44,8 +44,41 @@ dumpControllerLogs() {
printf "\n\n"
}
# wait for zfs driver to be UP
sleep 20
isPodReady(){
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n kube-system)" = 'True' ]
}
isDriverReady(){
for pod in $zfsDriver;do
isPodReady $pod || return 1
done
}
waitForZFSDriver() {
period=120
interval=1
i=0
while [ "$i" -le "$period" ]; do
zfsDriver="$(kubectl get pods -l role=openebs-zfs -o 'jsonpath={.items[*].metadata.name}' -n kube-system)"
if isDriverReady $zfsDriver; then
return 0
fi
i=$(( i + interval ))
echo "Waiting for zfs-driver to be ready..."
sleep "$interval"
done
echo "Waited for $period seconds, but all pods are not ready yet."
return 1
}
# wait for zfs-driver to be up
waitForZFSDriver
cd $TEST_DIR