You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/06/13 23:07:31 UTC

[GitHub] csantanapr closed pull request #221: add retry loop to test invoke

csantanapr closed pull request #221: add retry loop to test invoke
URL: https://github.com/apache/incubator-openwhisk-deploy-kube/pull/221
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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.


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services