From 4d25b1634f8e49d3351cc4288a317821fd3dbe07 Mon Sep 17 00:00:00 2001 From: Jaydip Gabani Date: Tue, 7 Nov 2023 20:45:54 +0000 Subject: [PATCH] fixing ci test errors Signed-off-by: Jaydip Gabani --- test/bats/test.bats | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/bats/test.bats b/test/bats/test.bats index dc7ef017afa..42e43efc317 100644 --- a/test/bats/test.bats +++ b/test/bats/test.bats @@ -184,7 +184,11 @@ teardown_file() { num_namespaces=$(kubectl get ns -o json | jq '.items | length') local pod_ip="$(kubectl -n ${GATEKEEPER_NAMESPACE} get pod -l gatekeeper.sh/operation=webhook -ojson | jq --raw-output '[.items[].status.podIP][0]' | sed 's#\.#-#g')" - wait_for_process ${WAIT_TIME} ${SLEEP_TIME} "kubectl exec -it temp -- curl http://${pod_ip}.${GATEKEEPER_NAMESPACE}.pod:8888/metrics | grep 'gatekeeper_sync{kind=\"Namespace\",status=\"active\"} ${num_namespaces}'" + local result=$(wait_for_process ${WAIT_TIME} ${SLEEP_TIME} "kubectl exec -it temp -- curl http://${pod_ip}.${GATEKEEPER_NAMESPACE}.pod:8888/metrics | grep 'gatekeeper_sync{kind=\"Namespace\",status=\"active\"} ${num_namespaces}'") + if [[ $? -ne 0 ]]; then + local pod_ip="$(kubectl -n ${GATEKEEPER_NAMESPACE} get pod -l gatekeeper.sh/operation=webhook -ojson | jq --raw-output '[.items[].status.podIP][1]' | sed 's#\.#-#g')" + wait_for_process ${WAIT_TIME} ${SLEEP_TIME} "kubectl exec -it temp -- curl http://${pod_ip}.${GATEKEEPER_NAMESPACE}.pod:8888/metrics | grep 'gatekeeper_sync{kind=\"Namespace\",status=\"active\"} ${num_namespaces}'" + fi kubectl delete pod temp }