aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/distrib
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2016-03-28 11:31:51 -0700
committerGravatar murgatroid99 <mlumish@google.com>2016-03-28 11:31:51 -0700
commitbebf2df6e4c2548ef53ec93a6339900ad3de61e5 (patch)
tree06bba5fe852fda5a0894087484745417efc86a90 /test/distrib
parent680e50aa7ff026b81f3ea955635713796e4a4ea0 (diff)
Make distribtest more robust, especially on Mac
Diffstat (limited to 'test/distrib')
-rwxr-xr-xtest/distrib/node/run_distrib_test.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/distrib/node/run_distrib_test.sh b/test/distrib/node/run_distrib_test.sh
index e9183a203b..13a42fcb0a 100755
--- a/test/distrib/node/run_distrib_test.sh
+++ b/test/distrib/node/run_distrib_test.sh
@@ -28,6 +28,15 @@
# (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
@@ -39,7 +48,9 @@ set -ex
npm install -g node-static
STATIC_SERVER=127.0.0.1
-STATIC_PORT=$$
+# 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:
static "$EXTERNAL_GIT_ROOT/input_artifacts" -a $STATIC_SERVER -p $STATIC_PORT &
@@ -49,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