summaryrefslogtreecommitdiffstats
path: root/kud/tests/_functions.sh
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-08-05 07:19:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-05 07:19:37 +0000
commit7c4eb36248331166a6fc3e57fb304a8113edc175 (patch)
tree9f9354cd49d0103c89cd9791c387a43ec8eb7f14 /kud/tests/_functions.sh
parent4798f0f660de48e43e79626685e8b28bac7f2615 (diff)
parent1b282801d6a7a0e9104984895911b828da402623 (diff)
Merge changes I46d47e64,I14d8eb6b
* changes: Add test case for loading vFW Helm chart Correct cni retrieval process from resource name
Diffstat (limited to 'kud/tests/_functions.sh')
-rwxr-xr-xkud/tests/_functions.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/kud/tests/_functions.sh b/kud/tests/_functions.sh
index 86636ccd..d585086b 100755
--- a/kud/tests/_functions.sh
+++ b/kud/tests/_functions.sh
@@ -173,6 +173,26 @@ function wait_deployment {
done
}
+# wait_for_pod() - Wait until first pod matched by kubectl filters is in running status
+function wait_for_pod {
+ #Example usage:
+ # wait_for_pods example_pod
+ # wait_for_pods --namespace test different_pod
+ # wait_for_pods -n test -l app=plugin_test
+
+ status_phase=""
+ while [[ "$status_phase" != "Running" ]]; do
+ new_phase="$(kubectl get pods -o 'go-template={{ index .items 0 "status" "phase" }}' "$@" )"
+ if [[ "$new_phase" != "$status_phase" ]]; then
+ echo "$(date +%H:%M:%S) - Filter=[$*] : $new_phase"
+ status_phase="$new_phase"
+ fi
+ if [[ "$new_phase" == "Err"* ]]; then
+ exit 1
+ fi
+ done
+}
+
# setup() - Base testing setup shared among functional tests
function setup {
if ! $(kubectl version &>/dev/null); then