Skip to content

Commit

Permalink
feat(zfspv): check pod-status in BDD test (#171)
Browse files Browse the repository at this point in the history
Signed-off-by: vaniisgh <vanisingh@live.co.uk>
  • Loading branch information
vaniisgh authored Jul 2, 2020
1 parent 051f26f commit a19877e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/171-vaniisgh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add checks to ensure zfs-driver status is running in BDD test
37 changes: 35 additions & 2 deletions ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a19877e

Please sign in to comment.