Skip to content

Commit

Permalink
[ FAB-6339 ] Update fabric-ca_setup.sh polling
Browse files Browse the repository at this point in the history
For consistency, and also to coordinate the standard
olling interval, fabric-ca_setup.sh is updated to pollSever.

Change-Id: Ifdd39a226a36574cbaaa4a7e32a32012281d3973
Signed-off-by: Allen Bailey <eabailey@us.ibm.com>
  • Loading branch information
rennman committed Oct 2, 2017
1 parent 0ed7e38 commit 09f4bda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions scripts/fvt/fabric-ca_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ fi
function startFabricCa() {
local inst=$1
local start=$SECONDS
local timeout="$((TIMEOUT*2))"
local timeout="$TIMEOUT"
local now=0
local server_addr=0.0.0.0
local port=${USER_CA_PORT-$CA_DEFAULT_PORT}
port=$((port+$inst))
# if not explcitly set, use default
test -n "${port}" && local server_port="--port $port" || local server_port=""
local server_port="--port $port"

if test -n "$FABRIC_CA_SERVER_PROFILE_PORT" ; then
local profile_port=$((FABRIC_CA_SERVER_PROFILE_PORT+$inst))
Expand All @@ -258,13 +258,10 @@ function startFabricCa() {
$FABRIC_CA_SERVEREXEC start --address $server_addr $server_port --ca.certfile $DST_CERT \
--ca.keyfile $DST_KEY --config $RUNCONFIG 2>&1 &
fi
until test "$started" = ":::$port" -o "$now" -gt "$timeout"; do
started=$(ss -ltnp src :$port | awk 'NR!=1 {print $4}')
sleep .1
let now+=1
done

printf "FABRIC_CA server on $server_addr:$port "
if test "$started" = ":::$port"; then
pollServer $FABRIC_CA_SERVEREXEC $server_addr $port $timeout
if test "$?" -eq 0; then
echo "STARTED"
else
RC=$((RC+1))
Expand Down
2 changes: 1 addition & 1 deletion scripts/fvt/fabric-ca_utils
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pollServer() {

# continue to poll host:port until
# we either get a response, or reach timeout
while test "$(($(date +%s)-starttime))" -lt "$((timeout*2))" -a $rc -ne 0
while test "$(($(date +%s)-starttime))" -lt "$timeout" -a $rc -ne 0
do
printf "\r%s%03d" "Waiting for $app to $action on $host:$port ..." "$(($(date +%s)-starttime))"
ss -lpnt "src $host:$port"
Expand Down

0 comments on commit 09f4bda

Please sign in to comment.