Wait the pod from terminating to terminated before the end of test
Change-Id: I625f788e2b4efcde6cf1982a075439c2c8991498
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 1b3ac39..2f2772e 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -267,4 +267,9 @@
Log ${currentStatusofPod}
Should Contain ${currentStatusofPod} ${expectedStatus}
-
+Check Expected Running Pods Number By Label
+ [Arguments] ${namespace} ${key} ${value} ${number}
+ [Documentation] Succeeds if the desired pod has expected number replicas
+ ${rc} ${count} Run and Return Rc and Output
+ ... kubectl -n ${namespace} get pods -l ${key}=${value} -o json | jq -r ".items[].status.phase" | wc -l
+ Should Be Equal as Integers ${count} ${number}
diff --git a/tests/functional/K8S_SystemTest.robot b/tests/functional/K8S_SystemTest.robot
index 615c538..dcf47c5 100644
--- a/tests/functional/K8S_SystemTest.robot
+++ b/tests/functional/K8S_SystemTest.robot
@@ -18,7 +18,7 @@
Resource ../../libraries/k8s.robot
*** Variables ***
-${timeout} 60s
+${timeout} 120s
${desired_ETCD_cluster_size} 3
${minimal_ETCD_cluster_size} 2
${namespace} voltha
@@ -41,6 +41,8 @@
# based on https://github.com/ETCD-io/ETCD/blob/master/Documentation/faq.md#what-is-failure-tolerance
Scale ETCD ${namespace} ${minimal_ETCD_cluster_size}
Wait Until Keyword Succeeds ${timeout} 2s Validate ETCD Size ${namespace} ${minimal_ETCD_cluster_size}
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Check Expected Running Pods Number By Label ${namespace} ${ETCD_pod_label_key} ${ETCD_name} 2
Scale Up ETCD Cluster
[Documentation] Recover the ETCD cluster by scaling up its size