From 02e8cb690d0816a26753e477196dcc82bc0b6ed5 Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Fri, 1 Dec 2017 14:00:23 +0000 Subject: [PATCH] find host ip using ifconfig on mac (#2914) Signed-off-by: andrew-coleman --- packages/composer-tests-functional/scripts/run-fv-tests.sh | 6 +++++- .../scripts/run-integration-tests.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/composer-tests-functional/scripts/run-fv-tests.sh b/packages/composer-tests-functional/scripts/run-fv-tests.sh index 6a3c5b84a9..0b77c4dd9b 100755 --- a/packages/composer-tests-functional/scripts/run-fv-tests.sh +++ b/packages/composer-tests-functional/scripts/run-fv-tests.sh @@ -80,7 +80,11 @@ for FVTEST in $(echo ${FVTEST} | tr "," " "); do cd ../composer-common npm publish --registry http://localhost:4873 cd ../composer-runtime-hlfv1 - GATEWAY="$(docker inspect hlfv1_default | grep Gateway | cut -d \" -f4)" + if [ `uname` = "Darwin" ]; then + GATEWAY="$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')" + else + GATEWAY="$(docker inspect hlfv1_default | grep Gateway | cut -d \" -f4)" + fi echo registry=http://${GATEWAY}:4873 > .npmrc cd "${DIR}" fi diff --git a/packages/composer-tests-integration/scripts/run-integration-tests.sh b/packages/composer-tests-integration/scripts/run-integration-tests.sh index bca5e9e340..4bce226b5e 100755 --- a/packages/composer-tests-integration/scripts/run-integration-tests.sh +++ b/packages/composer-tests-integration/scripts/run-integration-tests.sh @@ -66,7 +66,11 @@ for INTEST in $(echo ${INTEST} | tr "," " "); do ARCH=$ARCH docker-compose -f ${DOCKER_FILE} up -d cd ${DIR} cd ../composer-runtime-hlfv1 - GATEWAY="$(docker inspect hlfv1_default | grep Gateway | cut -d \" -f4)" + if [ `uname` = "Darwin" ]; then + GATEWAY="$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')" + else + GATEWAY="$(docker inspect hlfv1_default | grep Gateway | cut -d \" -f4)" + fi echo registry=http://${GATEWAY}:4873 > .npmrc fi