aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/distrib/node/run_distrib_test.sh
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-30 08:06:31 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-30 08:06:31 -0700
commit56f26a59911dce75c5cb10e01710c58ef3a3d067 (patch)
tree9eedf751715ff1c247372203bc47c68139d611b4 /test/distrib/node/run_distrib_test.sh
parent92e0f335bd817bd808c2373fa9bca5b91b9d3a65 (diff)
parent6771361fada605596428e7ce332ef28277323d2e (diff)
Merge branch 'optionalize_roundrobin' into optionalize_census
Diffstat (limited to 'test/distrib/node/run_distrib_test.sh')
-rwxr-xr-xtest/distrib/node/run_distrib_test.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/distrib/node/run_distrib_test.sh b/test/distrib/node/run_distrib_test.sh
index 9b8f15771b..13a42fcb0a 100755
--- a/test/distrib/node/run_distrib_test.sh
+++ b/test/distrib/node/run_distrib_test.sh
@@ -28,23 +28,31 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+function finish() {
+ rv=$?
+ kill $STATIC_PID || true
+ curl "localhost:32767/drop/$STATIC_PORT" || true
+ exit $rv
+}
+
+trap finish EXIT
+
NODE_VERSION=$1
source ~/.nvm/nvm.sh
-set -ex
cd $(dirname $0)
nvm install $NODE_VERSION
+set -ex
npm install -g node-static
-# Kill off existing static servers
-kill -9 $(ps aux | grep '[n]ode .*static' | awk '{print $2}') || true
-
STATIC_SERVER=127.0.0.1
-STATIC_PORT=8080
+# If port_server is running, get port from that. Otherwise, assume we're in
+# docker and use 8080
+STATIC_PORT=$(curl 'localhost:32767/get' || echo '8080')
-# Serves the input_artifacts directory statically at localhost:8080
+# Serves the input_artifacts directory statically at localhost:
static "$EXTERNAL_GIT_ROOT/input_artifacts" -a $STATIC_SERVER -p $STATIC_PORT &
STATIC_PID=$!
@@ -52,6 +60,4 @@ STATIC_URL="http://$STATIC_SERVER:$STATIC_PORT/"
npm install --unsafe-perm $STATIC_URL/grpc.tgz --grpc_node_binary_host_mirror=$STATIC_URL
-kill -9 $STATIC_PID
-
./distrib_test.js