This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-openwhisk-deploy-kube.git


The following commit(s) were added to refs/heads/master by this push:
     new 81fc7af  add retry loop to test invoke (#221)
81fc7af is described below

commit 81fc7af8c22e0fe95cb06df3aa2cc3900bb4c4ca
Author: David Grove <[email protected]>
AuthorDate: Wed Jun 13 19:07:29 2018 -0400

    add retry loop to test invoke (#221)
---
 tools/travis/build-helm.sh | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/tools/travis/build-helm.sh b/tools/travis/build-helm.sh
index f73740a..7e6c42c 100755
--- a/tools/travis/build-helm.sh
+++ b/tools/travis/build-helm.sh
@@ -198,13 +198,29 @@ if [ -z "$RESULT" ]; then
 fi
 
 # next invoke the new hello world action via the CLI
-RESULT=$(wsk -i action invoke --blocking hello | grep "\"status\": 
\"success\"")
-if [ -z "$RESULT" ]; then
+# We have a retry loop because we do not have a robust way to ask
+# the controller if it has a healthy invoker.  There is a lag of
+# unpredictable duration between the invoker pod reporting as Running
+# and the controller deciding the invoker is healthy.
+PASSED=false
+ATTEMPTS=0
+until $PASSED || [ $ATTEMPTS -eq 3 ]; do
+  RESULT=$(wsk -i action invoke --blocking hello | grep "\"status\": 
\"success\"")
+  if [ -z "$RESULT" ]; then
+    echo "Attempt $ATTEMPTS to invoke action via the CLI failed; will sleep 
and retry in case controller is slow registering invoker"
+    let ATTEMPTS=ATTEMPTS+1
+    sleep 10
+  else
+      PASSED=true
+  fi
+done
+if [ "$PASSED" = false ]; then
   echo "FAILED! Could not invoke hello action via CLI"
   exit 1
 fi
 
 # now run it as a web action
+# No need to retry here, we succeeded above so we have a working invoker
 HELLO_URL=$(wsk -i action get hello --url | grep "https://";)
 RESULT=$(wget --no-check-certificate -qO- $HELLO_URL | grep 'Hello world')
 if [ -z "$RESULT" ]; then
@@ -212,9 +228,6 @@ if [ -z "$RESULT" ]; then
   exit 1
 fi
 
-# wait a few seconds
-sleep 3
-
 # now define it as an api and invoke it that way
 
 # TEMP: test is not working yet in travis environment.

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to